home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

106 rows where author_association = "CONTRIBUTOR" and user = 8699967 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

issue >30

  • Add CRS/projection information to xarray objects 10
  • Selecting time with different variable and dimensions names 6
  • Implementation of CRS storage in rasterio with PROJ.4 & WKT 6
  • Losing data when add a raster to a dataset 6
  • Keep attrs & Add a 'keep_coords' argument to Dataset.apply 5
  • Add automatic chunking to open_rasterio 5
  • Adding mask to open_rasterio 5
  • Proposal: Update rasterio backend to store CRS/nodata information in standard locations. 4
  • REF: Make mypy manual stage with pre-commit 4
  • Writing GDAL ZARR _CRS attribute not possible 4
  • DEP: Deprecate rasterio backend 3
  • open_mfdataset not finding coordinates 2
  • Rasterio missing _FillValue in DataArray 2
  • [discussion] Use WKT or PROJ.4 string for CRS representation? 2
  • Idea: functionally-derived non-dimensional coordinates 2
  • DOC: Add rioxarray and other external examples 2
  • RasterioDeprecationWarning 2
  • Fix open_rasterio() for WarpedVRT with specified src_crs 2
  • support file-like objects in xarray.open_rasterio 2
  • deprecate open_rasterio in favour of a rioxarray entrypoint? 2
  • rio.crs seems to misbehave with geopandas.to_crs 2
  • Backend / plugin system `remove_duplicates` raises AttributeError on discovering duplicates 2
  • list available backends and basic descriptors 2
  • open_mfdataset and add time dimension 1
  • Time conversion overflow with minutes 1
  • Pangaea 1
  • Use rasterio's transform instead of homemade coordinates 1
  • rasterio backend: added nodatavals attribute 1
  • Opposite of `drop_variables` option in `open_dataset()` 1
  • API Design for Xarray Backends 1
  • …

user 1

  • snowman2 · 106 ✖

author_association 1

  • CONTRIBUTOR · 106 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1485992930 https://github.com/pydata/xarray/issues/5336#issuecomment-1485992930 https://api.github.com/repos/pydata/xarray/issues/5336 IC_kwDOAMm_X85YknPi snowman2 8699967 2023-03-27T23:26:59Z 2023-03-27T23:26:59Z CONTRIBUTOR

I am not certain about my availability at the moment. If I get free time, I would be happy to do so. However, if someone else gets started on it first, that would be great as well.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  ENH: Add keep_encoding to global options 894788930
1476324526 https://github.com/pydata/xarray/issues/7645#issuecomment-1476324526 https://api.github.com/repos/pydata/xarray/issues/7645 IC_kwDOAMm_X85X_uyu snowman2 8699967 2023-03-20T14:21:06Z 2023-03-20T14:21:06Z CONTRIBUTOR

Thanks @Illviljan :+1:

mypy should have caught this a while ago

Type hints are likely incomplete/inexact in some places in rioxarray code.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  encode_cf_variable triggers AttributeError: 'DataArray' object has no attribute '_data' 1630746106
1244548660 https://github.com/pydata/xarray/pull/7000#issuecomment-1244548660 https://api.github.com/repos/pydata/xarray/issues/7000 IC_kwDOAMm_X85KLk40 snowman2 8699967 2022-09-12T21:51:15Z 2022-09-12T21:51:15Z CONTRIBUTOR

We have other plans to eventually make pandas an optional import too

That makes not using a data frame make a lot of sense.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  list available backends and basic descriptors 1363829843
1244517611 https://github.com/pydata/xarray/pull/7000#issuecomment-1244517611 https://api.github.com/repos/pydata/xarray/issues/7000 IC_kwDOAMm_X85KLdTr snowman2 8699967 2022-09-12T21:33:30Z 2022-09-12T21:33:30Z CONTRIBUTOR

I think show_engines provides a simple user friendly interface that is valuable for users in it's current state.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  list available backends and basic descriptors 1363829843
1234745070 https://github.com/pydata/xarray/issues/6577#issuecomment-1234745070 https://api.github.com/repos/pydata/xarray/issues/6577 IC_kwDOAMm_X85JmLbu snowman2 8699967 2022-09-01T20:26:37Z 2022-09-01T20:26:37Z CONTRIBUTOR

Looks like something already exists: python from xarray.backends.plugins import list_engines It would be nice to add the description & documentation properties to xarray.backends.common.BackendEntrypoint that can be implemented by external libraries (and internally) and a more official list_engines function with the above metadata could be added.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  ENH: list_engines function 1227144046
1205808926 https://github.com/pydata/xarray/issues/2288#issuecomment-1205808926 https://api.github.com/repos/pydata/xarray/issues/2288 IC_kwDOAMm_X85H3y8e snowman2 8699967 2022-08-04T21:56:28Z 2022-08-04T21:56:28Z CONTRIBUTOR

That's nice @dcherian :+1:

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add CRS/projection information to xarray objects 341331807
1110101560 https://github.com/pydata/xarray/issues/4995#issuecomment-1110101560 https://api.github.com/repos/pydata/xarray/issues/4995 IC_kwDOAMm_X85CKs44 snowman2 8699967 2022-04-26T18:09:18Z 2022-04-26T18:12:14Z CONTRIBUTOR

Example using nearest & tolerance with reindex & sel when dims don't match based on the example in sel:

```python import numpy import xarray

da = xarray.DataArray( numpy.arange(25).reshape(5, 5), coords={"x": numpy.arange(5), "y": numpy.arange(5)}, dims=("x", "y"), ) tgt_x = numpy.linspace(0, 4, num=5) + 0.5 tgt_y = numpy.linspace(0, 4, num=5) + 0.5 da = da.reindex( x=tgt_x, y=tgt_y, method="nearest", tolerance=0.2, fill_value=numpy.nan ).sel( x=xarray.DataArray(tgt_x, dims="points"), y=xarray.DataArray(tgt_y, dims="points"), ) Output: <xarray.DataArray (points: 5)> array([nan, nan, nan, nan, nan]) Coordinates: x (points) float64 0.5 1.5 2.5 3.5 4.5 y (points) float64 0.5 1.5 2.5 3.5 4.5 Dimensions without coordinates: points `` Side note: I don't think it makes sense to addfill_valuetoselas it would require adding new coordinates that didn't exist previously. Callingreindex` first makes that more clear in my opinion.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  KeyError when selecting "nearest" data with given tolerance  822320976
1098400102 https://github.com/pydata/xarray/issues/6448#issuecomment-1098400102 https://api.github.com/repos/pydata/xarray/issues/6448 IC_kwDOAMm_X85BeEFm snowman2 8699967 2022-04-13T19:21:59Z 2022-04-13T19:21:59Z CONTRIBUTOR

GDAL doesn't actually need the CRS stored with the _CRS convention as documented in their ZARR driver specification?

GDAL may need to update the ZARR driver. The NetCDF driver does support CF. It would be good for them to be consistent.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Writing GDAL ZARR _CRS attribute not possible 1194993450
1098342334 https://github.com/pydata/xarray/issues/6448#issuecomment-1098342334 https://api.github.com/repos/pydata/xarray/issues/6448 IC_kwDOAMm_X85Bd1-- snowman2 8699967 2022-04-13T18:11:21Z 2022-04-13T18:11:21Z CONTRIBUTOR

Top reasons for using CF over a CRS attribute:

  • Supported by geospatial & netCDF software (GDAL/Esri/Unidata)
  • Attributes are easily lost ref
  • Encourage more usage of standard mechanisms of CRS storage
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Writing GDAL ZARR _CRS attribute not possible 1194993450
1098333054 https://github.com/pydata/xarray/issues/6448#issuecomment-1098333054 https://api.github.com/repos/pydata/xarray/issues/6448 IC_kwDOAMm_X85Bdzt- snowman2 8699967 2022-04-13T18:00:12Z 2022-04-13T18:00:12Z CONTRIBUTOR

This document is also a useful reference for storing CRS in xarray: https://corteva.github.io/rioxarray/stable/getting_started/crs_management.html

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Writing GDAL ZARR _CRS attribute not possible 1194993450
1098331427 https://github.com/pydata/xarray/issues/6448#issuecomment-1098331427 https://api.github.com/repos/pydata/xarray/issues/6448 IC_kwDOAMm_X85BdzUj snowman2 8699967 2022-04-13T17:58:19Z 2022-04-13T17:58:19Z CONTRIBUTOR

Instead, it recommends to use CF conventions for encoding CRS. This is more compatible with NetCDF, but won't be parsed correctly by GDAL.

GDAL does support the CF conventions for storing the CRS.

https://gdal.org/drivers/raster/netcdf.html#georeference

"The driver first tries to follow the CF-1 Convention from UNIDATA looking for the Metadata named “grid_mapping”."

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Writing GDAL ZARR _CRS attribute not possible 1194993450
1069088984 https://github.com/pydata/xarray/issues/6288#issuecomment-1069088984 https://api.github.com/repos/pydata/xarray/issues/6288 IC_kwDOAMm_X84_uQDY snowman2 8699967 2022-03-16T12:46:15Z 2022-03-16T12:46:15Z CONTRIBUTOR

