Indicate calendar type in CFTimeIndex repr
See original GitHub issueCurrently CFTimeIndex uses the default repr it inherits from pandas.Index
. This just displays a potentially-truncated version of the values in the index, along with the index’s data type and length, e.g.:
CFTimeIndex([2000-01-01 00:00:00, 2000-01-02 00:00:00, 2000-01-03 00:00:00,
2000-01-04 00:00:00, 2000-01-05 00:00:00, 2000-01-06 00:00:00,
2000-01-07 00:00:00, 2000-01-08 00:00:00, 2000-01-09 00:00:00,
2000-01-10 00:00:00,
...
2000-12-22 00:00:00, 2000-12-23 00:00:00, 2000-12-24 00:00:00,
2000-12-25 00:00:00, 2000-12-26 00:00:00, 2000-12-27 00:00:00,
2000-12-28 00:00:00, 2000-12-29 00:00:00, 2000-12-30 00:00:00,
2000-12-31 00:00:00],
dtype='object', length=366)
It would be nice if the repr also included an indication of the calendar type of the index, since different indexes could have different calendar types. For example:
CFTimeIndex([2000-01-01 00:00:00, 2000-01-02 00:00:00, 2000-01-03 00:00:00,
2000-01-04 00:00:00, 2000-01-05 00:00:00, 2000-01-06 00:00:00,
2000-01-07 00:00:00, 2000-01-08 00:00:00, 2000-01-09 00:00:00,
2000-01-10 00:00:00,
...
2000-12-22 00:00:00, 2000-12-23 00:00:00, 2000-12-24 00:00:00,
2000-12-25 00:00:00, 2000-12-26 00:00:00, 2000-12-27 00:00:00,
2000-12-28 00:00:00, 2000-12-29 00:00:00, 2000-12-30 00:00:00,
2000-12-31 00:00:00],
dtype='object', length=366, calendar='proleptic_gregorian')
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Weather and climate data — xarray 0.15.1 documentation
DatetimeIndex for dates from non-standard calendars commonly used in ... be used to represent times (either in indexes, as a CFTimeIndex , or...
Read more >Ways to resample non-standard CFTimeIndex calendars (360 ...
While some models work with standard calendar, compatible with Pandas datetime , others, particularly MOHC HadGem2 ES, use 360-day CFTimeIndex .
Read more >weather-climate.rst.txt - Xarray
_CFTimeIndex: Non-standard calendars and dates outside the Timestamp-valid ... will be used to represent times (either in indexes, as a :py:class:`~xarray.
Read more >Weather and climate data — xarray 0.12.3 documentation
DatetimeIndex for dates from non-standard calendars commonly used in ... be used to represent times (either in indexes, as a CFTimeIndex , or...
Read more >Python Examples of xarray.CFTimeIndex - ProgramCreek.com
``value`` for ``CFTimeIndex.shift(value, str)``. freq (str): Pandas ... kind (str): Kind of object for error message. calendar (str): calendar to set time ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@aaronspring I think that would be great. Indeed now that we have
infer_freq
it should be fairly straightforward; feel free to open a PR.using this feature now alot. @spencerkclark what about implementing also
freq
into theCFTimeIndex
repr?Its hard to see the frequency by eye sometimes, I would just rely on
xr.infer_freq
and add to the repr str, also iffreq
isNone
/indistinguishable