Skip to content

[REFACTOR] Stage 1 improvements & tests#10

Merged
eleanorfrajka merged 7 commits into
mainfrom
eleanor-patch-10
Sep 7, 2025
Merged

[REFACTOR] Stage 1 improvements & tests#10
eleanorfrajka merged 7 commits into
mainfrom
eleanor-patch-10

Conversation

@eleanorfrajka
Copy link
Copy Markdown
Collaborator

@eleanorfrajka eleanorfrajka commented Sep 7, 2025

Refactor Stage 1 using Claude.

Description:

Now uses classes in stage1.py to more cleanly import and process to netCDF the data files.

Note that there are some choices articulated in there like:

    VARS_TO_REMOVE = {
        'sbe-cnv': ['potential_temperature', 'julian_days_offset', 'density'],
        'sbe-asc': ['potential_temperature', 'julian_days_offset', 'density'],
    }
    COORDS_TO_REMOVE = {
        'sbe-cnv': ['depth', 'latitude', 'longitude'],
        'sbe-asc': ['depth', 'latitude', 'longitude'],
    }

which may later need to be updated if ctd_tools changes.

Also enriches with metadata as:

    def _add_global_attributes(self, dataset, yaml_data: Dict[str, Any]):
        """Add global attributes from YAML configuration."""
        global_attrs = {
            'mooring_name': yaml_data['name'],
            'waterdepth': yaml_data['waterdepth'],
            'longitude': yaml_data.get('longitude', 0.0),
            'latitude': yaml_data.get('latitude', 0.0),
            'deployment_latitude': yaml_data.get('deployment_latitude', '00 00.000 N'),
            'deployment_longitude': yaml_data.get('deployment_longitude', '000 00.000 W'),
            'deployment_time': yaml_data.get('deployment_time', 'YYYY-mm-ddTHH:MM:ss'),
            'seabed_latitude': yaml_data.get('seabed_latitude', '00 00.000 N'),
            'seabed_longitude': yaml_data.get('seabed_longitude', '000 00.000 W'),
            'recovery_time': yaml_data.get('recovery_time', 'YYYY-mm-ddTHH:MM:ss'),
        }

Checklist:

  • I have followed the coding conventions.
  • I have updated or added tests to cover my changes.
  • I have updated the documentation if needed.
  • I have run pytest to check that all tests pass.
  • I have run pre-commit run --all-files to lint and format the code.

@eleanorfrajka eleanorfrajka merged commit 585cee8 into main Sep 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant