OSOceanAcoustics / echopype

Enabling interoperability and scalability in ocean sonar data analysis
https://echopype.readthedocs.io/
Apache License 2.0
94 stars 73 forks source link

Verify correct location_time attributes and encoding from update_platform #488

Closed emiliom closed 2 years ago

emiliom commented 2 years ago

Replaces part of #460

Ensure that the location_time attributes and encodings that have been added (see #476) are saved into the netcdf file (and zarr?) when exporting via to_netcdf. See the status update here

Additional note: I think there's some linkage between this task and #479. See the recent PR #486

emiliom commented 2 years ago

After #486, I've rerun my tests to check that the assigned location_time attributes and encoding are preserved after saving to netcdf. They are! But also realized that I wasn't using overwrite=True in my recent to_netcdf tests, so there's a cance I actually had fixed this problem earlier and missed seeing that :sob:. This is what ncdump -h now produces for the Platform group, in my test:

group: Platform {
  dimensions:
    mru_time = 1 ;
    location_time = 3581 ;
  variables:
    double mru_time(mru_time) ;
        mru_time:_FillValue = NaN ;
        mru_time:axis = "T" ;
        mru_time:long_name = "Timestamps for MRU datagrams" ;
        mru_time:standard_name = "time" ;
        mru_time:units = "seconds since 1900-01-01T00:00:00+00:00" ;
        mru_time:calendar = "gregorian" ;
    double location_time(location_time) ;
        location_time:_FillValue = NaN ;
        location_time:axis = "T" ;
        location_time:long_name = "Timestamps for NMEA datagrams" ;
        location_time:standard_name = "time" ;
        location_time:history = "2021-11-13 03:53:10.991381 +00:00. Added from external platform data, from file saildrone-gen_5-fisheries-acoustics-code-sprint-sd1039-20190617T130000-20190618T125959-1_hz-v1.1595357449818.nc" ;
        location_time:units = "seconds since 1900-01-01T00:00:00+00:00" ;
        location_time:calendar = "gregorian" ;
    double pitch(location_time) ;
        pitch:_FillValue = NaN ;
    double roll(location_time) ;
        roll:_FillValue = NaN ;
    double heave(location_time) ;
        heave:_FillValue = NaN ;
    double latitude(location_time) ;
        latitude:_FillValue = NaN ;
    double longitude(location_time) ;
        longitude:_FillValue = NaN ;
    double water_level(location_time) ;
        water_level:_FillValue = NaN ;

  // group attributes:
        :platform_code_ICES = "315" ;
        :platform_name = "sd1039" ;
        :platform_type = "Saildrone" ;
        :drop_keel_offset = NaN ;

Anyways, this is fixed. But I'll leave the issue open for now to focus on adding attributes to the additional variables added by update_platform: "pitch", "roll", "heave", "latitude", "longitude", "water_level". For these variables, all attributes are dropped and need to be added again.

emiliom commented 2 years ago

This issue has been addressed, including this: adding attributes to the additional variables added by update_platform: "pitch", "roll", "heave", "latitude", "longitude", "water_level". For these variables, all attributes are dropped and need to be added again.