climpred
climpred copied to clipboard
allow `datetime` after `__init__`
Description
- resolves logging error when working with
datetime
internally after:
# convert to datetime
hindcast._datasets['initialized'] = hindcast._datasets['initialized'].convert_calendar('standard',dim='init')
hindcast._datasets['initialized']['valid_time'] = xr.concat([hindcast._datasets['initialized'].sel(lead=l).swap_dims({'init':'valid_time'}).convert_calendar('standard',dim='valid_time').swap_dims({'valid_time':'init'}).valid_time for l in hindcast._datasets['initialized'].lead],'lead')
hindcast._datasets['observations'] = hindcast._datasets['observations'].convert_calendar('standard',dim='time’)
# now as hindcast._convert_calendar("standard")
- add
hindcast._convert_calendar("standard")
not a very clean solution - but works for now: a more clean solution would be to allowDatetimeIndex
for shift and not converting toCFTimeIndex
at__init__
Closes #(issue) @josephhardinee
To-Do List
Type of change
- [x] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
- [x] Tests added for
pytest
, if necessary.
Checklist (while developing)
- [ ] I have added docstrings to all new functions.
- [ ] I have commented my code, particularly in hard-to-understand areas.
- [ ] I have updated the sphinx documentation, if necessary.
- [ ] Any new functions are added to the API. (See contribution guide)
- [ ] CHANGELOG is updated with reference to this PR.
References
Codecov Report
Merging #742 (bafbe09) into try_logging_only (b2eb8a4) will increase coverage by
0.04%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## try_logging_only #742 +/- ##
====================================================
+ Coverage 92.74% 92.79% +0.04%
====================================================
Files 59 59
Lines 6186 6201 +15
====================================================
+ Hits 5737 5754 +17
+ Misses 449 447 -2
Impacted Files | Coverage Δ | |
---|---|---|
climpred/classes.py | 93.47% <100.00%> (+0.07%) |
:arrow_up: |
climpred/logging.py | 93.75% <100.00%> (+15.17%) |
:arrow_up: |
climpred/tests/test_logging.py | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update b2eb8a4...bafbe09. Read the comment docs.