issues: 583001763
This data as json
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
583001763 | MDU6SXNzdWU1ODMwMDE3NjM= | 3863 | xarray.DataArray.to_netcdf - file not found but file in directory | 31534057 | closed | 0 | 1 | 2020-03-17T13:10:59Z | 2020-03-17T13:53:53Z | 2020-03-17T13:53:53Z | NONE | When using xarray.to_netcdf I get for some xarray.DataArrays the following error:
MCVE Code Sample```python Your code hereimport xarray as xr from datetime import datetime datetime object containing current date and timenow = datetime.now() dd/mm/YY H:M:Sdate = now.strftime("%Y%m%d") time = now.strftime('%H') print("date and time =", date, time) ini_time = '06' Open the netCDF file containing the input data.fnx = xr.open_dataset('https://thredds.met.no/thredds/dodsC/mepslatest/meps_det_2_5km_%sT%sZ.ncml' %(date, ini_time), #decode_times = True, use_cftime = True ) write to file 'meps_out.nc'fnx.forecast_reference_time.to_netcdf(path = 'meps_out.nc', mode = 'w', format = 'NETCDF4') fnx.p0.to_netcdf(path = 'meps_out.nc', mode = 'a', format = 'NETCDF4') fnx.ap.to_netcdf(path = 'meps_out.nc', mode = 'a', format = 'NETCDF4') fnx.b.to_netcdf(path = 'meps_out.nc', mode = 'a', format = 'NETCDF4') fnx.projection_lambert.to_netcdf(path = 'meps_out.nc', mode = 'a', format = 'NETCDF4') variables with dimension: (time: 48, height0: 1, y: 1069, x: 949)fnx.ozone_profile_c.isel(time = slice(0,48)).to_netcdf(path = 'meps_out.nc', mode = 'a', format = 'NETCDF4') variables with dimension: (time: 48, hybrid: 65, y: 1069, x: 949)here is where the error occursfnx.specific_humidity_ml.isel(time = slice(0,48)).to_netcdf(path = 'meps_out.nc', mode = 'a', format='NETCDF4') ``` Expected OutputHow to get all xarray.DataArrays to a netcdf file. Problem DescriptionSave all variables from an OPeNDAP thredds file with shorter time (0-48h, instead of 0-67h). Once I want to save a DataArray with a hybrid coordinate (dim = 65) I get the error:
VersionsOutput of `xr.show_versions()`INSTALLED VERSIONS ------------------ commit: None python: 3.7.6 | packaged by conda-forge | (default, Mar 5 2020, 15:27:18) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 5.5.8-200.fc31.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.7.3 xarray: 0.15.0 pandas: 1.0.2 numpy: 1.18.1 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: 0.8.0 h5py: 2.10.0 Nio: None zarr: None cftime: 1.1.1 nc_time_axis: 1.2.0 PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.12.0 distributed: 2.12.0 matplotlib: 3.2.0 cartopy: 0.17.0 seaborn: 0.10.0 numbagg: None setuptools: 46.0.0.post20200311 pip: 20.0.2 conda: None pytest: None IPython: 7.13.0 sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3863/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |