Skip to content

gridding updates#248

Open
smwoodman wants to merge 3 commits into
c-proof:mainfrom
smwoodman:main
Open

gridding updates#248
smwoodman wants to merge 3 commits into
c-proof:mainfrom
smwoodman:main

Conversation

@smwoodman

Copy link
Copy Markdown
Contributor

Addresses #226

  • fix bug to check for 'average_method' in ds[k].attrs.keys(), rather than in ds[k].attrs.values().
  • calculate profile_direction using mode, and ensure is only has time dimension.
  • skip gridding variable if variable includes attribute 'average_method: none' in input timeseries.
  • distance_over_ground (or DISTANCE_OVER_GROUND) is never gridded.
  • if a variable does not have an average_method attribute, add 'average_method = arithmetic mean' in output netcdf.
  • update tests and docs

Comment thread pyglider/ncprocess.py Outdated
skip_vars = {'time', lat_varname, lon_varname, depth_varname, profile_index_varname}
skip_vars = {
'time', lat_varname, lon_varname, depth_varname, profile_index_varname,
"distance_over_ground", "DISTANCE_OVER_GROUND",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to do this in some way other than adding both 'distance_over_ground' and 'DISTANCE_OVER_GROUND' to skip_vars (eg, using utils._resolve_role), but couldn't figure out how

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we look at the OG1 files we will see an entry for DISTANCE_OVER_GROUND

  DISTANCE_OVER_GROUND:
    processing_method:
      distance_over_ground:
        latitude: LATITUDE
        longitude: LONGITUDE
    long_name:     Distance over ground flown since mission start
    units:         km

I think this should gain a processing_role: distance_over_ground and then the "default" distance over ground should also get that processing role.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I added processing_role: distance_over_ground to the example slocum/seaexplorer OG1 yml files, and updated the gridding code to use utils._resolve_role for dog.

and then the "default" distance over ground should also get that processing role.

I think this means to add 'distance_over_ground' to the 'known_roles' block in _get_varnames, so I added it there (original shown below). But please redirect me as needed

def _get_varnames(deployment):
...
    known_roles = {
        'time', 'latitude', 'longitude', 'pressure', 'temperature',
        'conductivity', 'salinity', 'depth', 'profile_index',
        'profile_direction', 'oxygen_concentration',
    }

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.11%. Comparing base (e5b5c4a) to head (f2de423).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
pyglider/ncprocess.py 90.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #248      +/-   ##
==========================================
+ Coverage   68.02%   68.11%   +0.08%     
==========================================
  Files          15       15              
  Lines        2549     2562      +13     
==========================================
+ Hits         1734     1745      +11     
- Misses        815      817       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread pyglider/ncprocess.py
ds[profile_index_varname].values[good],
ds[td].values[good],
statistic='mean',
statistic=method,

@smwoodman smwoodman Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used method to be consistent with the for k in ds.keys(): block, even though the for td, bin_stat in profile_lookup.items(): uses bin_stat as the varname instead.

Update: I also switched from bin_stat to method in the for td, bin_stat in profile_lookup.items(): block, to be consistent throughout the function.

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.

2 participants