https://corteva.github.io/rioxarray/stable/getting_started/getting_started.html#xarray

Are you able to use decode_coords="all" when opening?

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  `Dataset.to_zarr()` does not preserve CRS information 1143489702
1068278154 https://github.com/pydata/xarray/pull/6350#issuecomment-1068278154 https://api.github.com/repos/pydata/xarray/issues/6350 IC_kwDOAMm_X84_rKGK snowman2 8699967 2022-03-15T17:49:51Z 2022-03-15T17:49:51Z CONTRIBUTOR

https://github.com/jupyter/nbconvert/releases/tag/6.4.3

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  explicitly install `ipython_genutils` 1166353506
1030701879 https://github.com/pydata/xarray/pull/6024#issuecomment-1030701879 https://api.github.com/repos/pydata/xarray/issues/6024 IC_kwDOAMm_X849b0M3 snowman2 8699967 2022-02-05T21:29:03Z 2022-02-05T21:29:03Z CONTRIBUTOR

No worries. I will try to address the conflicts when I get a free moment. Though, I wouldn't complain if someone else with a sooner free moment finished this one off before I do :-).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  REF: Make mypy manual stage with pre-commit 1062681040
985706928 https://github.com/pydata/xarray/pull/4140#issuecomment-985706928 https://api.github.com/repos/pydata/xarray/issues/4140 IC_kwDOAMm_X846wLGw snowman2 8699967 2021-12-03T17:40:18Z 2021-12-03T17:40:18Z CONTRIBUTOR

Sounds like that may need changes in rioxarray. Mind opening up an issue: https://github.com/corteva/rioxarray/issues ?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  support file-like objects in xarray.open_rasterio 636451398
978097496 https://github.com/pydata/xarray/pull/6024#issuecomment-978097496 https://api.github.com/repos/pydata/xarray/issues/6024 IC_kwDOAMm_X846TJVY snowman2 8699967 2021-11-24T17:47:21Z 2021-11-24T17:47:21Z CONTRIBUTOR

can we make it?

I am not seeing an option to do that: https://pre-commit.ci/

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  REF: Make mypy manual stage with pre-commit 1062681040
978093218 https://github.com/pydata/xarray/pull/6024#issuecomment-978093218 https://api.github.com/repos/pydata/xarray/issues/6024 IC_kwDOAMm_X846TISi snowman2 8699967 2021-11-24T17:41:22Z 2021-11-24T17:41:22Z CONTRIBUTOR

Is mypy being run in the CI now?

Yes, it runs on the CI

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  REF: Make mypy manual stage with pre-commit 1062681040
978088422 https://github.com/pydata/xarray/pull/6024#issuecomment-978088422 https://api.github.com/repos/pydata/xarray/issues/6024 IC_kwDOAMm_X846THHm snowman2 8699967 2021-11-24T17:34:12Z 2021-11-24T17:34:12Z CONTRIBUTOR

I didn't know we could pass --all like that.

I think it is equivalent to --all-files

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  REF: Make mypy manual stage with pre-commit 1062681040
969177424 https://github.com/pydata/xarray/pull/5959#issuecomment-969177424 https://api.github.com/repos/pydata/xarray/issues/5959 IC_kwDOAMm_X845xHlQ snowman2 8699967 2021-11-15T18:06:04Z 2021-11-15T18:06:04Z CONTRIBUTOR

This works for rioxarray. Thanks :+1:

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 1,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Fix module name retrieval in `backend.plugins.remove_duplicates()`, plugin tests 1048309254
963583761 https://github.com/pydata/xarray/issues/5944#issuecomment-963583761 https://api.github.com/repos/pydata/xarray/issues/5944 IC_kwDOAMm_X845bx8R snowman2 8699967 2021-11-08T21:19:08Z 2021-11-08T21:21:02Z CONTRIBUTOR

I see the same issue reported here: https://github.com/pydata/xarray/issues/5944#issuecomment-962958896

See: https://github.com/corteva/rioxarray/runs/4140632105 (Note: updated CI build link)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Backend / plugin system `remove_duplicates` raises AttributeError on discovering duplicates 1046454702
963281576 https://github.com/pydata/xarray/issues/5944#issuecomment-963281576 https://api.github.com/repos/pydata/xarray/issues/5944 IC_kwDOAMm_X845aoKo snowman2 8699967 2021-11-08T15:38:55Z 2021-11-08T15:38:55Z CONTRIBUTOR

When a fix is added for this, feel free to ping me to test the fix on rioxarray.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Backend / plugin system `remove_duplicates` raises AttributeError on discovering duplicates 1046454702
932820224 https://github.com/pydata/xarray/pull/5808#issuecomment-932820224 https://api.github.com/repos/pydata/xarray/issues/5808 IC_kwDOAMm_X843mbUA snowman2 8699967 2021-10-02T21:03:39Z 2021-10-02T21:03:39Z CONTRIBUTOR

Thanks for the review 👍

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DEP: Deprecate rasterio backend 1003587347
926981465 https://github.com/pydata/xarray/pull/5808#issuecomment-926981465 https://api.github.com/repos/pydata/xarray/issues/5808 IC_kwDOAMm_X843QJ1Z snowman2 8699967 2021-09-25T00:31:30Z 2021-09-25T00:31:30Z CONTRIBUTOR

Updated this so it is deprecated in 0.19.1 and added an entry to whats-new.rst.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DEP: Deprecate rasterio backend 1003587347
924512348 https://github.com/pydata/xarray/pull/5808#issuecomment-924512348 https://api.github.com/repos/pydata/xarray/issues/5808 IC_kwDOAMm_X843GvBc snowman2 8699967 2021-09-22T01:39:37Z 2021-09-22T01:39:37Z CONTRIBUTOR

Fix for doc build issues in #5805

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DEP: Deprecate rasterio backend 1003587347
924395904 https://github.com/pydata/xarray/issues/5782#issuecomment-924395904 https://api.github.com/repos/pydata/xarray/issues/5782 IC_kwDOAMm_X843GSmA snowman2 8699967 2021-09-21T21:24:03Z 2021-09-21T21:24:12Z CONTRIBUTOR

xr.open_rasterio() is being used earlier in the pipeline

What issues do you have if you change to use rioxarray.open_rasterio?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  rio.crs seems to misbehave with geopandas.to_crs 991857313
924395141 https://github.com/pydata/xarray/issues/5782#issuecomment-924395141 https://api.github.com/repos/pydata/xarray/issues/5782 IC_kwDOAMm_X843GSaF snowman2 8699967 2021-09-21T21:23:01Z 2021-09-21T21:23:01Z CONTRIBUTOR

This appears to not be an xarray issue since the code uses open_dataset and the rio.crs accessor. The rio.crs accessor is from rioxarray. From what I can tell, the issue has to do with the data is stored in the netCDF file: https://corteva.github.io/rioxarray/stable/getting_started/crs_management.html

My guess is that there is an attribute named crs with the contents +init=EPSG:XXXX. If that is the case, I recommend using rioxarray to do:

python data.rio.write_crs("ESPG:XXXX", inplace=True)

Hopefully this is helpful.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  rio.crs seems to misbehave with geopandas.to_crs 991857313
880914020 https://github.com/pydata/xarray/pull/5609#issuecomment-880914020 https://api.github.com/repos/pydata/xarray/issues/5609 MDEyOklzc3VlQ29tbWVudDg4MDkxNDAyMA== snowman2 8699967 2021-07-15T18:18:43Z 2021-07-15T18:18:43Z CONTRIBUTOR

For reference: - https://corteva.github.io/rioxarray/stable/examples/COG.html - https://github.com/corteva/rioxarray/pull/48

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Kwargs to rasterio open 945434599
867787488 https://github.com/pydata/xarray/pull/5501#issuecomment-867787488 https://api.github.com/repos/pydata/xarray/issues/5501 MDEyOklzc3VlQ29tbWVudDg2Nzc4NzQ4OA== snowman2 8699967 2021-06-24T16:34:50Z 2021-06-24T16:34:50Z CONTRIBUTOR

Also see: https://github.com/corteva/rioxarray/pull/359

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  fix dtype complex for rasterio backend 925533850
844116976 https://github.com/pydata/xarray/issues/3497#issuecomment-844116976 https://api.github.com/repos/pydata/xarray/issues/3497 MDEyOklzc3VlQ29tbWVudDg0NDExNjk3Ng== snowman2 8699967 2021-05-19T13:40:16Z 2021-05-19T13:40:16Z CONTRIBUTOR

Not sure what we want to do about these attributes in the long term.

I like the idea of using them the same way xarray does for metadata. The next step would be to get pandas to add .encoding and then they could do mask_and_scale on their read_* methods :).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  how should xarray handle pandas attrs 520079199
832696002 https://github.com/pydata/xarray/issues/5075#issuecomment-832696002 https://api.github.com/repos/pydata/xarray/issues/5075 MDEyOklzc3VlQ29tbWVudDgzMjY5NjAwMg== snowman2 8699967 2021-05-05T13:40:07Z 2021-05-05T13:40:07Z CONTRIBUTOR

