home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

4 rows where user = 23487320 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 2

  • issue 2
  • pull 2

state 1

  • closed 4

repo 1

  • xarray 4
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
1876657858 I_kwDOAMm_X85v24bC 8133 AttributeError: `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead weiji14 23487320 closed 0     1 2023-09-01T03:34:15Z 2023-09-11T03:55:53Z 2023-09-11T03:55:53Z CONTRIBUTOR      

What happened?

We've been getting this AttributeError on PyGMT's dev CI which tests nightly packages of numpy/xarray/etc. See https://github.com/GenericMappingTools/pygmt/actions/runs/6043991082/job/16401918043#step:16:40

What did you expect to happen?

Running import xarray as xr should work with numpy 2.0.

Minimal Complete Verifiable Example

```Python mamba create --name xr_with_np2 python=3.11 mamba activate xr_with_np2 python -m pip install --pre --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy pandas xarray

python -c "import xarray as xr" ```

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, returning the result.
  • [X] New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

Python Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/xarray/__init__.py", line 1, in <module> from xarray import testing, tutorial File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/xarray/testing.py", line 10, in <module> from xarray.core import duck_array_ops, formatting, utils File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/xarray/core/duck_array_ops.py", line 36, in <module> from xarray.core import dask_array_ops, dtypes, nputils File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/xarray/core/dask_array_ops.py", line 3, in <module> from xarray.core import dtypes, nputils File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/xarray/core/dtypes.py", line 43, in <module> (np.bytes_, np.unicode_), # numpy promotes to unicode ^^^^^^^^^^^ File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/numpy/__init__.py", line 372, in __getattr__ raise AttributeError( AttributeError: `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead.

Anything else we need to know?

See https://numpy.org/devdocs/release/2.0.0-notes.html#numpy-2-0-python-api-removals. Relevant code at xarray is here https://github.com/pydata/xarray/blob/1043a9e13574e859ec08d19425341b2e359d2802/xarray/core/dtypes.py#L36-L44

Environment

``` # packages in environment at /home/weiji/mambaforge/envs/xr_with_np2: # # Name Version Build Channel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_gnu conda-forge bzip2 1.0.8 h7f98852_4 conda-forge ca-certificates 2023.7.22 hbcca054_0 conda-forge ld_impl_linux-64 2.40 h41732ed_0 conda-forge libexpat 2.5.0 hcb278e6_1 conda-forge libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 13.1.0 he5830b7_0 conda-forge libgomp 13.1.0 he5830b7_0 conda-forge libnsl 2.0.0 h7f98852_0 conda-forge libsqlite 3.43.0 h2797004_0 conda-forge libuuid 2.38.1 h0b41bf4_0 conda-forge libzlib 1.2.13 hd590300_5 conda-forge ncurses 6.4 hcb278e6_0 conda-forge numpy 2.0.0.dev0 pypi_0 pypi openssl 3.1.2 hd590300_0 conda-forge packaging 23.1 pypi_0 pypi pandas 2.2.0.dev0+141.g413d92d471 pypi_0 pypi pip 23.2.1 pyhd8ed1ab_0 conda-forge python 3.11.5 hab00c5b_0_cpython conda-forge python-dateutil 2.8.2 pypi_0 pypi pytz 2023.3 pypi_0 pypi readline 8.2 h8228510_1 conda-forge setuptools 68.1.2 pyhd8ed1ab_0 conda-forge six 1.16.0 pypi_0 pypi tk 8.6.12 h27826a3_0 conda-forge tzdata 2023.3 pypi_0 pypi wheel 0.41.2 pyhd8ed1ab_0 conda-forge xarray 2023.8.1.dev7+g1043a9e1 pypi_0 pypi xz 5.2.6 h166bdaf_0 conda-forge ```
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8133/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
1458347938 PR_kwDOAMm_X85DYLGV 7304 Reset file pointer to 0 when reading file stream weiji14 23487320 closed 0     5 2022-11-21T17:51:28Z 2022-12-01T16:28:01Z 2022-12-01T16:18:23Z CONTRIBUTOR   0 pydata/xarray/pulls/7304

Instead of raising a ValueError about the file pointer not being at the start of the file, reset the file pointer automatically to zero, and warn that the pointer has been reset.

  • [ ] Closes #6813
  • [ ] Tests added
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [ ] New functions/methods are listed in api.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7304/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
477081946 MDU6SXNzdWU0NzcwODE5NDY= 3185 open_rasterio does not read coordinates from netCDF file properly with netCDF4>=1.4.2 weiji14 23487320 closed 0     12 2019-08-05T22:16:20Z 2021-03-15T18:38:58Z 2021-03-15T18:38:58Z CONTRIBUTOR      

