-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Description
I followed the example in the README for writing a GRIB file from a simple Dataset
import xarray as xr
import cfgrib
ds2 = xr.Dataset({'skin_temperature': (('latitude', 'longitude'), np.zeros((5, 6)) + 300.)})
ds2.coords['latitude'] = np.linspace(90., -90., 5)
ds2.coords['longitude'] = np.linspace(0., 360., 6, endpoint=False)
ds2.skin_temperature.attrs['GRIB_shortName'] = 'skt'
cfgrib.to_grib(ds2, 'out.grib2', grib_keys={'edition': 2})That was successful.
Now, I would like to specify the datetime to the grib2 file, but when I add the coordinate time, valid_time, or step I get an error.
import xarray as xr
import cfgrib
import pandas as pd
ds2 = xr.Dataset({'skin_temperature': (('latitude', 'longitude'), np.zeros((5, 6)) + 300.)})
ds2.coords['latitude'] = np.linspace(90., -90., 5)
ds2.coords['longitude'] = np.linspace(0., 360., 6, endpoint=False)
ds2.coords['time'] = pd.to_datetime('2017-10-01') ### <----- Added this line
ds2.skin_temperature.attrs['GRIB_shortName'] = 'skt'
cfgrib.to_grib(ds2, 'out.grib2', grib_keys={'edition': 2})KeyError: 1506816000000000000
I realize this is an Alpha capability, but can you please provide any additional information on passing time data when creating a simple grib file. Thanks!
Note: I have
cfgrib 0.9.8.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels