-
Notifications
You must be signed in to change notification settings - Fork 8
indexes related error from xarray v0.14.0 when calling esmlab.resample(ds, freq='ann') #155
Comments
@andersy005 and I were working through NCAR/intake-esm-datastore#37 this afternoon and eventually ended up at the same error. With #156 I no longer got the error in my notebook, so I think it's pretty promising for this issue as well. |
Applying #156 does enable
There is a new dimension,
|
I'm also unable to select a slice along the
|
The updated #156 enables me to select a slice along the I'm also able to write the result to a netCDF file, if I run the following prior to calling
It looks like Thanks for the quick work on this @andersy005 |
I just fixed the encoding propagation issue as well: In [1]: import xarray as xr
In [2]: ds = xr.open_dataset('/glade/work/klindsay/analysis/CESM2_coup_carb_cycle_JAMES/tseries/FG_CO2_ocn_piControl_00.nc')
In [3]: ds_ann = esmlab.resample(ds, freq='ann')
In [4]: import esmlab
In [5]: ds_ann = esmlab.resample(ds, freq='ann')
In [6]: ds_ann
Out[6]:
<xarray.Dataset>
Dimensions: (d2: 2, region: 4, time: 1200)
Coordinates:
* region (region) object 'Global' 'SH_mid_lat' 'low_lat' 'NH_mid_lat'
* time (time) object 0001-07-01 17:05:00 ... 1200-07-01 17:00:00
Dimensions without coordinates: d2
Data variables:
FG_CO2 (time, region) float64 -0.165 0.1448 -0.9223 ... -0.9603 0.612
time_bound (d2, time) object 0001-01-01 01:59:59.999999 ... 1201-01-01 00:00:00
Attributes:
history: \n2019-10-25 14:20:33.431614 esmlab.resample(<DATASET>, freq="a...
In [7]: ds_ann.time.encoding
Out[7]:
{'dtype': dtype('float64'),
'_FillValue': 9.969209968386869e+36,
'units': 'days since 0000-01-01',
'calendar': 'noleap'}
In [8]: ds_ann.time_bound.encoding
Out[8]:
{'dtype': dtype('float64'),
'_FillValue': 9.969209968386869e+36,
'units': 'days since 0000-01-01',
'calendar': 'noleap'}
In [9]: ds_ann.sel(time=slice('0801-01-01', '1001-01-01'))
Out[9]:
<xarray.Dataset>
Dimensions: (d2: 2, region: 4, time: 200)
Coordinates:
* region (region) object 'Global' 'SH_mid_lat' 'low_lat' 'NH_mid_lat'
* time (time) object 0801-07-01 17:00:00 ... 1000-07-01 17:00:00
Dimensions without coordinates: d2
Data variables:
FG_CO2 (time, region) float64 0.1078 0.3866 -0.9026 ... -0.9721 0.6262
time_bound (d2, time) object 0801-01-01 00:00:00 ... 1001-01-01 00:00:00
Attributes:
history: \n2019-10-25 14:20:33.431614 esmlab.resample(<DATASET>, freq="a...
In [10]: ds_ann.to_netcdf("/glade/u/home/abanihi/scratch/foo.nc") |
Thanks! |
I was running into the same issue (losing the encoding on the time dimension), and using @andersy005's latest master commit is working great for me. Thanks for pointing it out @klindsay28, I was like "oh, that's weird I need to specify a time index instead of a year" but didn't connect the dots on what must've gone wrong to make that the case. Anyway, I'm back to having years on the x-axis of my plots... I think my notebook is down to just intake-esm issues at this point. |
When I the commands
I get an error with the following traceback
Output of
esmlab.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 21:52:21)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-693.21.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
esmlab: 2019.4.27.post40
xarray: 0.14.0
pandas: 0.25.2
numpy: 1.17.2
scipy: 1.3.1
xesmf: 0.2.1
cftime: 1.0.3.4
dask: 2.6.0
distributed: 2.6.0
setuptools: 41.4.0
pip: 19.3.1
conda: None
pytest: None
IPython: 7.8.0
sphinx: None
The text was updated successfully, but these errors were encountered: