Comments (1)
@matt-long, with #133, I added a new optional argument, method
to allow users to control how they want the time values to be computed:
By default, midpoint values are computed:
dsm = esmlab.resample(ds, freq='mon')
dsm.time
<xarray.DataArray 'time' (time: 12)>
array([cftime.DatetimeNoLeap(2000, 1, 16, 12, 0, 0, 0, 6, 16),
cftime.DatetimeNoLeap(2000, 2, 15, 0, 0, 0, 0, 1, 46),
cftime.DatetimeNoLeap(2000, 3, 16, 12, 0, 0, 0, 2, 75),
cftime.DatetimeNoLeap(2000, 4, 16, 0, 0, 0, 0, 5, 106),
cftime.DatetimeNoLeap(2000, 5, 16, 12, 0, 0, 0, 0, 136),
cftime.DatetimeNoLeap(2000, 6, 16, 0, 0, 0, 0, 3, 167),
cftime.DatetimeNoLeap(2000, 7, 16, 12, 0, 0, 0, 5, 197),
cftime.DatetimeNoLeap(2000, 8, 16, 12, 0, 0, 0, 1, 228),
cftime.DatetimeNoLeap(2000, 9, 16, 0, 0, 0, 0, 4, 259),
cftime.DatetimeNoLeap(2000, 10, 16, 12, 0, 0, 0, 6, 289),
cftime.DatetimeNoLeap(2000, 11, 16, 0, 0, 0, 0, 2, 320),
cftime.DatetimeNoLeap(2000, 12, 16, 12, 0, 0, 0, 4, 350)], dtype=object)
Coordinates:
* time (time) object 2000-01-16 12:00:00 ... 2000-12-16 12:00:00
Attributes:
bounds: time_bnds
dsm = esmlab.resample(ds, freq='mon', method='left')
dsm.time
<xarray.DataArray 'time' (time: 12)>
array([cftime.DatetimeNoLeap(2000, 1, 1, 12, 0, 0, 0, 5, 1),
cftime.DatetimeNoLeap(2000, 2, 1, 12, 0, 0, 0, 1, 32),
cftime.DatetimeNoLeap(2000, 3, 1, 12, 0, 0, 0, 1, 60),
cftime.DatetimeNoLeap(2000, 4, 1, 12, 0, 0, 0, 4, 91),
cftime.DatetimeNoLeap(2000, 5, 1, 12, 0, 0, 0, 6, 121),
cftime.DatetimeNoLeap(2000, 6, 1, 12, 0, 0, 0, 2, 152),
cftime.DatetimeNoLeap(2000, 7, 1, 12, 0, 0, 0, 4, 182),
cftime.DatetimeNoLeap(2000, 8, 1, 12, 0, 0, 0, 0, 213),
cftime.DatetimeNoLeap(2000, 9, 1, 12, 0, 0, 0, 3, 244),
cftime.DatetimeNoLeap(2000, 10, 1, 12, 0, 0, 0, 5, 274),
cftime.DatetimeNoLeap(2000, 11, 1, 12, 0, 0, 0, 1, 305),
cftime.DatetimeNoLeap(2000, 12, 1, 12, 0, 0, 0, 3, 335)], dtype=object)
Coordinates:
* time (time) object 2000-01-01 12:00:00 ... 2000-12-01 12:00:00
Attributes:
bounds: time_bnds
dsm = esmlab.resample(ds, freq='mon', method='right')
dsm.time
<xarray.DataArray 'time' (time: 12)>
array([cftime.DatetimeNoLeap(2000, 1, 31, 12, 0, 0, 0, 0, 31),
cftime.DatetimeNoLeap(2000, 2, 28, 12, 0, 0, 0, 0, 59),
cftime.DatetimeNoLeap(2000, 3, 31, 12, 0, 0, 0, 3, 90),
cftime.DatetimeNoLeap(2000, 4, 30, 12, 0, 0, 0, 5, 120),
cftime.DatetimeNoLeap(2000, 5, 31, 12, 0, 0, 0, 1, 151),
cftime.DatetimeNoLeap(2000, 6, 30, 12, 0, 0, 0, 3, 181),
cftime.DatetimeNoLeap(2000, 7, 31, 12, 0, 0, 0, 6, 212),
cftime.DatetimeNoLeap(2000, 8, 31, 12, 0, 0, 0, 2, 243),
cftime.DatetimeNoLeap(2000, 9, 30, 12, 0, 0, 0, 4, 273),
cftime.DatetimeNoLeap(2000, 10, 31, 12, 0, 0, 0, 0, 304),
cftime.DatetimeNoLeap(2000, 11, 30, 12, 0, 0, 0, 2, 334),
cftime.DatetimeNoLeap(2000, 12, 31, 12, 0, 0, 0, 5, 365)], dtype=object)
Coordinates:
* time (time) object 2000-01-31 12:00:00 ... 2000-12-31 12:00:00
Attributes:
bounds: time_bnds
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.