Comments (11)
@alperaltuntas, which esmlab version are you using? For the time being, I recommend installing esmlab from source (master branch). There are some changes that are not available in the latest release.
from esmlab.
Here is my esmlab version: esmlab==2019.1.0+27.g2b992eb
from esmlab.
The latest stable is version 2019.2.0
(https://pypi.org/project/esmlab/). You probably need to upgrade to this version: pip install esmlab --upgrade
from esmlab.
For latest features, bug fixes, I highly recommend installing from source for now. The next stable release is scheduled for next week.
from esmlab.
I just switched to master, and it looks like it is still not working:
traceback:
Traceback (most recent call last):
File "/glade/work/altuntas/scripts/mncPy/mavg2.py", line 41, in <module>
main()
File "/glade/work/altuntas/scripts/mncPy/mavg2.py", line 37, in main
compute_mon_climatology(dset)
File "/gpfs/fs1/work/altuntas/ncar_pylib_20190118/lib/python3.6/site-packages/esmlab/climatology.py", line 75, in compute_mon_climatology
computed_dset[tb_name] - computed_dset[tb_name][0, 0]
File "/gpfs/fs1/work/altuntas/ncar_pylib_20190118/lib/python3.6/site-packages/xarray/core/dataset.py", line 970, in __getitem__
return self._construct_dataarray(key)
File "/gpfs/fs1/work/altuntas/ncar_pylib_20190118/lib/python3.6/site-packages/xarray/core/dataset.py", line 899, in _construct_dataarray
self._variables, name, self._level_coords, self.dims)
File "/gpfs/fs1/work/altuntas/ncar_pylib_20190118/lib/python3.6/site-packages/xarray/core/dataset.py", line 74, in _get_virtual_variable
ref_var = variables[ref_name]
KeyError: 'time_bound'
interactive debugging
(Pdb) 'time_bound' in dset
True
(Pdb) 'time_bound' in dset.drop(static_variables)
True
(Pdb) 'time_bound' in dset.drop(static_variables).groupby(time_dot_month).mean(time_coord_name)
False
from esmlab.
Okie dokie.. let me look into it. I will get back to you
from esmlab.
@alperaltuntas, I can confirm that this is a bug.
Ccing @matt-long
from esmlab.
Would you be interested in submitting a PR to fix it? @alperaltuntas
from esmlab.
Would you be interested in submitting a PR to fix it? @alperaltuntas
Sure, I'll work on this.
from esmlab.
@alperaltuntas, @andersy005: I was not able to reproduce this error.
Here's what I did.
from glob import glob
import xarray as xr
import esmlab
files = sorted(glob('/glade/scratch/altuntas/archive/g.e20.GIAF.T62_g37.test_d2m.001/ocn/hist/g.e20.GIAF.T62_g37.test_d2m.001.pop.h.0001-*.nc'))
ds = xr.open_mfdataset(files, decode_times=False, decode_coords=False)
ds_monclim = esmlab.climatology.compute_mon_climatology(ds)
Works fine.
version = 'v2019.1.0+42.g4c2339c'
So that's a bit of mystery. @alperaltuntas, you have confirmed that you are still getting the error?
I think it's important to note, however, independent of this error, that the function is not doing the right thing for these data. Since you are averaging 5-day data to monthly bounds, we should really consider the portion of the time_bound
window that overlaps with each month and compute a weighted mean of the values, apportioning the weights for data points overlapping 2 months appropriately. This is a limitation of the current framework and might be characterized as a bug.
from esmlab.
Thanks, @matt-long. Apparently, adding decode_times=False
argument in open_mfdataset call fixes the issue with time_bound
.
from esmlab.
Related Issues (20)
- Climatology is broken HOT 1
- more general resample utility HOT 1
- Remove the old benchmarks notebooks
- Least squares polynomial fit with Dask HOT 4
- Potential GroupBy() bottleneck
- Failing tests in tests/test_core.py
- Esmlab Design Document HOT 8
- sel_time with optional methods HOT 1
- cannot compute annual mean with xarray 0.14.0 HOT 4
- add upstream master test env HOT 2
- Fix Tests
- indexes related error from xarray v0.14.0 when calling esmlab.resample(ds, freq='ann') HOT 7
- Move general functionality upstream HOT 9
- esmlab operations clobber existing ds.attrs['history'] values
- esmlab.climatology does not propagate all coordinate variables
- xarray error after moving from 3897727 to f3a548d HOT 5
- esmlab.anomaly generating error, unrealistically large time values HOT 5
- esmlab.resample reverses order of dimensions in time bounds variable
- Move weighted reductions to xarray
- esmlab.resample() error with xarray 0.15.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esmlab.