home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1632718954

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
1632718954 I_kwDOAMm_X85hUVBq 7652 Saving and loading an array of strings changes datatype to object 6897215 closed 0     13 2023-03-20T19:15:03Z 2023-11-17T15:26:01Z 2023-11-17T15:26:01Z NONE      

What is your issue?

See the code below ```python import xarray as xr

Make an xarray with an array of strings

da = xr.DataArray( data=[["a", "b"], ["c", "d"]], dims=["x", "y"], coords={"x": [0, 1], "y": [0, 1]}, ) da.to_netcdf("test.nc", mode='w')

Load the xarray back in

da_loaded = xr.load_dataarray("test.nc") assert da.dtype == da_loaded.dtype, "Dtypes don't match" ```

Now da_loaded.dtype is dtype('O').

Same happens with engine="h5netcdf".

import xarray xarray.show_versions() ``` INSTALLED VERSIONS


commit: None python: 3.11.0 | packaged by conda-forge | (main, Jan 14 2023, 12:26:40) [Clang 14.0.6 ] python-bits: 64 OS: Darwin OS-release: 22.3.0 machine: arm64 processor: arm byteorder: little LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.2 libnetcdf: None

xarray: 2023.2.0 pandas: 1.5.3 numpy: 1.24.2 scipy: 1.10.0 netCDF4: None pydap: None h5netcdf: 1.1.0 h5py: 3.8.0 Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.7.0 cartopy: None seaborn: 0.12.2 numbagg: None fsspec: 2023.1.0 cupy: None pint: None sparse: None flox: None numpy_groupies: None setuptools: 67.3.2 pip: 23.0 conda: None pytest: 7.2.1 mypy: 1.0.1 IPython: 8.10.0 sphinx: 5.3.0 ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7652/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 13 rows from issue in issue_comments
Powered by Datasette · Queries took 0.828ms · About: xarray-datasette