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

endStep stepUnits in subhourly wrf grib2 output #364

Merged
merged 5 commits into from
Oct 10, 2023

Conversation

emfdavid
Copy link
Contributor

@emfdavid emfdavid commented Sep 27, 2023

Enable reading grib2 files with subhourly data from the WRF model such as gs://high-resolution-rapid-refresh/hrrr.20230928/conus/hrrr.t00z.wrfsubhf01.grib2

The error: WrongStepUnitError(Wrong units for step (step must be integer))
Is now caught and logged. The bad coordinate attribute is dropped.

2023-10-04T17:40:23.741Z MainProcess MainThread WARNING:grib2-to-zarr:Ignoring coordinate 'step' for varname 'dswrf', raises: eccodes.WrongStepUnitError(Wrong units for step (step must be integer))

@martindurant
Copy link
Member

(ref #363 )

@emfdavid
Copy link
Contributor Author

emfdavid commented Oct 2, 2023

(ref #363 )

@dcherian Do you have any suggestions on how to resolve this based on your work last week (very excited by the way!)?
My read is that the HRRR grib2 attributes/coords are actually an invalid type according to eccodes... but I am not sure.
My solution was to just catch and log the exception and move on, but would love to solve the actual problem if possible?

@dcherian
Copy link
Contributor

dcherian commented Oct 2, 2023

Have you asked over at ecCodes? I think this needs to be solved there.

Can you link to a file that exhibits this problem?

@emfdavid
Copy link
Contributor Author

emfdavid commented Oct 2, 2023

Can you link to a file that exhibits this problem?

gs://high-resolution-rapid-refresh/hrrr.20230928/conus/hrrr.t00z.wrfsubhf01.grib2

@emfdavid
Copy link
Contributor Author

emfdavid commented Oct 2, 2023

Have you asked over at ecCodes? I think this needs to be solved there.

@martindurant will you merge a PR that catches and logs exception till we can get this sorted?

@emfdavid
Copy link
Contributor Author

emfdavid commented Oct 2, 2023

I will try upgrading to the latest eccodes and then file a bug if this is still an issue...

@martindurant
Copy link
Member

will you merge a PR that catches and logs exception till we can get this sorted?

Certainly. The HDF module already does this.

@dcherian
Copy link
Contributor

dcherian commented Oct 2, 2023

xref ecmwf/cfgrib#335

@emfdavid
Copy link
Contributor Author

emfdavid commented Oct 2, 2023

xref ecmwf/cfgrib#335

Thank you for finding those - I don't see anything here that is likely to get fixed quickly here in eccodes - do you?

@emfdavid emfdavid changed the title wip endStep stepUnits in subhourly wrf grib2 output Oct 4, 2023
@emfdavid
Copy link
Contributor Author

emfdavid commented Oct 4, 2023

No easily accessible channel to follow in eccodes as to when this will be resolved.
One day we will upgrade eccodes and just stop getting the warnings...

@emfdavid emfdavid marked this pull request as ready for review October 4, 2023 18:42
@emfdavid
Copy link
Contributor Author

emfdavid commented Oct 4, 2023

Is there a good way to copy out a few messages from a larger grib2 file to make a test file?

@martindurant
Copy link
Member

Absolutely, this is what kerchunk.grib._split_file does, e.g., as used in scan_grib:

    with fsspec.open(url, "rb", **storage_options) as f:
        for offset, size, data in _split_file(f, skip=skip):

@emfdavid
Copy link
Contributor Author

emfdavid commented Oct 5, 2023

Should be ready to go now?

@martindurant
Copy link
Member

Something changed in numcodecs entrypoints?

@emfdavid
Copy link
Contributor Author

emfdavid commented Oct 9, 2023

I am so confused - that can't be related to my changes right?

@martindurant
Copy link
Member

Perhaps pin to numcodecs<=0.11, and we'll figure it out in a separate PR

@martindurant
Copy link
Member

OK, done!
We'll come back to the numcodecs thing...

@martindurant martindurant merged commit 9b4c5f4 into fsspec:main Oct 10, 2023
@emfdavid emfdavid deleted the endstep branch October 10, 2023 14:23
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