home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 182168383

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
182168383 MDU6SXNzdWUxODIxNjgzODM= 1043 combine datasets and replace 12929592 closed 0     2 2016-10-11T04:02:29Z 2016-10-12T02:25:58Z 2016-10-12T02:25:58Z NONE      

I would like to replace the time in one dataset with the time in another dataset. I have tried .concat(), .merge() and .update() with various errors. Details of the errors for each of those steps and the datasets are posted below. Any feedback on how I might resolve this will be greatly appreciated.

``` ds = xray.open_mfdataset('/DATA/WRF///*T_SFC.nc')

time=ds['time'].to_index()

time_utc = time.tz_localize('UTC') au_tz = pytz.timezone('Australia/Sydney')

convert UTC to local time

time_local = time_utc.tz_convert(au_tz) time_local=time_local.tz_localize(None)

local_series=time_local.to_series() local_df=local_series.to_frame() local_df.columns=['localtime']

local_ds=xray.Dataset.from_dataframe(local_df)

newconcat_ds=xray.concat(ds, local_ds['localtime']) #TypeError: can only concatenate xray Dataset and DataArray objects

newmerge_ds=ds.merge(local_ds) #InvalidIndexError: Reindexing only valid with uniquely valued Index objects

newupdate_ds=ds.update(ds['time'],local_ds['time']) #TypeError: unhashable type: 'DataArray' ```

I would like to replace the time in this dataset:

``` In[333]:ds Out[333]: <xray.Dataset> Dimensions: (latitude: 106, longitude: 193, time: 17520) Coordinates: * latitude (latitude) float32 -39.2 -39.1495 -39.099 -39.0486 -38.9981 ... * longitude (longitude) float32 140.8 140.848 140.896 140.944 140.992 ... * time (time) datetime64[ns] 2009-01-01 2009-01-01T01:00:00 ...

Data variables:

T_SFC (time, latitude, longitude) float64 13.83 13.86 13.89 13.92 ... Attributes: creationTime: 1431922712 creationTimeString: Sun May 17 21:18:32 PDT 2015 Conventions: COARDS ```

I would like to use the time in this dataset to replace the time in the first dataset:

``` In[334]: local_ds Out[334]: <xray.Dataset> Dimensions: (time: 17520) Coordinates: * time (time) datetime64[ns] 2009-01-01T11:00:00 2009-01-01T12:00:00 ...

Data variables:

localtime (time) datetime64[ns] 2009-01-01T11:00:00 2009-01-01T12:00:00 ... ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1043/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

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