home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

1 row where user = 27909361 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 1

  • issue 1

state 1

  • closed 1

repo 1

  • xarray 1
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
1268956107 I_kwDOAMm_X85LorvL 6693 When a raster is modified, it cannot be read correctly. JiangtaoLiud 27909361 closed 0     4 2022-06-13T06:15:44Z 2022-06-13T20:44:00Z 2022-06-13T20:44:00Z NONE      

What happened?

As the following code shows, when I read this raster for the first time, xarray can read its content correctly. When this raster is modified, it can't be read correctly.

What did you expect to happen?

No response

Minimal Complete Verifiable Example

```Python import rasterio import xarray as xr import numpy as np import os

data = np.arange(10*10.).reshape(10, 10) inp_rs = "demo.tif"

def generate_raster(data): with rasterio.open( inp_rs, 'w', driver='GTiff', height=data.shape[0], width=data.shape[1], count=1, dtype=data.dtype, crs='+proj=latlong', ) as dst: dst.write(data, 1)

generate_raster(data)

rs1 = rasterio.open(inp_rs) print("rasterio :", rs1.shape) rs2 = xr.open_dataset(inp_rs) print("xarray: ", rs2.band_data.shape)

modify it

os.remove(inp_rs) data_new = np.arange(9*9.).reshape(9, 9) generate_raster(data_new)

rs1 = rasterio.open(inp_rs) print("rasterio :", rs1.shape) rs2 = xr.open_dataset(inp_rs) print("xarray: ", rs2.band_data.shape) ```

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 Read correctly the first time: rasterio : (10, 10) xarray: (1, 10, 10)

Incorrectly read the second time: rasterio : (9, 9) xarray: (1, 10, 10) ```

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS ------------------ commit: None python: 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:57:06) [GCC 9.4.0] python-bits: 64 OS: Linux OS-release: 5.3.0-7625-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.0 libnetcdf: 4.7.4 xarray: 2022.3.0 pandas: 1.4.2 numpy: 1.22.3 scipy: 1.8.0 netCDF4: 1.5.8 pydap: None h5netcdf: None h5py: 3.6.0 Nio: None zarr: None cftime: 1.6.0 nc_time_axis: None PseudoNetCDF: None rasterio: 1.2.10 cfgrib: None iris: None bottleneck: None dask: 2022.02.1 distributed: 2022.2.1 matplotlib: 3.3.2 cartopy: None seaborn: None numbagg: None fsspec: 2022.3.0 cupy: None pint: None sparse: None setuptools: 59.8.0 pip: 22.0.4 conda: None pytest: None IPython: 8.1.1 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6693/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

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 2082.733ms · About: xarray-datasette