Yes, the alignment stuff in there should do the trick.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Losing data when add a raster to a dataset 841012076
832685060 https://github.com/pydata/xarray/issues/5075#issuecomment-832685060 https://api.github.com/repos/pydata/xarray/issues/5075 MDEyOklzc3VlQ29tbWVudDgzMjY4NTA2MA== snowman2 8699967 2021-05-05T13:25:23Z 2021-05-05T13:25:23Z CONTRIBUTOR

I think it would be nice for xarray to have a "close enough" option where a certain number of decimal places is enough to consider them equal. Is there an issue somewhere where this is under consideration or is there an option already in existence that I missed?

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Losing data when add a raster to a dataset 841012076
832684387 https://github.com/pydata/xarray/issues/5075#issuecomment-832684387 https://api.github.com/repos/pydata/xarray/issues/5075 MDEyOklzc3VlQ29tbWVudDgzMjY4NDM4Nw== snowman2 8699967 2021-05-05T13:24:34Z 2021-05-05T13:24:34Z CONTRIBUTOR

Also related: https://github.com/corteva/rioxarray/discussions/332

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Losing data when add a raster to a dataset 841012076
822618516 https://github.com/pydata/xarray/issues/4697#issuecomment-822618516 https://api.github.com/repos/pydata/xarray/issues/4697 MDEyOklzc3VlQ29tbWVudDgyMjYxODUxNg== snowman2 8699967 2021-04-19T16:48:12Z 2021-04-19T16:48:20Z CONTRIBUTOR

@alexamici added the entrypoint here; https://github.com/corteva/rioxarray/pull/281. It seems xarray 0.18+ is required for it to work. Any timeline for the 0.18 release?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  deprecate open_rasterio in favour of a rioxarray entrypoint? 767941842
822617369 https://github.com/pydata/xarray/pull/3136#issuecomment-822617369 https://api.github.com/repos/pydata/xarray/issues/3136 MDEyOklzc3VlQ29tbWVudDgyMjYxNzM2OQ== snowman2 8699967 2021-04-19T16:46:27Z 2021-04-19T16:46:27Z CONTRIBUTOR

Related: https://github.com/corteva/rioxarray/issues/191

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Added suppport for geotiff colormap() colorinterp to be loaded into attrs 468937654
820578700 https://github.com/pydata/xarray/issues/5075#issuecomment-820578700 https://api.github.com/repos/pydata/xarray/issues/5075 MDEyOklzc3VlQ29tbWVudDgyMDU3ODcwMA== snowman2 8699967 2021-04-15T16:49:34Z 2021-04-15T16:49:34Z CONTRIBUTOR

Similarly at https://github.com/corteva/rioxarray/issues/298#issuecomment-820557568

python np.abs(resampled.x.values - da2.x.values).max(), np.abs(resampled.y.values - da2.y.values).max() (4.000014541816199e-09, 6.666663665555461e-09)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Losing data when add a raster to a dataset 841012076
820575552 https://github.com/pydata/xarray/issues/5075#issuecomment-820575552 https://api.github.com/repos/pydata/xarray/issues/5075 MDEyOklzc3VlQ29tbWVudDgyMDU3NTU1Mg== snowman2 8699967 2021-04-15T16:46:15Z 2021-04-15T16:48:51Z CONTRIBUTOR

For the original post for this issue ref: np.abs(raster_in.x.values - out_grid.x.values).max(), np.abs(raster_in.y.values - out_grid.y.values).max() (1.7763568394002505e-15, 7.105427357601002e-15)

Looks like there is a tiny difference in decimal precision.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Losing data when add a raster to a dataset 841012076
820560634 https://github.com/pydata/xarray/issues/5075#issuecomment-820560634 https://api.github.com/repos/pydata/xarray/issues/5075 MDEyOklzc3VlQ29tbWVudDgyMDU2MDYzNA== snowman2 8699967 2021-04-15T16:23:28Z 2021-04-15T16:23:28Z CONTRIBUTOR

Similar issue here: https://github.com/corteva/rioxarray/issues/298

Reproducible example in the issue ^^

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Losing data when add a raster to a dataset 841012076
796092118 https://github.com/pydata/xarray/issues/5005#issuecomment-796092118 https://api.github.com/repos/pydata/xarray/issues/5005 MDEyOklzc3VlQ29tbWVudDc5NjA5MjExOA== snowman2 8699967 2021-03-10T20:57:09Z 2021-03-10T20:57:09Z CONTRIBUTOR

Thanks for mentioning that. For rioxarray, the fix is: python transform = da.rio.transform()

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Example documentation in open_rasterio 823418135
790936823 https://github.com/pydata/xarray/pull/4979#issuecomment-790936823 https://api.github.com/repos/pydata/xarray/issues/4979 MDEyOklzc3VlQ29tbWVudDc5MDkzNjgyMw== snowman2 8699967 2021-03-04T20:58:29Z 2021-03-04T20:58:29Z CONTRIBUTOR

For reference for how rioxarray does things: https://corteva.github.io/rioxarray/stable/getting_started/crs_management.html

