home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 571669562

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-571669562 https://api.github.com/repos/pydata/xarray/issues/3666 571669562 MDEyOklzc3VlQ29tbWVudDU3MTY2OTU2Mg== 22454970 2020-01-07T16:42:44Z 2020-01-07T16:42:44Z NONE

I think I need to leave the ds.time as undecoded and create a calendar variable each time then overwrite the ds values: ```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) cal1 = xr.decode_cf(ds).time ds["time"].values = pd.to_datetime( { "year": cal1.time.dt.year, "month": cal1.time.dt.month, "day": cal1.time.dt.day, } ) dslist.append(ds)

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

ens1 = ensembles.create_ensemble(datasets)

print(ens1)

{
    "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 1.767ms · About: xarray-datasette