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 551344538,MDU6SXNzdWU1NTEzNDQ1Mzg=,3701,Error using reduce(): percentile() got an unexpected keyword argument 'axis',57364981,closed,0,,,12,2020-01-17T10:51:49Z,2020-01-17T18:18:08Z,2020-01-17T15:24:48Z,NONE,,,,"#### MCVE Code Sample ```python import os import numpy as np import pandas as pd import xarray as xr import gcsfs # Search for available CMIP6 data: df = pd.read_csv('https://storage.googleapis.com/cmip6/cmip6-zarr-consolidated-stores.csv') # and daily 'tas' data: df_daily_tas = df[(df.table_id == 'day') & (df.variable_id == 'tas')] # get data for a single model and experiment: source_id = 'GFDL-CM4' expt_id = 'historical' # define a func to load 'tas' data def load_tas_data(source_id, expt_id): """""" Load daily tas data for given source and expt ids """""" uri = df_daily_tas[(df_daily_tas.source_id == source_id) & (df_daily_tas.experiment_id == expt_id)].zstore.values[0] gcs = gcsfs.GCSFileSystem(token='anon') ds = xr.open_zarr(gcs.get_mapper(uri), consolidated=True) return ds # Specify the percentile to look at: percentile = 99 # Load the data: ds = load_tas_data(source_id, expt_id).sel(time=slice('2000', '2000')) # Get the percentiles at each lat/lon: percentiles = ds.reduce(np.percentile, q=percentile, dim='time') ``` Code above gives following error: `TypeError: percentile() got an unexpected keyword argument 'axis'` #### Expected Output Expected code to return percentiles of daily temperature for each latitude and longitude. #### Problem Description Code works fine on a different system with the following modules installed:
INSTALLED VERSIONS ------------------ commit: None python: 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] python-bits: 64 OS: Darwin OS-release: 14.5.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.1 libnetcdf: 4.4.1.1 xarray: 0.14.1 pandas: 0.25.3 numpy: 1.16.2 scipy: 1.2.1 netCDF4: 1.3.1 pydap: installed h5netcdf: None h5py: 2.7.1 Nio: None zarr: 2.3.2 cftime: 1.0.4.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.2.1 dask: 0.16.1 distributed: 1.20.2 matplotlib: 2.2.2 cartopy: 0.16.0 seaborn: 0.8.1 numbagg: None setuptools: 38.4.0 pip: 9.0.1 conda: 4.4.10 pytest: 3.3.2 IPython: 6.2.1 sphinx: 1.6.6
#### Output of ``xr.show_versions()`` Issue occurs on system with the following installed modules:
INSTALLED VERSIONS ------------------ commit: None python: 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 22:33:48) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 4.19.76+ machine: x86_64 processor: x86_64 byteorder: little LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.6.2 xarray: 0.14.1 pandas: 0.25.3 numpy: 1.17.3 scipy: 1.3.2 netCDF4: 1.5.1.2 pydap: installed h5netcdf: 0.7.4 h5py: 2.10.0 Nio: None zarr: 2.3.2 cftime: 1.0.4.2 nc_time_axis: 1.2.0 PseudoNetCDF: None rasterio: 1.0.25 cfgrib: None iris: 2.2.0 bottleneck: 1.3.1 dask: 2.9.0 distributed: 2.9.0 matplotlib: 3.1.2 cartopy: 0.17.0 seaborn: 0.9.0 numbagg: None setuptools: 44.0.0.post20200102 pip: 19.3.1 conda: None pytest: 5.3.1 IPython: 7.11.1 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3701/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 538380868,MDU6SXNzdWU1MzgzODA4Njg=,3627,Error time slicing for some CMIP6 models,57364981,closed,0,,,10,2019-12-16T12:25:42Z,2019-12-16T15:42:56Z,2019-12-16T15:42:56Z,NONE,,,,"Hi there, I'm using xarray's `open_zarr()` function to analyse CMIP6 data: ```python # Function to load data: df_data has the catalogue of the variable of interest def load_data(df_data, source_id, expt_id): """""" Load data for given variable, source and expt ids. """""" uri = df_data[(df_data.source_id == source_id) & (df_data.experiment_id == expt_id)].zstore.values[0] gcs = gcsfs.GCSFileSystem(token='anon') ds = xr.open_zarr(gcs.get_mapper(uri), consolidated=True) return ds # Just test with 1 model for now: source_ids_tmp = ['CESM2'] for model_name in source_ids_tmp: print('\n\nStarting ' + model_name +'\n') ds_hist = load_data(df_mon_tas, model_name, experiment_ids[0]).sel(time=slice('1976', '2005')) ``` #### Problem Description However, the time slicing fails with the following error: > TypeError: cannot compare netcdftime._netcdftime.DatetimeNoLeap(1932, 7, 15, 12, 0, 0, 0, 1, 196) and '1976' Looking at the Dataset metedata, the `time` variable is described as follows: > * time (time) object 1850-01-15 12:00:00 ... 2014-12-15 12:00:00 time_bnds (time, nbnd) object dask.array For another CMIP6 model (MIROC6), the time slicing works fine. That model has the following metadat for `time`: > * time (time) datetime64[ns] 1850-01-16T12:00:00 ... 2014-12-16T12:00:00 time_bnds (time, bnds) datetime64[ns] dask.array When the `time` variable is converted to a `datetime[ns]` object, time slicing seems to work. Any idea what the problem is? Thanks, Mike #### Output of ``xr.show_versions()``
INSTALLED VERSIONS ------------------ commit: None libhdf5: 1.10.1 libnetcdf: 4.4.1.1 xarray: 0.14.0 pandas: 0.25.1 numpy: 1.16.2 scipy: 1.2.1 netCDF4: 1.3.1 pydap: installed h5netcdf: 0.5.0 h5py: 2.7.0 Nio: None zarr: 2.3.2 cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.2.1 dask: 0.15.3 distributed: 1.19.1 matplotlib: 3.0.0 cartopy: 0.16.0 seaborn: 0.9.0 numbagg: None setuptools: 36.5.0.post20170921 pip: 19.0.3 conda: 4.4.6 pytest: 3.3.0 IPython: 6.1.0 sphinx: 1.6.3
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3627/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue