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

Unexpected behavior when opening Canadian global GEM 25km grib files using pynio #40

Open
ShaneMill1 opened this issue May 6, 2020 · 0 comments

Comments

@ShaneMill1
Copy link

ShaneMill1 commented May 6, 2020

Hi all,

I am experiencing interesting behavior when opening a GEM global 25km resolution grib files using pynio.

ds=xr.open_dataset('CMC_glb_TMP_ISBL_700_latlon.24x.24_2020050600_P198.grb',engine='pynio')
print(ds)
<xarray.Dataset>
Dimensions: (lat_0: 751, lon_0: 1500)
Coordinates:

lat_0 (lat_0) float32 -90.0 -89.76 -89.52 ... 89.52 89.76 90.0
lon_0 (lon_0) float32 180.0 180.24 180.48 ... 539.52 539.76
Data variables:
TMP_P0_L100_GLL0 (lat_0, lon_0) float32 ...
print(ds['lon_0'])
<xarray.DataArray 'lon_0' (lon_0: 1500)>
array([180. , 180.24, 180.48, ..., 539.28, 539.52, 539.76], dtype=float32)
Coordinates:
lon_0 (lon_0) float32 180.0 180.24 180.48 180.72 ... 539.28 539.52 539.76
Attributes:
long_name: longitude
grid_type: Latitude/Longitude
units: degrees_east
Dj: [0.24]
Di: [0.24000001]
Lo2: [179.76]
La2: [90.]
Lo1: [180.]
La1: [-90.]

Notice that the range for lon_0 is 180->539.76. When I open using cfgrib as the xarray engine:

ds=xr.open_dataset('CMC_glb_TMP_ISBL_700_latlon.24x.24_2020050600_P198.grb',engine='cfgrib')
print(ds['longitude'])
<xarray.DataArray 'longitude' (longitude: 1500)>
array([-180. , -179.76, -179.52, ..., 179.28, 179.52, 179.76])
Coordinates:
time datetime64[ns] ...
step timedelta64[ns] ...
isobaricInhPa int64 ...

longitude (longitude) float64 -180.0 -179.8 -179.5 ... 179.5 179.8
valid_time datetime64[ns] ...
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude

Therefore, it appears 'cgfrib' shows the longitude correctly while 'pynio' does not.

This was originally posted as an xarray issue:
pydata/xarray#4040

However, after investigating further, I found that this occurs when using pynio directly also:
ds=Nio.open_file('CMC_glb_TMP_ISBL_700_latlon.24x.24_2020050600_P198.grb') ds.variables['lon_0'].get_value()

gives a result of:
array([180. , 180.24, 180.48, ..., 539.28, 539.52, 539.76], dtype=float32)

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

1 participant