cfgrib icon indicating copy to clipboard operation
cfgrib copied to clipboard

Explicitly request value for 'endStep' as integer

Open Metamess opened this issue 1 year ago • 1 comments

Closes #370

This simple PR adds explicitly requesting an integer value from the ecCodes framework when reading the value for "endStep". This is done by leveraging the built-in support for this in the getitem of the Message class, which will attempt to partition a key formatted as key:key_type

Metamess avatar Feb 20 '24 10:02 Metamess

Sorry for the big delay in looking at this, @Metamess, I've just been crazy busy! Thank you for your contribution. I've set the ci going now.

iainrussell avatar Mar 14 '24 16:03 iainrussell

I've made some adjustments here because the suggested fix was not working by itself. Ultimately, cfgrib is always converting steps into hours (ideally it should be a shorter time increment, but that will come later). So I've ensured that we always ensure that the index knows that the units are hours rather than the encoded step units. That fixes the problem where we have a file (such as the sample file I added) where we have 0 and 60 minutes, which ecCodes returns as 0m and 1h respectively, and cfgrib does not recognise as a valid hypercube.

iainrussell avatar Apr 20 '24 17:04 iainrussell

Thanks @Metamess, this was an important fix to get into cfgrib

iainrussell avatar Apr 23 '24 09:04 iainrussell