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/4016#issuecomment-624384220,https://api.github.com/repos/pydata/xarray/issues/4016,624384220,MDEyOklzc3VlQ29tbWVudDYyNDM4NDIyMA==,34353851,2020-05-06T00:54:38Z,2020-05-06T00:54:38Z,NONE,"I think another solution you could add an aleat microsecond or nanosecond field ... in the datetime index and the index should be different. You could test if there are colision in the index (it means the index<->time is not empty like the sort algorithm, something similar to https://en.wikipedia.org/wiki/Radix_sort) It is like the reverse of this solution https://stackoverflow.com/questions/32827169/python-reduce-precision-pandas-timestamp-dataframe/32827432 Add another coordinate could be overloaded and xarray is very powerful to extract slice of time ds.sel(time =slice('2000-06-01', '2000-06-10')) http://xarray.pydata.org/en/stable/time-series.html#datetime-indexing I hope it could be useful. Regards Javier Ruano El mié., 29 abr. 2020 17:34, Javier Ruano escribió: > pandas doesn't have that problem > import pandas as pd > x1=pd.DataFrame([['1','2','3']]) > x2=pd.DataFrame([['4','5','6']]) > pd.concat([x1,x2],axis=1) > > El mié., 29 abr. 2020 a las 17:23, Javier Ruano () > escribió: > >> the time is the same. do you have tried to change the second one time >> index? >> >> El mié., 29 abr. 2020 a las 16:36, Xin Zhang () >> escribió: >> >>> It's impossible to concatenate two arrays on same named dimensions with >>> different sizes. >>> MCVE Code Sample >>> >>> import xarray as xrimport pandas as pd >>> >>> a = xr.DataArray([0], dims=['x']) >>> b = xr.DataArray([1, 2, 3], dims=['x']) >>> a = a.expand_dims(""time"") >>> b = b.expand_dims(""time"") >>> a.coords[""time""] = pd.DatetimeIndex(['2020-02-14 05:25:10']) >>> b.coords[""time""] = pd.DatetimeIndex(['2020-02-14 05:25:10']) >>> c = xr.concat([a, b], dim='time')print(c) >>> >>> Expected Output >>> >>> [0, 1, 2, 3] >>> >>> Problem Description >>> >>> File ""C:\Users\Xin\Desktop\test_github.py"", line 10, in >>> c = xr.concat([a, b], dim='time') >>> File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\concat.py"", line 135, in concat >>> return f(objs, dim, data_vars, coords, compat, positions, fill_value, join) >>> File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\concat.py"", line 455, in _dataarray_concat >>> join=join, >>> File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\concat.py"", line 319, in _dataset_concat >>> *datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value >>> File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\alignment.py"", line 327, in align >>> % (dim, sizes) >>> ValueError: arguments without labels along dimension 'x' cannot be aligned because they have different dimension sizes: {1, 3} >>> >>> Versions Output of xr.show_versions() INSTALLED VERSIONS >>> >>> commit: None >>> python: 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, >>> 21:48:41) [MSC v.1916 64 bit (AMD64)] >>> python-bits: 64 >>> OS: Windows >>> OS-release: 10 >>> machine: AMD64 >>> processor: Intel64 Family 6 Model 158 Stepping 9, GenuineIntel >>> byteorder: little >>> LC_ALL: None >>> LANG: None >>> LOCALE: None.None >>> libhdf5: 1.10.5 >>> libnetcdf: 4.7.3 >>> >>> xarray: 0.15.1 >>> pandas: 1.0.3 >>> numpy: 1.18.1 >>> scipy: 1.4.1 >>> netCDF4: 1.5.3 >>> pydap: None >>> h5netcdf: None >>> h5py: 2.10.0 >>> Nio: None >>> zarr: 2.4.0 >>> cftime: 1.1.1.2 >>> nc_time_axis: None >>> PseudoNetCDF: None >>> rasterio: 1.1.3 >>> cfgrib: None >>> iris: None >>> bottleneck: None >>> dask: 2.10.1 >>> distributed: 2.14.0 >>> matplotlib: 3.2.1 >>> cartopy: 0.17.0 >>> seaborn: 0.10.0 >>> numbagg: None >>> setuptools: 46.1.3.post20200325 >>> pip: 20.0.2 >>> conda: None >>> pytest: None >>> IPython: 7.13.0 >>> sphinx: 2.4.4 >>> >>> — >>> You are receiving this because you are subscribed to this thread. >>> Reply to this email directly, view it on GitHub >>> , or unsubscribe >>> >>> . >>> >> ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,609108666 https://github.com/pydata/xarray/issues/4016#issuecomment-621290319,https://api.github.com/repos/pydata/xarray/issues/4016,621290319,MDEyOklzc3VlQ29tbWVudDYyMTI5MDMxOQ==,34353851,2020-04-29T15:35:01Z,2020-04-29T15:35:01Z,NONE,"pandas doesn't have that problem import pandas as pd x1=pd.DataFrame([['1','2','3']]) x2=pd.DataFrame([['4','5','6']]) pd.concat([x1,x2],axis=1) El mié., 29 abr. 2020 a las 17:23, Javier Ruano () escribió: > the time is the same. do you have tried to change the second one time > index? > > El mié., 29 abr. 2020 a las 16:36, Xin Zhang () > escribió: > >> It's impossible to concatenate two arrays on same named dimensions with >> different sizes. >> MCVE Code Sample >> >> import xarray as xrimport pandas as pd >> >> a = xr.DataArray([0], dims=['x']) >> b = xr.DataArray([1, 2, 3], dims=['x']) >> a = a.expand_dims(""time"") >> b = b.expand_dims(""time"") >> a.coords[""time""] = pd.DatetimeIndex(['2020-02-14 05:25:10']) >> b.coords[""time""] = pd.DatetimeIndex(['2020-02-14 05:25:10']) >> c = xr.concat([a, b], dim='time')print(c) >> >> Expected Output >> >> [0, 1, 2, 3] >> >> Problem Description >> >> File ""C:\Users\Xin\Desktop\test_github.py"", line 10, in >> c = xr.concat([a, b], dim='time') >> File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\concat.py"", line 135, in concat >> return f(objs, dim, data_vars, coords, compat, positions, fill_value, join) >> File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\concat.py"", line 455, in _dataarray_concat >> join=join, >> File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\concat.py"", line 319, in _dataset_concat >> *datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value >> File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\alignment.py"", line 327, in align >> % (dim, sizes) >> ValueError: arguments without labels along dimension 'x' cannot be aligned because they have different dimension sizes: {1, 3} >> >> Versions Output of xr.show_versions() INSTALLED VERSIONS >> >> commit: None >> python: 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 21:48:41) >> [MSC v.1916 64 bit (AMD64)] >> python-bits: 64 >> OS: Windows >> OS-release: 10 >> machine: AMD64 >> processor: Intel64 Family 6 Model 158 Stepping 9, GenuineIntel >> byteorder: little >> LC_ALL: None >> LANG: None >> LOCALE: None.None >> libhdf5: 1.10.5 >> libnetcdf: 4.7.3 >> >> xarray: 0.15.1 >> pandas: 1.0.3 >> numpy: 1.18.1 >> scipy: 1.4.1 >> netCDF4: 1.5.3 >> pydap: None >> h5netcdf: None >> h5py: 2.10.0 >> Nio: None >> zarr: 2.4.0 >> cftime: 1.1.1.2 >> nc_time_axis: None >> PseudoNetCDF: None >> rasterio: 1.1.3 >> cfgrib: None >> iris: None >> bottleneck: None >> dask: 2.10.1 >> distributed: 2.14.0 >> matplotlib: 3.2.1 >> cartopy: 0.17.0 >> seaborn: 0.10.0 >> numbagg: None >> setuptools: 46.1.3.post20200325 >> pip: 20.0.2 >> conda: None >> pytest: None >> IPython: 7.13.0 >> sphinx: 2.4.4 >> >> — >> You are receiving this because you are subscribed to this thread. >> Reply to this email directly, view it on GitHub >> , or unsubscribe >> >> . >> > ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,609108666 https://github.com/pydata/xarray/issues/4016#issuecomment-621283446,https://api.github.com/repos/pydata/xarray/issues/4016,621283446,MDEyOklzc3VlQ29tbWVudDYyMTI4MzQ0Ng==,34353851,2020-04-29T15:23:59Z,2020-04-29T15:23:59Z,NONE,"the time is the same. do you have tried to change the second one time index? El mié., 29 abr. 2020 a las 16:36, Xin Zhang () escribió: > It's impossible to concatenate two arrays on same named dimensions with > different sizes. > MCVE Code Sample > > import xarray as xrimport pandas as pd > > a = xr.DataArray([0], dims=['x']) > b = xr.DataArray([1, 2, 3], dims=['x']) > a = a.expand_dims(""time"") > b = b.expand_dims(""time"") > a.coords[""time""] = pd.DatetimeIndex(['2020-02-14 05:25:10']) > b.coords[""time""] = pd.DatetimeIndex(['2020-02-14 05:25:10']) > c = xr.concat([a, b], dim='time')print(c) > > Expected Output > > [0, 1, 2, 3] > > Problem Description > > File ""C:\Users\Xin\Desktop\test_github.py"", line 10, in > c = xr.concat([a, b], dim='time') > File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\concat.py"", line 135, in concat > return f(objs, dim, data_vars, coords, compat, positions, fill_value, join) > File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\concat.py"", line 455, in _dataarray_concat > join=join, > File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\concat.py"", line 319, in _dataset_concat > *datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value > File ""E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\alignment.py"", line 327, in align > % (dim, sizes) > ValueError: arguments without labels along dimension 'x' cannot be aligned because they have different dimension sizes: {1, 3} > > Versions Output of xr.show_versions() INSTALLED VERSIONS > > commit: None > python: 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 21:48:41) > [MSC v.1916 64 bit (AMD64)] > python-bits: 64 > OS: Windows > OS-release: 10 > machine: AMD64 > processor: Intel64 Family 6 Model 158 Stepping 9, GenuineIntel > byteorder: little > LC_ALL: None > LANG: None > LOCALE: None.None > libhdf5: 1.10.5 > libnetcdf: 4.7.3 > > xarray: 0.15.1 > pandas: 1.0.3 > numpy: 1.18.1 > scipy: 1.4.1 > netCDF4: 1.5.3 > pydap: None > h5netcdf: None > h5py: 2.10.0 > Nio: None > zarr: 2.4.0 > cftime: 1.1.1.2 > nc_time_axis: None > PseudoNetCDF: None > rasterio: 1.1.3 > cfgrib: None > iris: None > bottleneck: None > dask: 2.10.1 > distributed: 2.14.0 > matplotlib: 3.2.1 > cartopy: 0.17.0 > seaborn: 0.10.0 > numbagg: None > setuptools: 46.1.3.post20200325 > pip: 20.0.2 > conda: None > pytest: None > IPython: 7.13.0 > sphinx: 2.4.4 > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > , or unsubscribe > > . > ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,609108666