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

Prevent merging of different variables with the same name and date but different attributes #339

Merged
merged 2 commits into from
May 12, 2023

Conversation

Metamess
Copy link
Contributor

@Metamess Metamess commented May 4, 2023

closes #336

Fixes a bug where cfgrib would incorrectly combine two different variables if they happened to have the same shortName and data. For example, all-zeroes data GRIB messages with stepType='instant' and stepType='avg' attributes for csrwe (Convective snowfall rate water equivalent) on days without snow.

@FussyDuck
Copy link

FussyDuck commented May 4, 2023

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (3951355) 95.44% compared to head (597b2ff) 95.44%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #339   +/-   ##
=======================================
  Coverage   95.44%   95.44%           
=======================================
  Files          26       26           
  Lines        2040     2040           
  Branches      236      236           
=======================================
  Hits         1947     1947           
  Misses         62       62           
  Partials       31       31           
Impacted Files Coverage Δ
cfgrib/xarray_store.py 93.84% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@iainrussell
Copy link
Member

Hi @Metamess,

Thank you for providing this great fix! I think the xarray documentation is not great when explaining exactly how all this matching works, but I could get the relevant data, reproduce the bug and confirm that your fix works. I just added a couple of tests using very small data, and fixed the 'black' formatting (you may have noticed that the 'code style' test failed. Hopefully it will go through now, and then I will merge it in. I also appreciated your comprehensive description of the problem - very helpful!
Cheers,
Iain

@iainrussell iainrussell merged commit 0214deb into ecmwf:master May 12, 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.

open_datasets() merges variables together if data is equal
4 participants