-
Notifications
You must be signed in to change notification settings - Fork 301
g1_level1 handle surface level type #452
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -553,10 +553,15 @@ CellMethod("_ratio", cm.coord("time")) | |
|
|
||
| IF | ||
| grib.edition == 1 | ||
| grib.levelType == 'pl' | ||
| grib.indicatorOfTypeOfLevel == 100 | ||
| THEN | ||
| CoordAndDims(DimCoord(points=grib.level, long_name="pressure", units="hPa")) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
|
|
||
| IF | ||
| grib.edition == 1 | ||
| grib.indicatorOfTypeOfLevel = 1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the typo @bblay is talking about. I'm not sure whether this works or not (it used to), but I agree we should use the equality operator here. |
||
| THEN | ||
| CoordAndDims(DimCoord(points=0, long_name="height", units="m")) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While you're at it, would you mind removing one of the two spaces?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is is worth setting the standard_name to 'height', rather than the long name, given it is a valid one? Is it also worth adding an |
||
|
|
||
|
|
||
| ################### | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my subsequent work on a similar issue, I've found that this code has another misunderstanding ...
It seems that the gribapi defaults have changed so that default access to this parameter (as in "message.attribute") now returns a string instead of a number as previously. So instead of numbers 1 and 100, we now get 'sfc' and 'pl' (i.e. "surface" and "pressure level").
Also note, the alternative parameters levelType and indicatorOfTypeOfLevel aren't different (as you might expect), but behave exactly the same (and they both now return strings in this way).
So, I believe this whole section should now read :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Changing data types (and contents) of "computed keys", such as
levelType, has been problem for many years. However, I didn't expect "coded keys", such asindicatorOfTypeOfLevel, to suffer from this as they should reflect the grib spec, which states the data type. Because we've been using a computed key here for some time I can't be sure if this is a recent change or if it has always been decoded as a string (https://software.ecmwf.int/issues/browse/SUP-484).I suggest we remove this vulnerability. We can force
GribWrapperto give us the coded integer value for this key inGribWrapper.__getattr__, as we currently do fortypeOfFirstFixedSurface.