```

import xarray, rioxarray xda = xarray.DataArray(1) xda.rio.write_crs(4326, inplace=True) <xarray.DataArray ()> array(1) Coordinates: spatial_ref int64 0 Attributes: grid_mapping: spatial_ref xda.spatial_ref <xarray.DataArray 'spatial_ref' ()> array(0) Coordinates: spatial_ref int64 0 Attributes: crs_wkt: GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["... semi_major_axis: 6378137.0 semi_minor_axis: 6356752.314245179 inverse_flattening: 298.257223563 reference_ellipsoid_name: WGS 84 longitude_of_prime_meridian: 0.0 prime_meridian_name: Greenwich geographic_crs_name: WGS 84 grid_mapping_name: latitude_longitude spatial_ref: GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["... ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Flexible indexes refactoring notes 819062172
746518824 https://github.com/pydata/xarray/issues/4697#issuecomment-746518824 https://api.github.com/repos/pydata/xarray/issues/4697 MDEyOklzc3VlQ29tbWVudDc0NjUxODgyNA== snowman2 8699967 2020-12-16T15:52:34Z 2020-12-16T15:52:34Z CONTRIBUTOR

Looks like entrypoint support was added in #4577. What is the timeline for the next release?

and rioxarray agrees

Is rioxarray agreeing to allow the addition of entrypoint support? If so, :+1:

{
    "total_count": 2,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 1,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  deprecate open_rasterio in favour of a rioxarray entrypoint? 767941842
739655170 https://github.com/pydata/xarray/issues/3776#issuecomment-739655170 https://api.github.com/repos/pydata/xarray/issues/3776 MDEyOklzc3VlQ29tbWVudDczOTY1NTE3MA== snowman2 8699967 2020-12-07T04:27:45Z 2020-12-07T04:27:45Z CONTRIBUTOR

You may be interested in rioxarray: https://corteva.github.io/rioxarray/stable/getting_started/getting_started.html

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Exporting .nc using to_netdcf with open_rasterio() failes exporting all Attributes  566961374
653927498 https://github.com/pydata/xarray/issues/1970#issuecomment-653927498 https://api.github.com/repos/pydata/xarray/issues/1970 MDEyOklzc3VlQ29tbWVudDY1MzkyNzQ5OA== snowman2 8699967 2020-07-05T19:14:29Z 2020-07-05T19:14:29Z CONTRIBUTOR

Reference for writing from xarray to GeoTIFF or any other GDAL supported format: https://corteva.github.io/rioxarray/stable/examples/convert_to_raster.html

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  API Design for Xarray Backends 302806158
642669071 https://github.com/pydata/xarray/issues/4142#issuecomment-642669071 https://api.github.com/repos/pydata/xarray/issues/4142 MDEyOklzc3VlQ29tbWVudDY0MjY2OTA3MQ== snowman2 8699967 2020-06-11T13:54:33Z 2020-06-11T14:05:49Z CONTRIBUTOR

In rioxarray we updated open_rasterio so it opens a tif file like a DataArray and netcdf-like files as a dataset. It also loads in the metadata/tags as well:

NetCDF file as Dataset

python import rioxarray xds = rioxarray.open_rasterio("PLANET_SCOPE_3D.nc") <xarray.Dataset> Dimensions: (time: 2, x: 10, y: 10) Coordinates: * y (y) float64 8.085e+06 8.085e+06 ... 8.085e+06 8.085e+06 * x (x) float64 4.663e+05 4.663e+05 ... 4.663e+05 4.663e+05 * time (time) object 2016-12-19 10:27:29 2016-12-29 12:52:41.659696 spatial_ref int64 0 Data variables: blue (time, y, x) float64 6.611 5.581 0.3996 ... 3.491 5.056 3.368 green (time, y, x) float64 7.921 66.15 30.1 ... 21.76 27.29 18.41 Attributes: coordinates: spatial_ref

GeoTiff as DataArray

python rds = rioxarray.open_rasterio("test_albedo.tif") <xarray.DataArray (band: 1, y: 936, x: 745)> [697320 values with dtype=int8] Coordinates: * band (band) int64 1 * y (y) float64 4.225e+06 4.225e+06 ... 4.216e+06 4.216e+06 * x (x) float64 6.168e+05 6.168e+05 ... 6.242e+05 6.242e+05 spatial_ref int64 0 Attributes: transform: (10.0, 0.0, 616800.0, 0.0, -10.0, 4225260.0) _FillValue: -1.0 scale_factor: 1.0 add_offset: 0.0 long_name: Albedo dry - the estimated ratio of the incident short-wav... grid_mapping: spatial_ref

So, it could be modified to use as an engine in its current state.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Should we make "rasterio" an engine option? 636493109
642340685 https://github.com/pydata/xarray/pull/4104#issuecomment-642340685 https://api.github.com/repos/pydata/xarray/issues/4104 MDEyOklzc3VlQ29tbWVudDY0MjM0MDY4NQ== snowman2 8699967 2020-06-11T00:48:40Z 2020-06-11T00:48:40Z CONTRIBUTOR

go for it!

Sounds good, will do. Thanks for the patch :+1:

I don't know much about rioxarray

The usage examples are a good place to go to learn more.

Is the intent to someday merge that into xarray or will the geospatial features mean it will remain separate?

It hasn't really been discussed/decided upon.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Fix open_rasterio() for WarpedVRT with specified src_crs 626240065
642239585 https://github.com/pydata/xarray/pull/3964#issuecomment-642239585 https://api.github.com/repos/pydata/xarray/issues/3964 MDEyOklzc3VlQ29tbWVudDY0MjIzOTU4NQ== snowman2 8699967 2020-06-10T20:27:34Z 2020-06-10T20:27:34Z CONTRIBUTOR

@cheginit, thanks for being willing. The part to modify is here: https://github.com/corteva/rioxarray/blob/6587726a019f46ec68ca94d6cea866abea956a2a/rioxarray/_io.py#L657

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  RasterioDeprecationWarning 598121005
642185516 https://github.com/pydata/xarray/pull/3964#issuecomment-642185516 https://api.github.com/repos/pydata/xarray/issues/3964 MDEyOklzc3VlQ29tbWVudDY0MjE4NTUxNg== snowman2 8699967 2020-06-10T18:32:52Z 2020-06-10T18:32:52Z CONTRIBUTOR

Would you like to add this update to rioxarray as well? If not, mind if I port it over?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  RasterioDeprecationWarning 598121005
642185267 https://github.com/pydata/xarray/pull/4104#issuecomment-642185267 https://api.github.com/repos/pydata/xarray/issues/4104 MDEyOklzc3VlQ29tbWVudDY0MjE4NTI2Nw== snowman2 8699967 2020-06-10T18:32:23Z 2020-06-10T18:32:23Z CONTRIBUTOR

Would you like to add this update to rioxarray as well? If not, mind if I port it over?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Fix open_rasterio() for WarpedVRT with specified src_crs 626240065
642184783 https://github.com/pydata/xarray/pull/4140#issuecomment-642184783 https://api.github.com/repos/pydata/xarray/issues/4140 MDEyOklzc3VlQ29tbWVudDY0MjE4NDc4Mw== snowman2 8699967 2020-06-10T18:31:26Z 2020-06-10T18:31:26Z CONTRIBUTOR

Would you like to add this update to rioxarray as well? If not, mind if I port it over?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  support file-like objects in xarray.open_rasterio 636451398
595233073 https://github.com/pydata/xarray/pull/3757#issuecomment-595233073 https://api.github.com/repos/pydata/xarray/issues/3757 MDEyOklzc3VlQ29tbWVudDU5NTIzMzA3Mw== snowman2 8699967 2020-03-05T13:36:25Z 2020-03-05T13:36:25Z CONTRIBUTOR

Thanks for the fixes 👍

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DOC: Add rioxarray and other external examples 561132832
590556932 https://github.com/pydata/xarray/pull/3757#issuecomment-590556932 https://api.github.com/repos/pydata/xarray/issues/3757 MDEyOklzc3VlQ29tbWVudDU5MDU1NjkzMg== snowman2 8699967 2020-02-24T21:27:01Z 2020-02-24T21:27:01Z CONTRIBUTOR

We might want to think about adding rioxarray as documentation build dependency

That brings along with it the fun of GDAL as a dependency.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  DOC: Add rioxarray and other external examples 561132832
582984655 https://github.com/pydata/xarray/issues/2723#issuecomment-582984655 https://api.github.com/repos/pydata/xarray/issues/2723 MDEyOklzc3VlQ29tbWVudDU4Mjk4NDY1NQ== snowman2 8699967 2020-02-06T16:20:54Z 2020-02-06T16:20:54Z CONTRIBUTOR

@dcherian Maybe a link to these examples in that section then? https://corteva.github.io/rioxarray/stable/examples/examples.html

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implementation of CRS storage in rasterio with PROJ.4 & WKT 404088563
582965693 https://github.com/pydata/xarray/issues/2723#issuecomment-582965693 https://api.github.com/repos/pydata/xarray/issues/2723 MDEyOklzc3VlQ29tbWVudDU4Mjk2NTY5Mw== snowman2 8699967 2020-02-06T15:42:35Z 2020-02-06T15:42:35Z CONTRIBUTOR

Adding an example on doing these manipulations would also be very welcome.

What types of manipulations are you thinking about? Reprojection? Export to geotiff? Clip? Reading in files?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implementation of CRS storage in rasterio with PROJ.4 & WKT 404088563
582944232 https://github.com/pydata/xarray/issues/2723#issuecomment-582944232 https://api.github.com/repos/pydata/xarray/issues/2723 MDEyOklzc3VlQ29tbWVudDU4Mjk0NDIzMg== snowman2 8699967 2020-02-06T14:58:07Z 2020-02-06T14:58:07Z CONTRIBUTOR

Going to close this as it is over a year old.

For reference, WKT support is in rioxarray. https://corteva.github.io/rioxarray/stable/examples/crs_management.html

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 1,
    "rocket": 0,
    "eyes": 0
}
  Implementation of CRS storage in rasterio with PROJ.4 & WKT 404088563
565680014 https://github.com/pydata/xarray/issues/3620#issuecomment-565680014 https://api.github.com/repos/pydata/xarray/issues/3620 MDEyOklzc3VlQ29tbWVudDU2NTY4MDAxNA== snowman2 8699967 2019-12-14T04:03:24Z 2019-12-14T04:03:24Z CONTRIBUTOR

I'm wondering if an xarray accessor could work around some of the current limitations you're seeing.

I think this sounds like a good idea.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Idea: functionally-derived non-dimensional coordinates 537772490
565673569 https://github.com/pydata/xarray/issues/3620#issuecomment-565673569 https://api.github.com/repos/pydata/xarray/issues/3620 MDEyOklzc3VlQ29tbWVudDU2NTY3MzU2OQ== snowman2 8699967 2019-12-14T02:38:32Z 2019-12-14T02:38:32Z CONTRIBUTOR

For reference, here is how CRS information is handled in rioxarray: CRS management docs.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Idea: functionally-derived non-dimensional coordinates 537772490
550467547 https://github.com/pydata/xarray/pull/2618#issuecomment-550467547 https://api.github.com/repos/pydata/xarray/issues/2618 MDEyOklzc3VlQ29tbWVudDU1MDQ2NzU0Nw== snowman2 8699967 2019-11-06T19:37:19Z 2019-11-06T19:37:19Z CONTRIBUTOR

@jsignell, the masked kwarg is in rioxarray if you need it: https://corteva.github.io/rioxarray/html/examples/clip_geom.html

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Adding mask to open_rasterio 392361367
546407518 https://github.com/pydata/xarray/issues/3449#issuecomment-546407518 https://api.github.com/repos/pydata/xarray/issues/3449 MDEyOklzc3VlQ29tbWVudDU0NjQwNzUxOA== snowman2 8699967 2019-10-25T15:47:33Z 2019-10-25T15:47:33Z CONTRIBUTOR

Nice!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  open_rasterio: Need to move Affine object to left side 512584839
514713407 https://github.com/pydata/xarray/pull/2255#issuecomment-514713407 https://api.github.com/repos/pydata/xarray/issues/2255 MDEyOklzc3VlQ29tbWVudDUxNDcxMzQwNw== snowman2 8699967 2019-07-24T16:53:50Z 2019-07-24T16:53:50Z CONTRIBUTOR

Put another way: why don't we put all the logic in rioxarray and make rioxarray an optional dependency of xarray to open rio files?

That is an option. All of the logic has already been moved over.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add automatic chunking to open_rasterio 336371511
514688429 https://github.com/pydata/xarray/pull/2255#issuecomment-514688429 https://api.github.com/repos/pydata/xarray/issues/2255 MDEyOklzc3VlQ29tbWVudDUxNDY4ODQyOQ== snowman2 8699967 2019-07-24T15:46:36Z 2019-07-24T15:46:36Z CONTRIBUTOR

I'm curious, are there features in rioxarray that could be pushed upstream?

Depends on what the xarray maintainers would like to add. I would definitely like to see the open_rasterio function in rioxarray absorbed back into xarray. Things have just been really slow moving with the other PRs/issues.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add automatic chunking to open_rasterio 336371511
514685330 https://github.com/pydata/xarray/pull/2255#issuecomment-514685330 https://api.github.com/repos/pydata/xarray/issues/2255 MDEyOklzc3VlQ29tbWVudDUxNDY4NTMzMA== snowman2 8699967 2019-07-24T15:38:53Z 2019-07-24T15:39:53Z CONTRIBUTOR

I've abandoned this PR. If anyone has time to pick it up, that would be welcome.

I appreciate you staring this! Based on this PR, I added the feature into rioxarray here: https://github.com/corteva/rioxarray/pull/31 (released in version 0.0.9). (Example usage can be seen here.)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add automatic chunking to open_rasterio 336371511
514628738 https://github.com/pydata/xarray/pull/2255#issuecomment-514628738 https://api.github.com/repos/pydata/xarray/issues/2255 MDEyOklzc3VlQ29tbWVudDUxNDYyODczOA== snowman2 8699967 2019-07-24T13:19:47Z 2019-07-24T13:55:35Z CONTRIBUTOR

How to create tiled TIFF files in the tests

One thing I would like to note is that the automatic chunking would be useful if the raster is tiled or not. I tested out a raster that was not tiled, but it still had chunks. This is due to the raster being written in stripes. So, I would recommend removing the restriction to only tiled rasters.

Also, to create a tiled raster: ```python import rasterio import numpy from affine import Affine

with rasterio.open( "tiled.tif", "w", driver="GTiff", count=2, width=1024, height=1024, crs="+init=epsg:4326", transform=Affine(0.0083333333, 0.0, -180.00416666665, 0.0, -0.0083333333, 75.00416666665), dtype=rasterio.float32, tiled=True, blockxsize=512, blockysize=512, ) as rds: rds.write((numpy.random.rand(2, 1024, 1024)*10).astype(numpy.float32)) ```

Looks like they have this option in the tests:

python open_kwargs=dict( tiled=True, blockxsize=512, blockysize=512 ) with create_tmp_geotiff(nx=1024, ny=1024, nz=2, open_kwargs=open_kwargs) as (tmp_file, expected): ....

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add automatic chunking to open_rasterio 336371511
514626195 https://github.com/pydata/xarray/pull/2255#issuecomment-514626195 https://api.github.com/repos/pydata/xarray/issues/2255 MDEyOklzc3VlQ29tbWVudDUxNDYyNjE5NQ== snowman2 8699967 2019-07-24T13:12:47Z 2019-07-24T13:27:41Z CONTRIBUTOR

The right way to merge different dtypes and block shapes in the tiff file. Currently I'm assuming that they're uniform

I have yet to run into a raster that varies dtypes and block shapes across bands. Most of the time, they are single band rasters. And if they are not, they have had the same dtype and block shape. So, I think your assumption is a good one for most use cases.

Also, only a single dtype is allowed currently: https://github.com/pydata/xarray/blob/1d7bcbdc75b6d556c04e2c7d7a042e4379e15303/xarray/backends/rasterio_.py#L39-L40

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add automatic chunking to open_rasterio 336371511
510693104 https://github.com/pydata/xarray/issues/2042#issuecomment-510693104 https://api.github.com/repos/pydata/xarray/issues/2042 MDEyOklzc3VlQ29tbWVudDUxMDY5MzEwNA== snowman2 8699967 2019-07-11T23:46:38Z 2019-07-11T23:46:38Z CONTRIBUTOR

A new project called rioxarray has a to_raster method with the default driver of GTiff.

You can use it like so:

``` import rioxarray import xarray

