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 575939446,MDU6SXNzdWU1NzU5Mzk0NDY=,3830,"Documentation request: add examples for carrying out ""ncecat"" in xarray",19657652,open,0,,,4,2020-03-05T01:58:17Z,2023-04-13T20:06:20Z,,NONE,,,,"<!-- A short summary of the issue, if appropriate --> In climate science, a very common task involves concatenating NetCDF files with identical variables, dimensions, and coordinates along a brand new ""ensemble member"" or ""record"" dimension. With the NetCDF Operators, this is accomplished using [`ncecat`](http://nco.sourceforge.net/nco.html#ncecat-netCDF-Ensemble-Concatenator ). #### MCVE Code Sample Currently, it seems the correct way to do this in xarray is with [`xarray.combine_nested`](http://xarray.pydata.org/en/stable/generated/xarray.combine_nested.html) as follows: ```python import xarray as xr files = ['member1.nc', 'member2.nc', ...] ds = xr.open_mfdataset( files, combine='nested', concat_dim='record', ) ``` #### Problem Description While this works, there does not seem to be any mention of this use case in the [`combine_nested`](http://xarray.pydata.org/en/stable/generated/xarray.combine_nested.html) or [`open_mfdataset`](http://xarray.pydata.org/en/stable/generated/xarray.open_mfdataset.html) docs... and using `combine='nested'` to concatenate along a brand new dimension feels quite unintuitive to me. It would be nice to have examples in `combine_nested` and/or `open_mfdataset` with this special usage or mention the possibility of creating *brand new* dimensions with `concat_dim`. For example: ```python In [1]: import xarray as xr ...: datasets = [ ...: xr.Dataset({'temp': (('x', 'y'), np.random.rand(10, 20))}) ...: for i in range(3) ...: ] ...: xr.combine_nested(datasets, concat_dim='record') Out[1]: <xarray.Dataset> Dimensions: (record: 3, x: 10, y: 20) Dimensions without coordinates: record, x, y Data variables: temp (record, x, y) float64 0.32 0.4897 0.2659 ... 0.3485 0.0251 0.399 ``` #### Output of ``xr.show_versions()`` n/a","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3830/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 661076732,MDU6SXNzdWU2NjEwNzY3MzI=,4239,Xarray dimension interpolation strips coordinate attributes,19657652,closed,0,,,1,2020-07-19T21:19:35Z,2021-04-27T07:00:07Z,2021-04-27T07:00:07Z,NONE,,,,"<!-- Please include a self-contained copy-pastable example that generates the issue if possible. Please be concise with code posted. See guidelines below on how to provide a good bug report: - Craft Minimal Bug Reports: http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports - Minimal Complete Verifiable Examples: https://stackoverflow.com/help/mcve Bug reports that follow these guidelines are easier to diagnose, and so are often handled much more quickly. --> **What happened**: `DataArray.interp` strips the dimension coordinate attributes. **What you expected to happen**: Preserved coordinate attributes. **Minimal Complete Verifiable Example**: Input: ```python import xarray as xr import numpy as np data = xr.DataArray( np.random.rand(5), dims='x', coords={'x': ('x', np.arange(5), {'foo': 'bar'})} ) print(data.x.attrs) # initial attributes print(data.sel(x=2).x.attrs) # sel and isel preserve attributes print(data.interp(x=2.5).x.attrs) # interp does not preserve attributes with xr.set_options(keep_attrs=True): print(data.interp(x=2.5).x.attrs) # keep_attrs does nothing ``` Output: ```python {'foo': 'bar'} {'foo': 'bar'} {} {} ``` **Environment**: <details><summary>Output of <tt>xr.show_versions()</tt></summary> <!-- Paste the output here xr.show_versions() here --> INSTALLED VERSIONS ------------------ commit: None python: 3.8.3 | packaged by conda-forge | (default, Jun 1 2020, 17:43:00) [GCC 7.5.0] python-bits: 64 OS: Linux OS-release: 3.10.0-957.27.2.el7.x86_64 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.6 libnetcdf: 4.7.4 xarray: 0.15.1 pandas: 1.0.4 numpy: 1.18.4 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.1.3 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.17.2 distributed: 2.18.0 matplotlib: 3.2.1 cartopy: 0.18.0 seaborn: None numbagg: None setuptools: 47.3.0.post20200616 pip: 20.1.1 conda: 4.8.3 pytest: None IPython: 7.15.0 sphinx: None </details> ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4239/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 639618568,MDU6SXNzdWU2Mzk2MTg1Njg=,4161,Dark theme-friendly HTML Dataset and DataArray reprs for jupyter notebooks?,19657652,closed,0,,,2,2020-06-16T12:18:23Z,2020-06-17T18:33:58Z,2020-06-17T18:33:58Z,NONE,,,,"<!-- A short summary of the issue, if appropriate --> Xarray's HTML `Dataset` and `DataArray` reprs are evidently not compatible with ""dark"" jupyter notebook themes. They seem to work fine with the dark jupyter lab theme, and since jupyter lab is the way of the future perhaps this issue is obsolete, but thought I'd mention it. The below example is from a jupyter notebook with the ""onedork"" dark theme from [jupyter-themes](https://github.com/dunovank/jupyter-themes). It results in black text against a dark background for the section headers (Coordinates, Dimensions, etc.) and DataArray data tables, and a light background for the coordinate and Dataset data tables. ```python # Dataset repr import numpy as np import xarray as xr ds = xr.Dataset( { 'temp': (('x', 'y'), np.random.rand(10, 20), {'long_name': 'temperature', 'units': 'degrees_Celsius'}), 'x': ('x', np.arange(10)), 'y': ('y', np.arange(20)), }, attrs={'description': 'example dataset'} ) ds ``` <img width=""810"" alt=""Screen Shot 2020-06-16 at 4 45 48 AM"" src=""https://user-images.githubusercontent.com/19657652/84765299-43714380-af8c-11ea-9a73-8f21107a0429.png""> ```python # DataArray repr ds.temp ``` <img width=""806"" alt=""Screen Shot 2020-06-16 at 4 55 56 AM"" src=""https://user-images.githubusercontent.com/19657652/84766229-ae6f4a00-af8d-11ea-9c90-0bcc97a24041.png""> Note that, by contrast, the text repr is dark theme friendly: ```python # Text repr xr.set_options(display_style='text') ds ``` <img width=""874"" alt=""Screen Shot 2020-06-16 at 5 01 40 AM"" src=""https://user-images.githubusercontent.com/19657652/84766683-7a485900-af8e-11ea-95f6-ab0f015a42b5.png""> #### Versions <details><summary>Jupyter versions</summary> jupyter core : 4.6.3 jupyter-notebook : 6.0.3 qtconsole : 4.7.4 ipython : 7.15.0 ipykernel : 5.3.0 jupyter client : 6.1.3 jupyter lab : not installed nbconvert : 5.6.1 ipywidgets : 7.5.1 nbformat : 5.0.6 traitlets : 4.3.3 </details> <details><summary>Output of <tt>xr.show_versions()</tt></summary> INSTALLED VERSIONS ------------------ commit: None python: 3.8.3 | packaged by conda-forge | (default, Jun 1 2020, 17:43:00) [GCC 7.5.0] python-bits: 64 OS: Linux OS-release: 3.10.0-957.27.2.el7.x86_64 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: None libnetcdf: None xarray: 0.15.1 pandas: 1.0.4 numpy: 1.18.4 scipy: 1.4.1 netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.17.2 distributed: 2.18.0 matplotlib: 3.2.1 cartopy: 0.18.0 seaborn: None numbagg: None setuptools: 47.1.1.post20200529 pip: 20.1.1 conda: 4.8.3 pytest: None IPython: 7.15.0 sphinx: None </details> ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4161/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue