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

ValueError: size of reduced grid does not match number of data values #215

Open
srepmub opened this issue Feb 9, 2023 · 1 comment
Open

Comments

@srepmub
Copy link

srepmub commented Feb 9, 2023

hi,

running the following for a specific ECMWF forecast data file:

    for grb in grbs:
        print(grb)
        print(grb.gridType)
        print(grb.gaussianGridName)
        print(grb.values)

I'm getting the following output and traceback:

1:Sea ice area fraction:(0 - 1) (instant):reduced_gg:surface:level 0:fcst time 4 hrs:from 200306200000
reduced_gg
O1280

Traceback (most recent call last):
  File "/home/srepmub/s4l2-processors-st/modeldata/plot_ecmwf.py", line 17, in <module>
    print(grb.values)
  File "src/pygrib/_pygrib.pyx", line 766, in pygrib._pygrib.gribmessage.__getattr__
  File "src/pygrib/_pygrib.pyx", line 1172, in pygrib._pygrib.gribmessage.__getitem__
  File "src/pygrib/_pygrib.pyx", line 1279, in pygrib._pygrib.gribmessage._reshape_mask
  File "src/pygrib/_pygrib.pyx", line 32, in pygrib._pygrib._redtoreg
ValueError: size of reduced grid does not match number of data values

when using the eccodes bindings directly, I can get 'values' out no problem.

could this be an indication there is something wrong with the data file, or of a bug in pygrib..?

@srepmub
Copy link
Author

srepmub commented Feb 9, 2023

oooh.. using grb.expand_grid(False) avoids the issue. perhaps the valueerror could hint a bit at this? (TBH I haven't even checked the documentation, so possibly just my bad..)

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

No branches or pull requests

1 participant