Skip to content

DOC: Add rioxarray and other external examples #3757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ Using apply_ufunc
:maxdepth: 2

examples/apply_ufunc_vectorize_1d

External Examples
-----------------
.. toctree::
:maxdepth: 2

Managing raster data with rioxarray <https://corteva.github.io/rioxarray/stable/examples/examples.html>
Xarray with dask <https://examples.dask.org/xarray.html>
Xarray and dask on the cloud with Pangeo <http://pangeo.io/use_cases/index.html#use-cases>
46 changes: 45 additions & 1 deletion doc/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -759,9 +759,53 @@ for an example of how to convert these to longitudes and latitudes.
considered as being experimental. Please report any bug you may find
on xarray's github repository.


Additionally, you can use `rioxarray`_ for reading in GeoTiff, netCDF or other
GDAL readable raster data using `rasterio`_ as well as for exporting to a geoTIFF.
`rioxarray`_ can also handle geospatial related tasks such as re-projecting and clipping.

.. ipython::
:verbatim:

In [1]: import rioxarray

In [2]: rds = rioxarray.open_rasterio('RGB.byte.tif')

In [3]: rds
Out[3]:
<xarray.DataArray (band: 3, y: 718, x: 791)>
[1703814 values with dtype=uint8]
Coordinates:
* band (band) int64 1 2 3
* y (y) float64 2.827e+06 2.826e+06 ... 2.612e+06 2.612e+06
* x (x) float64 1.021e+05 1.024e+05 ... 3.389e+05 3.392e+05
spatial_ref int64 0
Attributes:
STATISTICS_MAXIMUM: 255
STATISTICS_MEAN: 29.947726688477
STATISTICS_MINIMUM: 0
STATISTICS_STDDEV: 52.340921626611
transform: (300.0379266750948, 0.0, 101985.0, 0.0, -300.0417827...
_FillValue: 0.0
scale_factor: 1.0
add_offset: 0.0
grid_mapping: spatial_ref

In [4]: rds.rio.crs
Out[4]: CRS.from_epsg(32618)

In [5]: rds4326 = rio.rio.reproject("epsg:4326")

In [6]: rds4326.rio.crs
Out[6]: CRS.from_epsg(4326)

In [7]: rds4326.rio.to_raster('RGB.byte.4326.tif')


.. _rasterio: https://rasterio.readthedocs.io/en/latest/
.. _rioxarray: https://corteva.github.io/rioxarray/stable/
.. _test files: https://github.com/mapbox/rasterio/blob/master/tests/data/RGB.byte.tif
.. _pyproj: https://github.com/jswhit/pyproj
.. _pyproj: https://github.com/pyproj4/pyproj

.. _io.zarr:

Expand Down