xds = xarray.open_rasterio("myfile.tif") wgs84_xds = xds.rio.reproject("EPSG:4326") wgs84_xds.rio.to_raster("myfile_wgs84.tif") `` It currently only supports 2d/3dDataArrays. So, you would have to iterate over your variables to export each one to a raster if you have aDataset`.

{
    "total_count": 8,
    "+1": 7,
    "-1": 0,
    "laugh": 1,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Anyone working on a to_tiff? Alternatively, how do you write an xarray to a geotiff?  312203596
506403269 https://github.com/pydata/xarray/issues/2723#issuecomment-506403269 https://api.github.com/repos/pydata/xarray/issues/2723 MDEyOklzc3VlQ29tbWVudDUwNjQwMzI2OQ== snowman2 8699967 2019-06-27T15:49:52Z 2019-06-27T15:49:52Z CONTRIBUTOR

@fmaussion just a ping for what are your thoughts are for next steps on this?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implementation of CRS storage in rasterio with PROJ.4 & WKT 404088563
487059783 https://github.com/pydata/xarray/pull/2618#issuecomment-487059783 https://api.github.com/repos/pydata/xarray/issues/2618 MDEyOklzc3VlQ29tbWVudDQ4NzA1OTc4Mw== snowman2 8699967 2019-04-26T13:38:13Z 2019-04-26T13:38:13Z CONTRIBUTOR

Good question, I was thinking adding tests.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Adding mask to open_rasterio 392361367
487050467 https://github.com/pydata/xarray/pull/2618#issuecomment-487050467 https://api.github.com/repos/pydata/xarray/issues/2618 MDEyOklzc3VlQ29tbWVudDQ4NzA1MDQ2Nw== snowman2 8699967 2019-04-26T13:08:39Z 2019-04-26T13:08:39Z CONTRIBUTOR

I think it would be good to write the dataset to a netcdf, and read it back in with xarray.open_dataset to ensure everything encodes/decides properly.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Adding mask to open_rasterio 392361367
460428737 https://github.com/pydata/xarray/issues/2723#issuecomment-460428737 https://api.github.com/repos/pydata/xarray/issues/2723 MDEyOklzc3VlQ29tbWVudDQ2MDQyODczNw== snowman2 8699967 2019-02-04T21:55:16Z 2019-02-04T21:55:16Z CONTRIBUTOR

I definitely agree 💯 with you on avoiding redundancy. I actually had the same thought. However, part of the reason for using crs_wkt is motivated by CF 1.7 convention. I figured it was a small change that sacrifices redundancy for consistency across the community. The crs_proj4 name was just an attempt to be consistent with your original comment and the crs_wkt. But, I think renaming it to proj4 to remove redundancy is a good choice as well.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implementation of CRS storage in rasterio with PROJ.4 & WKT 404088563
458669281 https://github.com/pydata/xarray/issues/2723#issuecomment-458669281 https://api.github.com/repos/pydata/xarray/issues/2723 MDEyOklzc3VlQ29tbWVudDQ1ODY2OTI4MQ== snowman2 8699967 2019-01-29T19:14:49Z 2019-01-29T19:14:49Z CONTRIBUTOR

Tag: @fmaussion @djhoese

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implementation of CRS storage in rasterio with PROJ.4 & WKT 404088563
458332803 https://github.com/pydata/xarray/issues/2722#issuecomment-458332803 https://api.github.com/repos/pydata/xarray/issues/2722 MDEyOklzc3VlQ29tbWVudDQ1ODMzMjgwMw== snowman2 8699967 2019-01-28T22:45:52Z 2019-01-28T22:45:52Z CONTRIBUTOR

Since the main discussion is resolved, I will close this issue to prevent spam. I will open another issue for implementation details later.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  [discussion] Use WKT or PROJ.4 string for CRS representation? 403971686
458322962 https://github.com/pydata/xarray/issues/2722#issuecomment-458322962 https://api.github.com/repos/pydata/xarray/issues/2722 MDEyOklzc3VlQ29tbWVudDQ1ODMyMjk2Mg== snowman2 8699967 2019-01-28T22:13:26Z 2019-01-28T22:13:26Z CONTRIBUTOR

Sounds like a good path forward to me.

Since the crs attribute will be deprecated, thoughts on replacing it with a crs coordinate and the PROJ.4 and WKT representations in the coordinate attributes?

Something like: <xarray.DataArray 'crs' ()> array(0) Coordinates: crs int64 0 Attributes: crs_wkt: PROJCS["UTM Zone 15, Northern Hemisphere",GEOGCS["WGS 84",D... crs_proj4: +proj=...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  [discussion] Use WKT or PROJ.4 string for CRS representation? 403971686
448628008 https://github.com/pydata/xarray/pull/2618#issuecomment-448628008 https://api.github.com/repos/pydata/xarray/issues/2618 MDEyOklzc3VlQ29tbWVudDQ0ODYyODAwOA== snowman2 8699967 2018-12-19T15:08:34Z 2018-12-19T15:09:01Z CONTRIBUTOR

I think the solution would be to add a masked argument and property to the class RasterioArrayWrapper here.

And pass in the (masked=masked) argument here

That would pass riods.read( ..., masked=self.masked) when reading data from rasterio here

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Adding mask to open_rasterio 392361367
448402521 https://github.com/pydata/xarray/pull/2618#issuecomment-448402521 https://api.github.com/repos/pydata/xarray/issues/2618 MDEyOklzc3VlQ29tbWVudDQ0ODQwMjUyMQ== snowman2 8699967 2018-12-18T22:54:44Z 2018-12-18T22:54:44Z CONTRIBUTOR

@jsignell, this looks like it would work - I like the implementation. Some things I would recommend to add is checks for when the nodata value varies across bands (maybe skip the mask and raise a warning) and when the nodata value is already NaN. Also, you should probably set the nodatavals to NaN if masked to resemble the behavior of xarray elsewhere.

I think @fmaussion would be a good reviewer for this PR.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Adding mask to open_rasterio 392361367
447903844 https://github.com/pydata/xarray/issues/1736#issuecomment-447903844 https://api.github.com/repos/pydata/xarray/issues/1736 MDEyOklzc3VlQ29tbWVudDQ0NzkwMzg0NA== snowman2 8699967 2018-12-17T16:19:45Z 2018-12-17T16:19:45Z CONTRIBUTOR

It would definitely be a fantastic feature to have. Some discussion happened in #2308 to discuss standardizing methods for storing data that would definitely assist with this, however it did not seem like a priority at the time. Definitely feel free to share your opinion and use cases.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Rasterio missing _FillValue in DataArray 276131376
428177967 https://github.com/pydata/xarray/issues/2308#issuecomment-428177967 https://api.github.com/repos/pydata/xarray/issues/2308 MDEyOklzc3VlQ29tbWVudDQyODE3Nzk2Nw== snowman2 8699967 2018-10-09T12:46:54Z 2018-10-09T12:46:54Z CONTRIBUTOR

Feel free to re-open if this becomes something of interest. Thanks!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Proposal: Update rasterio backend to store CRS/nodata information in standard locations. 344058811
415849716 https://github.com/pydata/xarray/issues/2288#issuecomment-415849716 https://api.github.com/repos/pydata/xarray/issues/2288 MDEyOklzc3VlQ29tbWVudDQxNTg0OTcxNg== snowman2 8699967 2018-08-24T18:50:44Z 2018-08-24T18:50:44Z CONTRIBUTOR

I was thinking just a "simple" library with a CRS object with utilities to create the object from WKT, PROJ.4, CF projection parameters, etc... And could take the object and convert it to any of the other formats. I wouldn't add any transform/resampling code and instead be a codebase that can be used by libraries that do those things. This way it would be useful to many different projects (geoxarray, pyresample, cartopy, metpy, ...). Thoughts?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add CRS/projection information to xarray objects 341331807
415842467 https://github.com/pydata/xarray/issues/2288#issuecomment-415842467 https://api.github.com/repos/pydata/xarray/issues/2288 MDEyOklzc3VlQ29tbWVudDQxNTg0MjQ2Nw== snowman2 8699967 2018-08-24T18:23:57Z 2018-08-24T18:23:57Z CONTRIBUTOR

Sounds good 👍. I see the CRS code potentially being useful outside of geoxarray. What are your thoughts on moving the CRS specific code into its own package?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add CRS/projection information to xarray objects 341331807
409566229 https://github.com/pydata/xarray/issues/2288#issuecomment-409566229 https://api.github.com/repos/pydata/xarray/issues/2288 MDEyOklzc3VlQ29tbWVudDQwOTU2NjIyOQ== snowman2 8699967 2018-08-01T13:00:26Z 2018-08-01T13:00:26Z CONTRIBUTOR

Lots of good thoughts there.

I think a lot depends on who you plan on having for a user base. I like rasterio.crs.CRS, but it does require GDAL. I know GDAL is a heavy dependency (solves runtime problems and it a source of installation problems), but if your users are already using it, then it isn't too big of an ask. If not, you could look into something like pycrs. But, it looks like it hasn't been touched for a while (never a good sign). Or, there are other options, (requiring a more work & maintenance) such as re-creating the rasterio.crs.CRS object and using cython with a copy of only the spatial reference code from GDAL in the repo (might be better to create your own repo/package if you head in this direction). Or maybe someone could ask really nicely for the GDAL maintainers to consider making the spatial reference code a package on it's own (not likely, but would be really nice).

My preference to have the CRS object something created/retrieved by the accessor based on information in the file. If it is not, users will have to remove the CRS object when using to_netcdf() as the object will not be serializable and to_netcdf() will throw errors. I think allowing the user to set the CRS on the file (by adding the crs to .coords and grid_mapping to data_vars) by passing in a valid projection string (WKT, proj.4) geo.set_crs() would be a good idea. This way, when the user calls, to_netcdf() it will happily do what they want. In addition, the CRS will still be available later with the accessor when loading in with xr.open_dataset.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add CRS/projection information to xarray objects 341331807
407862762 https://github.com/pydata/xarray/issues/2308#issuecomment-407862762 https://api.github.com/repos/pydata/xarray/issues/2308 MDEyOklzc3VlQ29tbWVudDQwNzg2Mjc2Mg== snowman2 8699967 2018-07-25T19:07:27Z 2018-07-25T19:07:27Z CONTRIBUTOR

@fmaussion, I guess the main reason for the proposed change is to be able to read in the raster using open_rasterio() and be able to generate a netCDF using to_netcdf() that would be compatible with the rasterio model when using rasterio.open().

Also, since: "xarray.Dataset is an in-memory representation of a netCDF file", to me it makes more sense to store the data in a standard netCDF location that is consistent regardless of the backend. In doing so, other parts of xarray and libraries build off of xarray won't be required to find the same data in multiple locations.

Thanks for taking the time to consider this idea. I have used it quite a bit and it has made the datasets compatible across the various GIS tools I use (rasterio, GDAL, QGIS). It has definitely made my life easier and so I wanted to share what I have learned. But, it is just an idea. I really appreciate the work of the xarray developers and whatever y'all decide is fine with me.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Proposal: Update rasterio backend to store CRS/nodata information in standard locations. 344058811
407857617 https://github.com/pydata/xarray/issues/2288#issuecomment-407857617 https://api.github.com/repos/pydata/xarray/issues/2288 MDEyOklzc3VlQ29tbWVudDQwNzg1NzYxNw== snowman2 8699967 2018-07-25T18:49:57Z 2018-07-25T18:49:57Z CONTRIBUTOR

The example I gave was just demonstrating that the dimension is not required for the crs coordinate variable.

I agree with the functionality that would support standardizing the crs as a coordinate variable on load for the case you specified. That way, the read in file will always behave the same and writing to netCDF it would be output correctly.

This all sounds like it is heading in a good direction. 👍

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add CRS/projection information to xarray objects 341331807
407748105 https://github.com/pydata/xarray/issues/2288#issuecomment-407748105 https://api.github.com/repos/pydata/xarray/issues/2288 MDEyOklzc3VlQ29tbWVudDQwNzc0ODEwNQ== snowman2 8699967 2018-07-25T13:08:25Z 2018-07-25T13:08:25Z CONTRIBUTOR

It is not in the dimension, it is the coordinate attribute in the variable. That is handled automatically by xarray when writing to_netcdf if you add the crs to the coords.

From the ncdump: ``` dimensions: x = 65 ; y = 31 ; variables: double x(x) ; x:_FillValue = NaN ; x:long_name = "x coordinate of projection" ; x:standard_name = "projection_x_coordinate" ; x:units = "m" ; double y(y) ; y:_FillValue = NaN ; y:long_name = "y coordinate of projection" ; y:standard_name = "projection_y_coordinate" ; y:units = "m" ; int64 time ; time:units = "seconds since 2015-04-03T17:55:19" ; time:calendar = "proleptic_gregorian" ; int64 spatial_ref ; spatial_ref:spatial_ref = "PROJCS[\"UTM Zone 15, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-93],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]" ; double ndvi(y, x) ; ndvi:_FillValue = NaN ; ndvi:grid_mapping = "spatial_ref" ; ndvi:coordinates = "spatial_ref time" ;

// global attributes: :creation_date = "2018-04-11 13:14:55.401183" ; ```

It would definitely be a good idea to ensure that the crs variable is a coordinate, so I agree that having support for that would be a good idea.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add CRS/projection information to xarray objects 341331807
407614809 https://github.com/pydata/xarray/issues/2288#issuecomment-407614809 https://api.github.com/repos/pydata/xarray/issues/2288 MDEyOklzc3VlQ29tbWVudDQwNzYxNDgwOQ== snowman2 8699967 2018-07-25T02:39:34Z 2018-07-25T02:39:34Z CONTRIBUTOR

