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

NCEP navgem file missing records #310

Closed
joleenf opened this issue Aug 31, 2022 · 2 comments
Closed

NCEP navgem file missing records #310

joleenf opened this issue Aug 31, 2022 · 2 comments

Comments

@joleenf
Copy link

joleenf commented Aug 31, 2022

Hi,

I am trying to read data from a navgem grib2 file hosted by ncep:
https://nomads.ncep.noaa.gov/pub/data/nccf/com/fnmoc/prod/
Specifically,
https://nomads.ncep.noaa.gov/pub/data/nccf/com/fnmoc/prod/navgem.20220826/navgem_2022083000f006.grib2

When the following lines are run:

import xarray as xr
isobaric_data = xr.open_dataset('navgem_2022083012f003.grib2', engine="cfgrib",
                                backend_kwargs={'filter_by_keys': {'typeOfLevel': 'isobaricInhPa'}})

Some of the expected data is loaded:
isobaric_data.data_vars returns:

Data variables:
t (isobaricInhPa, latitude, longitude) float32 ...
gh (isobaricInhPa, latitude, longitude) float32 ...
u (isobaricInhPa, latitude, longitude) float32 ...
v (isobaricInhPa, latitude, longitude) float32 ...

But, the file contains data such as relative humidity on isobaric levels as well (output from wgrib2):

34:6002652:d=2022083012:RH:300 mb:3 hour fcst:
38:6867216:d=2022083012:RH:350 mb:3 hour fcst:
41:7428414:d=2022083012:RH:400 mb:3 hour fcst:
45:8301392:d=2022083012:RH:450 mb:3 hour fcst:
49:8975749:d=2022083012:RH:500 mb:3 hour fcst:
53:9842749:d=2022083012:RH:550 mb:3 hour fcst:
54:10104756:d=2022083012:RH:600 mb:3 hour fcst:
55:10368921:d=2022083012:RH:650 mb:3 hour fcst:
58:10850969:d=2022083012:RH:700 mb:3 hour fcst:
62:11876468:d=2022083012:RH:750 mb:3 hour fcst:
63:12210334:d=2022083012:RH:800 mb:3 hour fcst:
66:12785128:d=2022083012:RH:850 mb:3 hour fcst:
70:13733245:d=2022083012:RH:900 mb:3 hour fcst:
76:15051420:d=2022083012:RH:950 mb:3 hour fcst:
79:15657530:d=2022083012:RH:1000 mb:3 hour fcst:

Though this data is not on the same isobaric levels as data such as the t, u, v, gh which cfgrib does load (only VGRD shown here):

11:2136311:d=2022083012:VGRD:70 mb:3 hour fcst:
15:2710454:d=2022083012:VGRD:100 mb:3 hour fcst:
20:3598444:d=2022083012:VGRD:150 mb:3 hour fcst:
25:4423347:d=2022083012:VGRD:200 mb:3 hour fcst:
30:5285880:d=2022083012:VGRD:250 mb:3 hour fcst:
36:6429146:d=2022083012:VGRD:300 mb:3 hour fcst:
43:7854079:d=2022083012:VGRD:400 mb:3 hour fcst:
51:9395574:d=2022083012:VGRD:500 mb:3 hour fcst:
60:11342525:d=2022083012:VGRD:700 mb:3 hour fcst:
68:13290902:d=2022083012:VGRD:850 mb:3 hour fcst:
74:14554430:d=2022083012:VGRD:925 mb:3 hour fcst:
81:16344765:d=2022083012:VGRD:1000 mb:3 hour fcst:

Is there any way to access the RH data using cfgrib?
Thanks - Joleen

@iainrussell
Copy link
Member

Hi @joleenf,

Indeed, the problem is that r is not on the same levels as the other parameters, and so they do not form a consistent hypercube. However, you can still load 'r' by itself into a separate dataset:

rh = xr.open_dataset('navgem_2022083012f003.grib2', engine="cfgrib",
                                backend_kwargs={'filter_by_keys': {'shortName': 'r'}})

and then you can see if there's anything you can do in xarray to merge that into your other dataset.

Best regards,
Iain

@joleenf
Copy link
Author

joleenf commented Sep 1, 2022

Excellent! Thanks.

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

No branches or pull requests

2 participants