weech / GRIB.jl

GRIB Interface for Julia
Apache License 2.0
22 stars 2 forks source link

Fix hour field for ERA5-Land hourly data #9

Closed agimenezromero closed 3 years ago

agimenezromero commented 3 years ago

Hi!

First of all, thank you very much for your work! This library is completely useful!

However, I've noticed a kind of bug when reading data from ERA5-Land given in hourly temporal resolution. The problem is that the hour field is not properly read, instead, every hour of each day count as the same "date" field, as the hour filed is always "0".

I hope it won't be a hard problem to solve!

Alex

weech commented 3 years ago

It took me a while to figure it out because those files are so weird. Turns out, they're in GRIB1; first time I've seen that format in the wild. In GRIB1 the info in the "hour", "day", etc. fields refers to the analysis time for the forecast, and the forecast hour is encoded in the "startStep", "endStep", and "stepRange" fields (which are all the same for ERA5-Land Hourly). Why the ERA5 project decided to distribute data in this format, I have no idea.

So to answer your question, you can use the "startStep" key to get the hour. One hitch is that 00Z is encoded as 24Z of the day before.

agimenezromero commented 3 years ago

Ahhh I see! Thank you very much! I've just tried it and it works, so I close the issue.

Thank you again!

Alex