xarray-spatial0.4.0
Published
xarray-based spatial analysis tools
pip install xarray-spatial
Package Downloads
Authors
Project URLs
Requires Python
>=3.8
Dependencies
- datashader
>=0.15.0
- numba
- xarray
- numpy
- dask
[dataframe]; extra == "doc"
- geopandas
; extra == "doc"
- Jinja2
>=2.11; extra == "doc"
- ipykernel
; extra == "doc"
- matplotlib
; extra == "doc"
- nbsphinx
; extra == "doc"
- numpydoc
; extra == "doc"
- pandoc
; extra == "doc"
- pydata-sphinx-theme
; extra == "doc"
- sphinx
; extra == "doc"
- sphinx-panels
; extra == "doc"
- sphinx-rtd-theme
; extra == "doc"
- awkward
>=1.4; extra == "optional"
- geopandas
; extra == "optional"
- shapely
; extra == "optional"
- spatialpandas
; extra == "optional"
- rtxpy
; extra == "optional"
- flake8
; extra == "tests"
- isort
; extra == "tests"
- noise
>=1.2.2; extra == "tests"
- pytest
; extra == "tests"
- pytest-cov
; extra == "tests"
Latest Release |
| Downloads |
|
License | People | ||
Build Status | Coverage |
:round_pushpin: Fast, Accurate Python library for Raster Operations
:zap: Extensible with Numba
:fast_forward: Scalable with Dask
:confetti_ball: Free of GDAL / GEOS Dependencies
:earth_africa: General-Purpose Spatial Processing, Geared Towards GIS Professionals
Xarray-Spatial implements common raster analysis functions using Numba and provides an easy-to-install, easy-to-extend codebase for raster analysis.
Installation
# via pip
pip install xarray-spatial
# via conda
conda install -c conda-forge xarray-spatial
Downloading our starter examples and data
Once you have xarray-spatial installed in your environment, you can use one of the following in your terminal (with the environment active) to download our examples and/or sample data into your local directory.
xrspatial examples
: Download the examples notebooks and the data used.
xrspatial copy-examples
: Download the examples notebooks but not the data. Note: you won't be able to run many of the examples.
xrspatial fetch-data
: Download just the data and not the notebooks.
In all the above, the command will download and store the files into your current directory inside a folder named 'xrspatial-examples'.
xarray-spatial
grew out of the Datashader project, which provides fast rasterization of vector data (points, lines, polygons, meshes, and rasters) for use with xarray-spatial.
xarray-spatial
does not depend on GDAL / GEOS, which makes it fully extensible in Python but does limit the breadth of operations that can be covered. xarray-spatial is meant to include the core raster-analysis functions needed for GIS developers / analysts, implemented independently of the non-Python geo stack.
Our documentation is still under construction, but docs can be found here.
Raster-huh?
Rasters are regularly gridded datasets like GeoTIFFs, JPGs, and PNGs.
In the GIS world, rasters are used for representing continuous phenomena (e.g. elevation, rainfall, distance), either directly as numerical values, or as RGB images created for humans to view. Rasters typically have two spatial dimensions, but may have any number of other dimensions (time, type of measurement, etc.)
Supported Spatial Functions with Supported Inputs
Classification
Name | NumPy xr.DataArray | Dask xr.DataArray | CuPy GPU xr.DataArray | Dask GPU xr.DataArray |
---|---|---|---|---|
Equal Interval | ✅️ | ✅ | ✅ | ️ |
Natural Breaks | ✅️ | ️ | ||
Reclassify | ✅️ | ✅ | ✅ | ✅ |
Quantile | ✅️ | ✅ | ✅ | ️ |
Focal
Name | NumPy xr.DataArray | Dask xr.DataArray | CuPy GPU xr.DataArray | Dask GPU xr.DataArray |
---|---|---|---|---|
Apply | ✅️ | ✅️ | ||
Hotspots | ✅️ | ✅️ | ✅️ | |
Mean | ✅️ | ✅️ | ✅️ | |
Focal Statistics | ✅️ | ✅️ | ✅️ |
Multispectral
Name | NumPy xr.DataArray | Dask xr.DataArray | CuPy GPU xr.DataArray | Dask GPU xr.DataArray |
---|---|---|---|---|
Atmospherically Resistant Vegetation Index (ARVI) | ✅️ | ✅️ | ✅️ | ✅️ |
Enhanced Built-Up and Bareness Index (EBBI) | ✅️ | ✅️ | ✅️ | ✅️ |
Enhanced Vegetation Index (EVI) | ✅️ | ✅️ | ✅️ | ✅️ |
Green Chlorophyll Index (GCI) | ✅️ | ✅️ | ✅️ | ✅️ |
Normalized Burn Ratio (NBR) | ✅️ | ✅️ | ✅️ | ✅️ |
Normalized Burn Ratio 2 (NBR2) | ✅️ | ✅️ | ✅️ | ✅️ |
Normalized Difference Moisture Index (NDMI) | ✅️ | ✅️ | ✅️ | ✅️ |
Normalized Difference Vegetation Index (NDVI) | ✅️ | ✅️ | ✅️ | ✅️ |
Soil Adjusted Vegetation Index (SAVI) | ✅️ | ✅️ | ✅️ | ✅️ |
Structure Insensitive Pigment Index (SIPI) | ✅️ | ✅️ | ✅️ | ✅️ |
True Color | ✅️ | ️ | ✅️ | ️ |
Pathfinding
Name | NumPy xr.DataArray | Dask xr.DataArray | CuPy GPU xr.DataArray | Dask GPU xr.DataArray |
---|---|---|---|---|
A* Pathfinding | ✅️ |
Proximity
Name | NumPy xr.DataArray | Dask xr.DataArray | CuPy GPU xr.DataArray | Dask GPU xr.DataArray |
---|---|---|---|---|
Allocation | ✅️ | ✅ | ||
Direction | ✅️ | ✅ | ||
Proximity | ✅️ | ✅ |
Raster to vector
Name | NumPy xr.DataArray | Dask xr.DataArray | CuPy GPU xr.DataArray | Dask GPU xr.DataArray |
---|---|---|---|---|
Polygonize | ✅️ |
Surface
Name | NumPy xr.DataArray | Dask xr.DataArray | CuPy GPU xr.DataArray | Dask GPU xr.DataArray |
---|---|---|---|---|
Aspect | ✅️ | ✅️ | ✅️ | ⚠️ |
Curvature | ✅️ | ⚠️ | ||
Hillshade | ✅️ | ✅️ | ||
Slope | ✅️ | ✅️ | ✅️ | ⚠️ |
Terrain Generation | ✅️ | ✅️ | ✅️ | |
Viewshed | ✅️ | |||
Perlin Noise | ✅️ | ✅️ | ✅️ | |
Bump Mapping | ✅️ |
Zonal
Name | NumPy xr.DataArray | Dask xr.DataArray | CuPy GPU xr.DataArray | Dask GPU xr.DataArray |
---|---|---|---|---|
Apply | ✅️ | ✅️ | ||
Crop | ✅️ | |||
Regions | ||||
Trim |