question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GFS: Missing levels for sigmaLayer and depthBelowLandLayer

See original GitHub issue

cfgrib seems to miss some levels for the level types sigmaLayer and depthBelowLandLayer.

I’m working with this grib file: https://noaa-gfs-bdp-pds.s3.amazonaws.com/gfs.20210115/00/gfs.t00z.pgrb2.0p25.f003

wgrib2 -lev ~/Downloads/gfs.t00z.pgrb2.0p25.f003 shows four levels for each of these level types:

425:224793214:0-0.1 m below ground
427:225650288:0.1-0.4 m below ground
429:226508191:0.4-1 m below ground
431:227363072:1-2 m below ground

558:309354159:0.33-1 sigma layer
559:310143600:0.44-1 sigma layer
560:310922234:0.72-0.94 sigma layer
561:311736866:0.44-0.72 sigma layer

Reading the same file with cfgrib results in only two:

import cfgrib

ds = cfgrib.open_datasets("gfs.t00z.pgrb2.0p25.f003")

d = next(d for d in ds if 'depthBelowLandLayer' in d.variables)
d.depthBelowLandLayer
# <xarray.IndexVariable 'depthBelowLandLayer' (depthBelowLandLayer: 2)>
# array([0, 1])
# Attributes:
#     long_name:      soil depth
#     units:          m
#     positive:       down
#     standard_name:  depth

d = next(d for d in ds if 'sigmaLayer' in d.variables)
d.sigmaLayer
# <xarray.IndexVariable 'sigmaLayer' (sigmaLayer: 2)>
# array([0, 1])
# Attributes:
#     long_name:  original GRIB coordinate for key: level(sigmaLayer)
#     units:      1

d.r.shape
# (2, 721, 1440)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
alexamicicommented, Jan 24, 2021

@shahramn then this looks like an actual bug (or missing feature) in cfgrib as it only requests the level key and it accepts the default data type, that is int.

Thanks for the clarification.

1reaction
alexamicicommented, Apr 8, 2021

Levels will be read as floats in the next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found