home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 748229907 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 2

  • spencerkclark 2
  • raybellwaves 2

author_association 2

  • CONTRIBUTOR 2
  • MEMBER 2

issue 1

  • Calling pd.to_datetime on cftime variable · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
731743767 https://github.com/pydata/xarray/issues/4598#issuecomment-731743767 https://api.github.com/repos/pydata/xarray/issues/4598 MDEyOklzc3VlQ29tbWVudDczMTc0Mzc2Nw== raybellwaves 17162724 2020-11-22T12:54:18Z 2020-11-22T12:54:18Z CONTRIBUTOR

Why not pandas.date_range

Good point. Given the "normal" spacing of the data that makes sense.

The problematic variable in this dataset is "tau"

Ah thanks for the digging into this for me.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Calling pd.to_datetime on cftime variable 748229907
731743161 https://github.com/pydata/xarray/issues/4598#issuecomment-731743161 https://api.github.com/repos/pydata/xarray/issues/4598 MDEyOklzc3VlQ29tbWVudDczMTc0MzE2MQ== spencerkclark 6628425 2020-11-22T12:49:53Z 2020-11-22T12:49:53Z MEMBER

I see, yeah, timezones with cftime are tricky. Why are you using cftime_range to populate the time variable though in this case? Why not pandas.date_range?

The problematic variable in this dataset is "tau". If we drop that variable the dates are automatically decoded to pandas-compatible times (perhaps that's not an option for you though): ``` In [1]: import xarray as xr

In [2]: xr.open_dataset('https://tds.hycom.org/thredds/dodsC/GLBy0.08/latest', drop_variables=["tau"]) Out[2]: <xarray.Dataset> Dimensions: (depth: 40, lat: 4251, lon: 4500, time: 101) Coordinates: * lat (lat) float64 -80.0 -79.96 -79.92 ... 89.92 89.96 90.0 * lon (lon) float64 0.0 0.07996 0.16 0.24 ... 359.8 359.8 359.9 * depth (depth) float64 0.0 2.0 4.0 6.0 ... 3e+03 4e+03 5e+03 * time (time) datetime64[ns] 2020-11-16T12:00:00 ... 2020-11-29 time_run (time) datetime64[ns] ... Data variables: time_offset (time) datetime64[ns] ... surf_el (time, lat, lon) float32 ... water_u (time, depth, lat, lon) float32 ... water_u_bottom (time, lat, lon) float32 ... water_v (time, depth, lat, lon) float32 ... water_v_bottom (time, lat, lon) float32 ... water_temp (time, depth, lat, lon) float32 ... water_temp_bottom (time, lat, lon) float32 ... salinity (time, depth, lat, lon) float32 ... salinity_bottom (time, lat, lon) float32 ... Attributes: classification_level: UNCLASSIFIED distribution_statement: Approved for public release. Distribution unli... downgrade_date: not applicable classification_authority: not applicable institution: Fleet Numerical Meteorology and Oceanography C... source: HYCOM archive file history: archv2ncdf2d ;\nFMRC Best Dataset comment: p-grid field_type: instantaneous Conventions: CF-1.4, NAVO_netcdf_v1.1 _CoordSysBuilder: ucar.nc2.dataset.conv.CF1Convention cdm_data_type: GRID featureType: GRID location: Proto fmrc:GLBy0.08_930_FMRC ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Calling pd.to_datetime on cftime variable 748229907
731741542 https://github.com/pydata/xarray/issues/4598#issuecomment-731741542 https://api.github.com/repos/pydata/xarray/issues/4598 MDEyOklzc3VlQ29tbWVudDczMTc0MTU0Mg== raybellwaves 17162724 2020-11-22T12:37:15Z 2020-11-22T12:37:15Z CONTRIBUTOR

Which functionality are you looking for in xarray that pandas Timestamp objects provide, but cftime objects do not?

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.tz_localize.html

For a bit more reference. I'm working with HyCOM data and want to keep track of 'local time'.

ds = xr.open_dataset('https://tds.hycom.org/thredds/dodsC/GLBy0.08/latest', decode_times=False) reference_date = ds.time.attrs['units'][12:25] ds['time'] = xr.cftime_range(start=reference_date, periods=len(ds.time), freq='3H')

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Calling pd.to_datetime on cftime variable 748229907
731740688 https://github.com/pydata/xarray/issues/4598#issuecomment-731740688 https://api.github.com/repos/pydata/xarray/issues/4598 MDEyOklzc3VlQ29tbWVudDczMTc0MDY4OA== spencerkclark 6628425 2020-11-22T12:30:37Z 2020-11-22T12:30:37Z MEMBER

We do not have anything in xarray that works for cftime scalars currently, but we do have a to_datetimeindex method on CFTimeIndex: ``` In [1]: import xarray as xr

In [2]: times = xr.cftime_range("2000", periods=2)

In [3]: times.to_datetimeindex() Out[3]: DatetimeIndex(['2000-01-01', '2000-01-02'], dtype='datetime64[ns]', freq=None) `` Which functionality are you looking for in xarray that pandasTimestampobjects provide, butcftime` objects do not?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Calling pd.to_datetime on cftime variable 748229907

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 15.338ms · About: xarray-datasette