home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1094753761

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1094753761 I_kwDOAMm_X85BQJ3h 6143 [FEATURE]: allow "now" as input to cftime_range 17162724 open 0     2 2022-01-05T21:21:42Z 2022-01-07T23:23:02Z   CONTRIBUTOR      

Is your feature request related to a problem?

For better or worse, I use xr.cftime_range interchangably with pd.date_range, mostly it is saves my importing pandas.

Pandas allows a string named "now" to be parsed in pd.date_range pd.date_range("2000-01-01", "now", freq="H") It would be nice if xr.cftime_range could do the same (see additional context for Traceback).

Describe the solution you'd like

Something like assert pd.date_range("2000-01-01", "now", freq="H") == xr.cftime_range("2000-01-01", "now", freq="H")

Describe alternatives you've considered

Close as not within the scope of xr.cftime_range

Additional context

xr.cftime_range("2000-01-01", "now", freq="H")

```python-traceback ValueError Traceback (most recent call last) /tmp/ipykernel_15451/3415490845.py in <module> ----> 1 xr.cftime_range("2000-01-01", "now", freq="H")

/opt/userenvs/ray.bell/main/lib/python3.9/site-packages/xarray/coding/cftime_offsets.py in cftime_range(start, end, periods, freq, normalize, name, closed, calendar) 982 start = _maybe_normalize_date(start, normalize) 983 if end is not None: --> 984 end = to_cftime_datetime(end, calendar) 985 end = _maybe_normalize_date(end, normalize) 986

/opt/userenvs/ray.bell/main/lib/python3.9/site-packages/xarray/coding/cftime_offsets.py in to_cftime_datetime(date_str_or_date, calendar) 697 "a calendar type must be provided" 698 ) --> 699 date, _ = _parse_iso8601_with_reso(get_date_type(calendar), date_str_or_date) 700 return date 701 elif isinstance(date_str_or_date, cftime.datetime):

/opt/userenvs/ray.bell/main/lib/python3.9/site-packages/xarray/coding/cftimeindex.py in _parse_iso8601_with_reso(date_type, timestr) 125 126 default = date_type(1, 1, 1) --> 127 result = parse_iso8601_like(timestr) 128 replace = {} 129

/opt/userenvs/ray.bell/main/lib/python3.9/site-packages/xarray/coding/cftimeindex.py in parse_iso8601_like(datetime_string) 115 if match: 116 return match.groupdict() --> 117 raise ValueError( 118 f"no ISO-8601 or cftime-string-like match for string: {datetime_string}" 119 )

ValueError: no ISO-8601 or cftime-string-like match for string: now ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6143/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 0.632ms · About: xarray-datasette