That is interesting, I am definitely not an expert with non-uniform datasets. From the satellite datasets I have used, the 2D latitude and longitude coordinates are stored in the datasets and are not super useful. I usually have to use other ways to recreate the grid coordinates in the original projection (ex. SMAP uses the EASE Grid 2.0 but it stores the latitude/longitude of the points in the file) or reproject & flatten the coordinates. I have had to do this with weather data and made an xarray extension pangaea to handle it. So, that is what I was referring to when I misunderstood your question.

For your example of adding a crs attribute, ...

The files I have created have the crs coordinate variable inside the netCDF file already and it is always there when I load it in with xarray.open_dataset(). The method set_crs() could be used to add the crs coordinate variable and grid_mapping attributes to the dataset in the proper way so that it would be there on xarray.open_dataset() after dumping it to the file with to_netcdf().

The CF stuff is supported by rasterio, GDAL, QGIS and that is why I like it. If there is another way that is as well supported, I am not opposed to it.

In your example of methods is to_projection a remapping/resampling operation? If not, how does it differ from set_crs?

The to_projection() method would be a reproject/resampling operation.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add CRS/projection information to xarray objects 341331807
407610465 https://github.com/pydata/xarray/issues/2308#issuecomment-407610465 https://api.github.com/repos/pydata/xarray/issues/2308 MDEyOklzc3VlQ29tbWVudDQwNzYxMDQ2NQ== snowman2 8699967 2018-07-25T02:12:16Z 2018-07-25T02:12:16Z CONTRIBUTOR

That is strange. Was the variable put in data_vars and not in coords?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Proposal: Update rasterio backend to store CRS/nodata information in standard locations. 344058811
407546587 https://github.com/pydata/xarray/issues/2288#issuecomment-407546587 https://api.github.com/repos/pydata/xarray/issues/2288 MDEyOklzc3VlQ29tbWVudDQwNzU0NjU4Nw== snowman2 8699967 2018-07-24T20:47:23Z 2018-07-24T20:48:17Z CONTRIBUTOR

In your own projects and use of raster-like data, do you ever deal with non-uniform/non-projected data?

I have dealt with non-uniform data in the geographic projection. I have found it easiest to deal with it if you can determine the original projection and project the coordinates back to that projection so it is uniform. But, I am by no means an expert in this arena. Most if the time I work "normal" data.

How do you prefer to handle/store individual lon/lat values for each pixel?

rasterio/GDAL/QGIS all seem to use the centroid.

Also it looks like xarray would have to be updated to add the "crs" coordinate since currently it is not considered a coordinate variable. So a new library may need to have custom to_netcdf/open_dataset methods, right?

Actually, it is not difficult to add as it stands: python ds.coords['crs'] = 0 ds.coords['crs'].attrs = dict(spatial_ref="PROJCS["UTM Zone 15, Northern Hemisphere",GEOGCS["WGS 84",D...") But, if a crs does not already exist on the dataset, I guess that a function that adds the crs properly would be useful so it can also add the grid_mapping to all of the variables.

Example: python ds.geo.set_crs("+init=epsg:4326")

I think that minor modifications will be needed once the crs is set properly on the xarray dataset. Because after that, the to_netcdf() will automatically produce georeferenced datasets.

I could see the first pass of the extension/library simply performing: 1. ds.geo.crs 2. ds.geo.set_crs() 3. ds.geo.to_projection()

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add CRS/projection information to xarray objects 341331807
407541054 https://github.com/pydata/xarray/issues/2308#issuecomment-407541054 https://api.github.com/repos/pydata/xarray/issues/2308 MDEyOklzc3VlQ29tbWVudDQwNzU0MTA1NA== snowman2 8699967 2018-07-24T20:28:28Z 2018-07-24T20:28:28Z CONTRIBUTOR

I don't think so. The crs should already exist on the dataset beforehand and I think it may be a bit too much to expect it to add it to the dataset in that function as there are some that don't have it and not all xarray datasets are geospatially located.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Proposal: Update rasterio backend to store CRS/nodata information in standard locations. 344058811
407404131 https://github.com/pydata/xarray/issues/2288#issuecomment-407404131 https://api.github.com/repos/pydata/xarray/issues/2288 MDEyOklzc3VlQ29tbWVudDQwNzQwNDEzMQ== snowman2 8699967 2018-07-24T13:21:31Z 2018-07-24T13:32:42Z CONTRIBUTOR

