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 1668898601,I_kwDOAMm_X85jeV8p,7758,Provide a way to specify how long open_dataset tries to fetch data before timing out,33153877,open,0,,,6,2023-04-14T20:13:52Z,2023-04-26T15:31:06Z,,NONE,,,,"### Is your feature request related to a problem? I encountered an issue with the open_dataset function in my code when the server I fetch data from experienced a network issue. The whole script froze because open_dataset was unable to fetch the data from the server. ### Describe the solution you'd like An argument that allows you to specify how long open_dataset tries to fetch the data before timing out. ### Describe alternatives you've considered Right now I'm considering trying to send a HEAD request to the server and checking the response with a try-except block to catch a bad status code. I'm not sure how robust this alternative is, and I would prefer if there would be a way to natively specify a timeout in open_dataset. ### Additional context _No response_","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7758/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 1572434353,I_kwDOAMm_X85duXGx,7504,Selecting dates with .sel() doesn't work when time index is in cftime,33153877,open,0,,,2,2023-02-06T11:56:07Z,2023-02-06T18:27:15Z,,NONE,,,,"### What happened? When I try to select a subset of the data in a dataset/array with a list containing dates it fails when the time index is in cftime, and I get the following error message: `KeyError: ""not all values found in index 'time'""` ### What did you expect to happen? I expect selecting a set of dates with a list to work the same way as when the time index is in datetime64. ### Minimal Complete Verifiable Example ```Python import xarray as xr import numpy as np ds = xr.open_dataset(""https://thredds.met.no/thredds/dodsC/osisaf/met.no/ice/index/v2p1/nh/osisaf_nh_sie_daily.nc"") # Time coordinates are in datetime64, and selecting dates with a list works. print(ds.time) print(ds.sel(time=[""2023-01-01"", ""2023-01-02""])) # Converting the calendar to all_leap changes the time coordinates to use cftime instead of datetime64. ds = ds.convert_calendar(""all_leap"", missing=np.nan).interpolate_na() # Time coordinates are in cftime, and selecting dates with a list fails. print(ds.time) print(ds.sel(time=[""2023-01-01"", ""2023-01-02""])) ``` ### MVCE confirmation - [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray. - [X] Complete example — the example is self-contained, including all data and the text of any traceback. - [X] Verifiable example — the example copy & pastes into an IPython prompt or [Binder notebook](https://mybinder.org/v2/gh/pydata/xarray/main?urlpath=lab/tree/doc/examples/blank_template.ipynb), returning the result. - [X] New issue — a search of GitHub Issues suggests this is not a duplicate. ### Relevant log output ```Python (geoscience) [michael@localhost ~]$ python minimal.py array(['1979-01-01T00:00:00.000000000', '1979-01-02T00:00:00.000000000', '1979-01-03T00:00:00.000000000', ..., '2023-02-03T00:00:00.000000000', '2023-02-04T00:00:00.000000000', '2023-02-05T00:00:00.000000000'], dtype='datetime64[ns]') Coordinates: * time (time) datetime64[ns] 1979-01-01 1979-01-02 ... 2023-02-05 sic_threshold float32 ... lat float32 ... lon float32 ... Attributes: standard_name: time long_name: time of the observation (centered) coverage_content_type: auxiliaryInformation axis: T Dimensions: (time: 2, nv: 2) Coordinates: * time (time) datetime64[ns] 2023-01-01 2023-01-02 sic_threshold float32 ... lat float32 ... lon float32 ... Dimensions without coordinates: nv Data variables: lat_bounds (nv) float32 ... lon_bounds (nv) float32 ... area |S64 ... sie (time) float64 ... source (time) float64 ... Attributes: (12/35) title: Daily Northern Hemisphere Sea Ice Extent from EU... product_id: OSI-420 product_name: OSI SAF Sea Ice Index product_status: demonstration version: v2p1 summary: Time series of Daily Sea Ice Extent (SIE) for No... ... ... distribution_statement: Free copyright_statement: Copyright 2023 EUMETSAT references: Product User Manual for OSI-420, Lavergne et al.... featureType: timeSeries DODS.strlen: 2 DODS.dimName: nchar array([cftime.DatetimeAllLeap(1979, 1, 1, 0, 0, 0, 0, has_year_zero=True), cftime.DatetimeAllLeap(1979, 1, 2, 0, 0, 0, 0, has_year_zero=True), cftime.DatetimeAllLeap(1979, 1, 3, 0, 0, 0, 0, has_year_zero=True), ..., cftime.DatetimeAllLeap(2023, 2, 3, 0, 0, 0, 0, has_year_zero=True), cftime.DatetimeAllLeap(2023, 2, 4, 0, 0, 0, 0, has_year_zero=True), cftime.DatetimeAllLeap(2023, 2, 5, 0, 0, 0, 0, has_year_zero=True)], dtype=object) Coordinates: * time (time) object 1979-01-01 00:00:00 ... 2023-02-05 00:00:00 lat float32 90.0 lon float32 0.0 sic_threshold float32 0.15 Attributes: standard_name: time long_name: time of the observation (centered) coverage_content_type: auxiliaryInformation axis: T Traceback (most recent call last): File ""/var/home/michael/minimal.py"", line 15, in print(ds.sel(time=[""2023-01-01"", ""2023-01-02""])) File ""/var/home/michael/mambaforge/envs/geoscience/lib/python3.10/site-packages/xarray/core/dataset.py"", line 2554, in sel query_results = map_index_queries( File ""/var/home/michael/mambaforge/envs/geoscience/lib/python3.10/site-packages/xarray/core/indexing.py"", line 183, in map_index_queries results.append(index.sel(labels, **options)) # type: ignore[call-arg] File ""/var/home/michael/mambaforge/envs/geoscience/lib/python3.10/site-packages/xarray/core/indexes.py"", line 480, in sel raise KeyError(f""not all values found in index {coord_name!r}"") KeyError: ""not all values found in index 'time'"" ``` ### Anything else we need to know? _No response_ ### Environment
/var/home/michael/mambaforge/envs/geoscience/lib/python3.10/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn(""Setuptools is replacing distutils."") INSTALLED VERSIONS ------------------ commit: None python: 3.10.9 | packaged by conda-forge | (main, Feb 2 2023, 20:20:04) [GCC 11.3.0] python-bits: 64 OS: Linux OS-release: 6.1.9-200.fc37.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: ('en_GB', 'UTF-8') libhdf5: 1.12.2 libnetcdf: 4.8.1 xarray: 2022.11.0 pandas: 1.5.1 numpy: 1.23.4 scipy: 1.9.3 netCDF4: 1.6.1 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.6.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.6 dask: None distributed: None matplotlib: 3.6.2 cartopy: 0.21.0 seaborn: 0.12.1 numbagg: None fsspec: None cupy: None pint: None sparse: None flox: None numpy_groupies: None setuptools: 65.5.1 pip: 22.3.1 conda: None pytest: None IPython: 8.6.0 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7504/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 1052918815,I_kwDOAMm_X84-wkQf,5987,Plotting interpolated data causes artefacts,33153877,closed,1,,,8,2021-11-14T11:50:13Z,2021-11-19T22:35:09Z,2021-11-19T22:35:09Z,NONE,,,," **What happened**: I'm trying to do some analysis of CMIP6 model data, and I want to plot multi-model ensembles. In order to do that I need to regrid all of the models to a common grid. Whenever I try to plot data from a regridded model there's a white line along the central longitude and the poles. I use the PlateCarree projection and it doesn't matter what I choose as the central longitude; there's always a white line there. The code I've included below produces 4 plots. The first one is of data that hasn't been interpolated and there's no white line: ![mpi_ok](https://user-images.githubusercontent.com/33153877/141679217-9eb74a1e-b4da-458b-8e35-313066a2ab15.png) The next three are with interpolated data and with different central longitudes. They all have a white line at the central longitude. **central_longitude=0** ![mpi_bad_1](https://user-images.githubusercontent.com/33153877/141679424-b976cffc-5601-453d-a44a-1edee6741a25.png) **central_longitude=33** ![mpi_bad_2](https://user-images.githubusercontent.com/33153877/141679434-05f1b1f5-cfec-4d27-a293-9f582ee8e098.png) **central_longitude=164** ![mpi_bad_3](https://user-images.githubusercontent.com/33153877/141679443-9673d8f1-d018-44dc-8975-18581f077f3d.png) **What you expected to happen**: No plot artefacts. **Minimal Complete Verifiable Example**: ```python import xarray as xr import matplotlib.pyplot as plt import cartopy.crs as ccrs cesm2_waccm = xr.open_dataset('pr_day_CESM2-WACCM_ssp245_r2i1p1f1_gn_20750101-20841231.nc') mpi = xr.open_dataset('pr_day_MPI-ESM1-2-LR_ssp245_r1i1p1f1_gn_20750101-20941231.nc') cesm2_waccm_subset = cesm2_waccm.sel(time=slice('2075-01-01', '2075-12-31')).mean(dim='time') mpi_subset = mpi.sel(time=slice('2075-01-01', '2075-12-31')).mean(dim='time') map_proj = ccrs.PlateCarree() # This works. plot = mpi_subset.pr.plot(subplot_kws={'projection': map_proj}) plot.axes.coastlines() plt.show() mpi_interp = mpi_subset.interp(lat=cesm2_waccm_subset['lat'], lon=cesm2_waccm_subset['lon']) # A randomly chosen set of central longitudes for plots. longitudes = [0, 33, 164] for lon in longitudes: map_proj = ccrs.PlateCarree(central_longitude=lon) # Has a white line at the central longitude. plot = mpi_interp.pr.plot(subplot_kws={'projection': map_proj}) plot.axes.coastlines() plt.show() ``` **Anything else we need to know?**: Here's the data I used for plotting: https://climate.uiogeo-apps.sigma2.no/ESGF/CMIP6/ScenarioMIP/NCAR/CESM2-WACCM/ssp245/r2i1p1f1/day/pr/gn/v20200224/pr_day_CESM2-WACCM_ssp245_r2i1p1f1_gn_20750101-20841231.nc https://climate.uiogeo-apps.sigma2.no/ESGF/CMIP6/ScenarioMIP/MPI-M/MPI-ESM1-2-LR/ssp245/r1i1p1f1/day/pr/gn/v20190710/pr_day_MPI-ESM1-2-LR_ssp245_r1i1p1f1_gn_20750101-20941231.nc **Environment**:
Output of xr.show_versions() ``` In [3]: xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:23:11) [GCC 9.4.0] python-bits: 64 OS: Linux OS-release: 5.14.16-301.fc35.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: ('en_GB', 'UTF-8') libhdf5: 1.12.1 libnetcdf: None xarray: 0.20.1 pandas: 1.3.4 numpy: 1.21.4 scipy: 1.7.2 netCDF4: None pydap: None h5netcdf: 0.11.0 h5py: 3.4.0 Nio: None zarr: None cftime: 1.5.1.1 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.3.2 cartopy: 0.20.1 seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None setuptools: 58.5.3 pip: 21.3.1 conda: None pytest: None IPython: 7.29.0 sphinx: None ```
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5987/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue