issue_comments: 1234368670
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | performed_via_github_app | issue |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/pydata/xarray/issues/6968#issuecomment-1234368670 | https://api.github.com/repos/pydata/xarray/issues/6968 | 1234368670 | IC_kwDOAMm_X85Jkvie | 39069044 | 2022-09-01T14:34:05Z | 2022-09-01T14:34:05Z | CONTRIBUTOR | I don't think An easy enough workaround is to assign a separate non-datetime coordinate. This works: ```python ds = xr.tutorial.open_dataset('air_temperature') ds = ds.assign_coords({'day':(ds.time - ds.time[0]) / np.timedelta64(1, 'D')}).swap_dims({'time':'day'}) def periodic_season(x, a0, a1, a2, a3): # periodic function with both phase amplitude and shift parameters return a0 + a1 * np.cos(a2 * x - a3) dn = ds.curvefit( 'day', func=periodic_season, p0={'a0':275, 'a1':15, 'a2':2*np.pi/365} ) ``` |
{ "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1355733363 |