Here is an example of how it would look on a dataset: <xarray.Dataset> Dimensions: (x: 65, y: 31) Coordinates: * x (x) float64 ... * y (y) float64 ... time datetime64[ns] ... crs int64 ... Data variables: ndvi (y, x) float64 ... Attributes: Here is how the crs or spatial_ref coodinate variable would look: <xarray.DataArray 'crs' ()> array(0) Coordinates: time datetime64[ns] ... crs int64 0 Attributes: spatial_ref: PROJCS["UTM Zone 15, Northern Hemisphere",GEOGCS["WGS 84",D... And here is how it would look on the variables: <xarray.DataArray 'ndvi' (y: 31, x: 65)> array([[ ...]]) Coordinates: * x (x) float64 ... * y (y) float64 ... time datetime64[ns] ... crs int64 0 Attributes: grid_mapping: crs

@djhoese Whether or not we use the CF convention is not what I am concerned about. What I think would benefit the most people is with the file format to be able to do to_netcdf() with the file and be able to have it read in with standard GIS tools such as rasterio, GDAL, and QGIS. With this schema, this is possible.

Another benefit is that it keeps the crs or spatial_ref with it when you do your operations as it is a coordinate of the variable.

Also, as a side note if you use the center pixel coordinates, then GDAL, rasterio, and QGIS are able to read in the file and determine it's affine/transform without a problem.

For the new library, if you have a crs method attached to it, it isn't too difficult to convert it to whatever format you need it to be in. With the rasterio.crs.CRS.from_string you can "Make a CRS from an EPSG, PROJ, or WKT string" and you can also get back the EPSG, PROJ, or WKT string with a simple method call.

For example, using the recommended method to extend xarray, you could add a crs property:

python from rasterio.crs import CRS ........ @property def crs(self): """:obj:`rasterio.crs.CRS`: Projection from `xarray.DataArray` """ if self._crs is not None: return self._crs try: # look in grid_mapping self._crs = CRS.from_string(self._obj.coords[self._obj.grid_mapping].spatial_ref) except AttributeError: raise ValueError("Spatial reference not found.") return self._crs

And if you call your extension geo, all you would need to get the CRS would be: python ds.geo.crs To get proj.4 string: python ds.geo.crs.to_string() To get WKT string: python ds.geo.crs.wkt To get EPSG code: python ds.geo.crs.to_epsg()

{
    "total_count": 4,
    "+1": 4,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add CRS/projection information to xarray objects 341331807
407249087 https://github.com/pydata/xarray/issues/2288#issuecomment-407249087 https://api.github.com/repos/pydata/xarray/issues/2288 MDEyOklzc3VlQ29tbWVudDQwNzI0OTA4Nw== snowman2 8699967 2018-07-24T01:19:26Z 2018-07-24T01:19:26Z CONTRIBUTOR

I am really excited about this discussion. I know of other libraries that have done the same thing and have written internal libraries myself.

If possible, I would hope that we could follow the CF convention on this as it makes the output netCDF file compatible with QGIS, GDAL, and rasterio when written using to_netcdf()

To do so, you add the crs coordinate to the dataset/dataarray. int crs; And then, you add the spatial_ref attribute to the crs which is a crs WKT string.

Next, you add the grid_mapping attribute to all associated variables that contains crs as the grid_mapping.

See an example here.

After that, you could store all kinds of information inside the crs variable such as the proj4 string, the affine, etc.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add CRS/projection information to xarray objects 341331807
358807759 https://github.com/pydata/xarray/pull/1740#issuecomment-358807759 https://api.github.com/repos/pydata/xarray/issues/1740 MDEyOklzc3VlQ29tbWVudDM1ODgwNzc1OQ== snowman2 8699967 2018-01-18T22:49:23Z 2018-01-18T22:49:23Z CONTRIBUTOR

Indeed, it would be nice to refactor the tests to use pytest functions so we can use fixtures and the pytest.mark.parametrize to reduce duplication.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  rasterio backend: added nodatavals attribute 276246800
351590950 https://github.com/pydata/xarray/issues/1754#issuecomment-351590950 https://api.github.com/repos/pydata/xarray/issues/1754 MDEyOklzc3VlQ29tbWVudDM1MTU5MDk1MA== snowman2 8699967 2017-12-14T02:37:19Z 2017-12-14T02:37:19Z CONTRIBUTOR

I second this request. I have had this same need before where I don't always know what variables I don't want, but I do know the variables that I do want.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Opposite of `drop_variables` option in `open_dataset()` 278389733
351247577 https://github.com/pydata/xarray/pull/1712#issuecomment-351247577 https://api.github.com/repos/pydata/xarray/issues/1712 MDEyOklzc3VlQ29tbWVudDM1MTI0NzU3Nw== snowman2 8699967 2017-12-13T01:06:14Z 2017-12-13T01:06:14Z CONTRIBUTOR

Would it be possible to put the coordinate generation into a separate function? It would be nice to pass in the affine, width, height, and is_2d as args and get back the spatial coordinates.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Use rasterio's transform instead of homemade coordinates  273268690
346513920 https://github.com/pydata/xarray/issues/1736#issuecomment-346513920 https://api.github.com/repos/pydata/xarray/issues/1736 MDEyOklzc3VlQ29tbWVudDM0NjUxMzkyMA== snowman2 8699967 2017-11-23T01:23:54Z 2017-11-23T01:24:11Z CONTRIBUTOR

One thought I had was that there could be a similar parameter to mask_and_scale added that could be just called mask so open_rasterio behaves similarly to the open_dataset api. The mask parameter can allow the user to decide if they want to convert to float to get a mask or leave it alone if they want to preserve the integer data.

I would vote for adding the _FillValue attribute as it conforms with the CF conventions and it will make the dataset work better with other software looking for this value if you write it out with to_netcdf().

Also, on a similar vein, it would be nice to break out the bands into separate variables if it is a multi-band raster. This way, each band can store it's own nodata value and metadata separately in the dataset.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Rasterio missing _FillValue in DataArray 276131376
314167150 https://github.com/pydata/xarray/issues/1474#issuecomment-314167150 https://api.github.com/repos/pydata/xarray/issues/1474 MDEyOklzc3VlQ29tbWVudDMxNDE2NzE1MA== snowman2 8699967 2017-07-10T16:53:25Z 2017-07-10T16:53:25Z CONTRIBUTOR

@fmaussion, thanks again for your time!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selecting time with different variable and dimensions names 241714748
314162736 https://github.com/pydata/xarray/issues/1474#issuecomment-314162736 https://api.github.com/repos/pydata/xarray/issues/1474 MDEyOklzc3VlQ29tbWVudDMxNDE2MjczNg== snowman2 8699967 2017-07-10T16:38:39Z 2017-07-10T16:38:39Z CONTRIBUTOR

Which is what I think you do in salem.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selecting time with different variable and dimensions names 241714748
314162500 https://github.com/pydata/xarray/issues/1474#issuecomment-314162500 https://api.github.com/repos/pydata/xarray/issues/1474 MDEyOklzc3VlQ29tbWVudDMxNDE2MjUwMA== snowman2 8699967 2017-07-10T16:37:56Z 2017-07-10T16:37:56Z CONTRIBUTOR

Oh, and to make the time slice work for WRF, I had to make the time variables consistent: python xds.rename( { time_dim: 'time', time_var: 'time', }, inplace=True )

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selecting time with different variable and dimensions names 241714748
314162219 https://github.com/pydata/xarray/issues/1474#issuecomment-314162219 https://api.github.com/repos/pydata/xarray/issues/1474 MDEyOklzc3VlQ29tbWVudDMxNDE2MjIxOQ== snowman2 8699967 2017-07-10T16:36:53Z 2017-07-10T16:36:53Z CONTRIBUTOR

OK. That is good to know. In this case, I don't know the name if the dimension beforehand, so I thought it might be preferable to do:

python data = data.loc[{self.lsm_time_dim: [pd.to_datetime(time_step)]}] instead of: python data = data.sel(**{self.lsm_time_dim: [pd.to_datetime(time_step)]}) What are your thoughts?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selecting time with different variable and dimensions names 241714748
314159012 https://github.com/pydata/xarray/issues/1474#issuecomment-314159012 https://api.github.com/repos/pydata/xarray/issues/1474 MDEyOklzc3VlQ29tbWVudDMxNDE1OTAxMg== snowman2 8699967 2017-07-10T16:25:20Z 2017-07-10T16:25:20Z CONTRIBUTOR

OK. I feel silly now. I thought I should have been using loc[] Thanks @fmaussion for that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selecting time with different variable and dimensions names 241714748
314151625 https://github.com/pydata/xarray/issues/1474#issuecomment-314151625 https://api.github.com/repos/pydata/xarray/issues/1474 MDEyOklzc3VlQ29tbWVudDMxNDE1MTYyNQ== snowman2 8699967 2017-07-10T16:00:11Z 2017-07-10T16:02:35Z CONTRIBUTOR

I am having the same issue with a completely different grid: <xarray.DataArray 'sp' (time: 72, latitude: 5, longitude: 4)> dask.array<getitem, shape=(72, 5, 4), dtype=float64, chunksize=(24, 5, 4)> Coordinates: * longitude (longitude) float32 248.0 248.25 248.5 248.75 * latitude (latitude) float32 40.75 40.5 40.25 40.0 39.75 * time (time) datetime64[ns] 2016-01-02 2016-01-02T01:00:00 ... Attributes: units: Pa long_name: Surface pressure standard_name: surface_air_pressure Error: ``` self = DatetimeIndex(['2016-01-02 00:00:00', '2016-01-02 01:00:00', '2016-01-02 02:00:00', '2016-01-02 03:00:0...:00:00', '2016-01-04 22:00:00', '2016-01-04 23:00:00'], dtype='datetime64[ns]', freq=None) key = array(Timestamp('2016-01-02 00:00:00'), dtype=object)

def __getitem__(self, key):
    """
        This getitem defers to the underlying array, which by-definition can
        only handle list-likes, slices, and integer scalars
        """

    is_int = is_integer(key)
    if is_scalar(key) and not is_int:
        raise ValueError

    getitem = self._data.__getitem__
    if is_int:
        val = getitem(key)
        return self._box_func(val)
    else:
        if com.is_bool_indexer(key):
            key = np.asarray(key)
            if key.all():
                key = slice(0, None, None)
            else:
                key = lib.maybe_booleans_to_slice(key.view(np.uint8))

        attribs = self._get_attributes_dict()

        is_period = isinstance(self, ABCPeriodIndex)
        if is_period:
            freq = self.freq
        else:
            freq = None
            if isinstance(key, slice):
                if self.freq is not None and key.step is not None:
                    freq = key.step * self.freq
                else:
                    freq = self.freq

        attribs['freq'] = freq
      result = getitem(key)

E IndexError: arrays used as indices must be of integer (or boolean) type

../../../tethys/miniconda/envs/gssha/lib/python3.6/site-packages/pandas/core/indexes/datetimelike.py:296: IndexError ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selecting time with different variable and dimensions names 241714748
306657305 https://github.com/pydata/xarray/issues/1442#issuecomment-306657305 https://api.github.com/repos/pydata/xarray/issues/1442 MDEyOklzc3VlQ29tbWVudDMwNjY1NzMwNQ== snowman2 8699967 2017-06-07T01:11:21Z 2017-06-07T01:11:21Z CONTRIBUTOR

I just did. Thanks!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Pangaea 233744905
304077718 https://github.com/pydata/xarray/issues/688#issuecomment-304077718 https://api.github.com/repos/pydata/xarray/issues/688 MDEyOklzc3VlQ29tbWVudDMwNDA3NzcxOA== snowman2 8699967 2017-05-25T17:55:15Z 2017-05-25T17:55:15Z CONTRIBUTOR

Strange. But I can't seem to re-produce the issue. Maybe it was on a Windows machine or maybe it is fixed now.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Keep attrs & Add a 'keep_coords' argument to Dataset.apply 124154674
304003816 https://github.com/pydata/xarray/issues/688#issuecomment-304003816 https://api.github.com/repos/pydata/xarray/issues/688 MDEyOklzc3VlQ29tbWVudDMwNDAwMzgxNg== snowman2 8699967 2017-05-25T12:57:34Z 2017-05-25T12:57:34Z CONTRIBUTOR

@shoyer, thanks for looking into it. I am resampling from 3hr data to 1hr data.

python resampled_ds = ds.resample('1H', dim='time', keep_attrs=True)

I am using it here: https://github.com/CI-WATER/gsshapy/blob/f4e5cb13c1d528021e1953859b712553a4162311/gsshapy/grid/grid_to_gssha.py#L789-L844

I ran into the issue there and had to add code to make sure the coordinates were copied.

Thanks!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Keep attrs & Add a 'keep_coords' argument to Dataset.apply 124154674
298744168 https://github.com/pydata/xarray/issues/1395#issuecomment-298744168 https://api.github.com/repos/pydata/xarray/issues/1395 MDEyOklzc3VlQ29tbWVudDI5ODc0NDE2OA== snowman2 8699967 2017-05-02T19:59:32Z 2017-05-02T19:59:32Z CONTRIBUTOR

I did a $ ncdump -v time file.nc And I got: ``` ... float time(time) ; time:units = "minutes since 2011-03-05 03:00:00" ; time:long_name = "time" ; time:time_increment = "10800" ; time:begin_date = "20110305" ; time:begin_time = "030000" ; ... data:

time = _ ; } ```

So, it looks like a bad file ...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Time conversion overflow with minutes 225757620

Next page

Advanced export

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

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 22.913ms · About: xarray-datasette