MCVE Code Sample

Adapted from the test_serialization unit test at here.

```python import xarray as xr from xarray.tests.test_backends import assert_identical, create_tmp_geotiff, create_tmp_file

with create_tmp_geotiff(additional_attrs={}) as (tmp_file, expected): # write it to a netcdf and read again (roundtrip) using open_rasterio with xr.open_rasterio(tmp_file) as rioda: with create_tmp_file(suffix='.nc') as tmp_nc_file: # Write geotiff to netcdf file rioda.to_netcdf(tmp_nc_file)

        # Read using open_dataarray works
        with xr.open_dataarray(tmp_nc_file) as ncds:
            assert_identical(rioda, ncds)

        # Read using open_rasterio doesn't work!!
        with xr.open_rasterio(tmp_nc_file) as ncds:
            assert_identical(rioda, ncds)

```

Actual Output (using netCDF4>=1.4.2)

```python-traceback AssertionError: Left and right DataArray objects are not identical

Differing coordinates: L * x (x) float64 5.5e+03 6.5e+03 7.5e+03 8.5e+03 R * x (x) float64 0.5 1.5 2.5 3.5 L * y (y) float64 7.9e+04 7.7e+04 7.5e+04 R * y (y) float64 0.5 1.5 2.5 Differing attributes: L transform: (1000.0, 0.0, 5000.0, 0.0, -2000.0, 80000.0) R transform: (1.0, 0.0, 0.0, 0.0, 1.0, 0.0) L res: (1000.0, 2000.0) R res: (1.0, -1.0) Attributes only on the left object: crs: +init=epsg:32618 ```

Expected Output (using netCDF4==1.4.1)

```python-traceback AssertionError: Left and right DataArray objects are not identical

Differing attributes: L nodatavals: (nan, nan, nan) R nodatavals: (nan, nan, nan) Attributes only on the left object: crs: +init=epsg:32618 ```

Problem Description

I have a script which takes in either NetCDF or GeoTIFF files as an input and I've been using xr.open_rasterio to read them quite successfully before, as I'm basically just interested in parsing the correct XY coordinates out. However, upgrading from NetCDF 1.4.1 to 1.4.2 breaks this behaviour (xr.open_rasterio no longer parses the coordinates properly from a .nc file).

My hunch is that it has something to do with different NetCDF4 formats (e.g. ‘NETCDF4’, 'NETCDF4_CLASSIC’, ‘NETCDF3_64BIT’) but looking at the xr.open_rasterio code, I'm not too sure what's going on... Also not very sure if this is an upstream netcdf4-python or rasterio issue but I thought I'd report it here first.

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.7 | packaged by conda-forge | (default, Jul 2 2019, 02:18:42) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 4.14.127+ machine: x86_64 processor: x86_64 byteorder: little LC_ALL: C.UTF-8 LANG: C.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.8.18 libnetcdf: 4.4.1.1 xarray: 0.12.3 pandas: 0.25.0 numpy: 1.17.0rc2 scipy: 1.3.0 netCDF4: 1.4.1 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.0.3.4 nc_time_axis: None PseudoNetCDF: None rasterio: 1.0.24 cfgrib: None iris: None bottleneck: None dask: 2.1.0 distributed: None matplotlib: 3.1.1 cartopy: None seaborn: None numbagg: None setuptools: 41.0.1 pip: 19.2.1 conda: None pytest: 5.0.1 IPython: 7.6.1 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3185/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
647804004 MDExOlB1bGxSZXF1ZXN0NDQxNzQ1NTQw 4187 Xarray open_mfdataset with engine Zarr weiji14 23487320 closed 0     16 2020-06-30T02:32:07Z 2020-09-22T15:08:36Z 2020-09-22T05:40:31Z CONTRIBUTOR   0 pydata/xarray/pulls/4187

Work on enabling xr.open_dataset(..., engine="zarr"), to ~~replace~~ complement xr.open_zarr. This also allows `xr.open_mfdataset(..., engine="zarr") to be used.

Note: Credit should be given to @Mikejmnez, I'm just continuing this on from #4003.

  • [x] Closes #3668, closes #4003
  • [x] Tests added
  • [x] Passes isort -rc . && black . && mypy . && flake8
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4187/reactions",
    "total_count": 2,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 2,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 22.872ms · About: xarray-datasette