Comments (5)
This is in general a solid solution.
In fact, it seems superfluous to have both _yr
and _date
variants of these kwargs. So I am inclined to replace the former with the latter, i.e. the kwargs would be nc_start_date
, nc_end_date
, and default_time_range
. If passed an integer, a datetime
object (of the netCDF4 variety; see below) is generated assuming January 1 of that year.
Re: which datetime object to use, it seems to me that netCDF4.netcdftime.datetime
is the way to go, given the year 0001, etc. considerations. Doesn't add any new dependencies and resolves that problem. Good find!
This would not be backwards compatible: you and I (confidently assuming we are still the only users) would have to change these in the objects we have already. But I think it's worth the trouble -- shouldn't worry about legacy code at this early, volatile stage of the project.
from aospy.
As of the most recent commit to the xray
branch (3ebb63f), this has been implemented, in that _yr
kwargs/attributes have been replaced with _date
variants, with datetime.datetime
objects being used primarily rather than integers corresponding to years. The TimeManager
class and timedate
module have been added to handle time- and date-related computations.
However, I have not yet tested it yet for non-vanilla times, i.e. years < 1678 or not spanning full months/years. So not quite ready to close the issue yet, not until we write some tests that demonstrate the new stuff actually works for all of our use cases.
from aospy.
Yes, I've just tested a case under the xray
branch with years < 1678; there are some bugs. Once I get things sorted out I'll create a pull-request.
from aospy.
@spencerkclark Does the code you implemented in the above pull request fix the bugs you came across? If yes, I'll close this issue.
from aospy.
Yes, the code I implemented fixes the issues I was having. I'll go ahead and close it.
from aospy.
Related Issues (20)
- Error when passing non-default date ranges to `calc_suite_specs` HOT 6
- BOUNDS_STR and TIME_BOUNDS_STR HOT 14
- Daily output data HOT 1
- Perform calculations on subset of levels HOT 2
- recalculate HOT 1
- Calculations on only one variable HOT 3
- Towards v0.3 release HOT 15
- Use `stable` and `master` as our two main branches, rather than `master` and `develop` HOT 1
- Add support for zarr HOT 5
- Improve logging when calcs submitted in parallel
- Potentially use intake for describing/finding data on disk (i.e. what DataLoaders do)
- Failing tests in CI, but for some builds still come back as green
- New failure in test_apply_time_offset HOT 5
- Need to fix warnings due to recent updates to dependencies
- Move CI over to Azure pipelines HOT 1
- Use "black" tool for enforcing style
- Infer surface area from lat + lon if none provided. HOT 1
- Should we move aospy repository to its own 'aospy' organization? HOT 2
- Python errors in docs builds HOT 1
- YAML-based specification of aospy objects HOT 4
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 aospy.