home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 571668871

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/3666#issuecomment-571668871 https://api.github.com/repos/pydata/xarray/issues/3666 571668871 MDEyOklzc3VlQ29tbWVudDU3MTY2ODg3MQ== 22454970 2020-01-07T16:41:07Z 2020-01-07T16:41:07Z NONE

This is more or less what I was doing but I think the problem may be that I am trying to overwrite the cfdatetime with the pd.datetime in a loop see code below:

```import wget import glob import xarray as xr import pandas as pd

def install(package):

subprocess.check_call([sys.executable, "-m", "pip", "install", package])

try:

from xclim import ensembles

except:

install('xclim')

from xclim import ensembles

outdir = '/home/travis/Downloads' url = [] url.append('https://github.com/Ouranosinc/xclim/raw/master/tests/testdata/EnsembleStats/BCCAQv2+ANUSPLIN300_ACCESS1-0_historical+rcp45_r1i1p1_1950-2100_tg_mean_YS.nc') url.append('https://github.com/Ouranosinc/xclim/raw/master/tests/testdata/EnsembleStats/BCCAQv2+ANUSPLIN300_BNU-ESM_historical+rcp45_r1i1p1_1950-2100_tg_mean_YS.nc') url.append('https://github.com/Ouranosinc/xclim/raw/master/tests/testdata/EnsembleStats/BCCAQv2+ANUSPLIN300_CCSM4_historical+rcp45_r1i1p1_1950-2100_tg_mean_YS.nc') url.append('https://github.com/Ouranosinc/xclim/raw/master/tests/testdata/EnsembleStats/BCCAQv2+ANUSPLIN300_CCSM4_historical+rcp45_r2i1p1_1950-2100_tg_mean_YS.nc') for u in url: wget.download(u,out=outdir) datasets = glob.glob(f'{outdir}/1950.nc')

dslist =[] for d in datasets: ds = xr.open_dataset(d, chunks=dict(time=10), decode_times=False) ds['time'] = xr.decode_cf(ds).time ds["time"].values = pd.to_datetime( { "year": ds.time.dt.year, "month": ds.time.dt.month, "day": ds.time.dt.day, } ) dslist.append(ds)

ens1 = xr.concat(dslist,dim='realization')

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  546303413
Powered by Datasette · Queries took 0.852ms · About: xarray-datasette