home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 1154397714

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/6693#issuecomment-1154397714 https://api.github.com/repos/pydata/xarray/issues/6693 1154397714 IC_kwDOAMm_X85EzrYS 14808389 2022-06-13T20:29:58Z 2022-06-13T20:32:22Z MEMBER

can you post what exactly you tried that didn't work? For me this works: python In [1]: import rasterio ...: import xarray as xr ...: import numpy as np ...: import os ...: ...: data = np.arange(10 * 10.0).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, engine="rasterio", lock=False) ...: print("xarray: ", rs2.band_data.shape) ...: ...: # modify it ...: os.remove(inp_rs) ...: data_new = np.arange(9 * 9.0).reshape(9, 9) ...: generate_raster(data_new) ...: ...: rs1 = rasterio.open(inp_rs) ...: print("rasterio :", rs1.shape) ...: rs2 = xr.open_dataset(inp_rs, engine="rasterio", lock=False) ...: print("xarray: ", rs2.band_data.shape) xarray: (1, 10, 10) rasterio : (10, 10) xarray: (1, 9, 9) rasterio : (9, 9)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1268956107
Powered by Datasette · Queries took 3.484ms · About: xarray-datasette