home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1071049280

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
1071049280 I_kwDOAMm_X84_1upA 6045 `xr.infer_freq` month bug for `freq='6MS'` starting Jan becomes `freq='2QS-OCT'` 12237157 closed 0     3 2021-12-03T23:36:56Z 2022-06-24T22:58:47Z 2022-06-24T22:58:47Z CONTRIBUTOR      

What happened:

@dougiesquire brought up https://github.com/pangeo-data/climpred/issues/698. During debugging I discovered unexpected behaviour in xr.infer_freq: freq='6MS' starting Jan becomes freq='2QS-OCT'

What you expected to happen: freq='6MS' starting Jan becomes freq='2QS-Jan'

Minimal Complete Verifiable Example:

Creating an 6MS index starting in Jan with pandas and xarray yields different freq. 2QS and 6MS are equivalent for quarter starting months but the month offset in CFTimeIndex.freq is wrong.

```python import pandas as pd i_pd = pd.date_range(start="2000-01-01", end="2002-01-01", freq="6MS") i_pd DatetimeIndex(['2000-01-01', '2000-07-01', '2001-01-01', '2001-07-01', '2002-01-01'], dtype='datetime64[ns]', freq='6MS')

pd.infer_freq(i_pd) '2QS-OCT'

import xarray as xr xr.cftime_range(start="2000-01-01", end="2002-01-01", freq="6MS")

CFTimeIndex([2000-01-01 00:00:00, 2000-07-01 00:00:00, 2001-01-01 00:00:00, 2001-07-01 00:00:00, 2002-01-01 00:00:00], dtype='object', length=5, calendar='gregorian', freq='2QS-OCT') ```

Anything else we need to know?:

outline how to solve: https://github.com/pangeo-data/climpred/issues/698#issuecomment-985899966

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

Links from other tables

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