-
Notifications
You must be signed in to change notification settings - Fork 78
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
cfgrib not reading multiple accumulated precipitation fields #187
Comments
@blaylockbk this looks interesting and you are right, cfgrib probably overwrites the content of one variable with the other. In order to suggest a workaround I need to know the name of a key that distinguishes the two, can you point me to a sample of the data. |
Thanks for looking into this @alexamici. I appreciate it. This is a subset of a HRRR (high-resolution rapid refresh) file, with just the two accumulated precipitation fields I am working with: For additional context, here is the full HRRR file that above subset comes from: |
The "stepRange" key is different. Doing a grib_ls shows this
|
I'm not sure what cfgrib does with step ranges, but I guess what we want is a single tp variable with a step dimension with 2 steps. Normally, I'd suggest to just use the end step to denote this, but in this case, it's the end steps that are the same! |
ah, I see. I tried to filter based on the stepRange when loading it with xarray, but get a value error xr.open_dataset(FILE, engine='cfgrib',
backend_kwargs={'filter_by_keys': {'stepRange': '0-12'}})
|
@blaylockbk good guess! Unfortunately |
Thanks! This was the work around for now--open both GRIB messages separately: xr.open_dataset(FILE, engine='cfgrib',
backend_kwargs=dict(read_keys=['stepRange'],
filter_by_keys={'stepRange': '11-12'})) and xr.open_dataset(FILE, engine='cfgrib',
backend_kwargs=dict(read_keys=['stepRange'],
filter_by_keys={'stepRange': '0-12'})) would read both variables. Would be nice if cfgrib could read both in the same open line, like Iain said by extending the dimension. |
@blaylockbk upcoming version 0.9.9.0 will not require to add |
thank you for this! |
I have a GRIB2 file from the High-Resolution Rapid Refresh model that includes two accumulated precipitation fields. Here is the output of
wgrib2
:As you can see, this file has accumulated precipitation for two different hour ranges: 0-5 hours, and 4-5 hours.
When I read this file with cfgrib (
cfgrib.open_datasets
), it only shows one of the fields. I wonder if that is because the GRIB message for both is the same name, and so it overwrites the first with the second message when it reads. It appears that cfgrib doesn't recognize that the two different fields should be two different xarray variables.Is there any way to overcome this, or am I missing something? Thanks for any help.
The text was updated successfully, but these errors were encountered: