Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

variable encoding for to_netcdf #334

Merged
merged 1 commit into from
Mar 2, 2023
Merged

Conversation

EddyCMWF
Copy link
Contributor

@EddyCMWF EddyCMWF commented Mar 2, 2023

This is required because netCDF encoding options (e.g. compression options) need to be added per variable and it is not always possible/simple/sensible to know what variables are in the grib file before converting to netCDF.

This change allows users to provide a common set of compression options which are applied to each data variable in the xr.dataset. Any encoding provided in the netcdf_kwargs_json overrides what is set via the global var_encoding_json.

The variable encoding is parsed using the -v or --var-encoding-json options, e.g.:
cfgrib to_netcdf -v '{"dtype": "float", "scale_factor": 0.1}' -o $OUTFILE $INFILE

* var_encoding options for to_netcdf convertor
@codecov-commenter
Copy link

codecov-commenter commented Mar 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.44%. Comparing base (134df11) to head (cfa24b8).
Report is 130 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #334      +/-   ##
==========================================
+ Coverage   95.40%   95.44%   +0.04%     
==========================================
  Files          26       26              
  Lines        2022     2040      +18     
  Branches      234      236       +2     
==========================================
+ Hits         1929     1947      +18     
  Misses         62       62              
  Partials       31       31              

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

@iainrussell
Copy link
Member

Thanks Eddy! I'm not sure that "-v" is quite the best argument, since it's usually used to denote 'verbose', but it seems like the best option at the moment. I'll merge the pull request, and if you think of another option abbreviation you prefer, we can always change it!

@iainrussell iainrussell merged commit 3951355 into ecmwf:master Mar 2, 2023
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.

3 participants