Registry / data / xarray-spatial

xarray-spatial

JSON →
library0.10.10pypypi✓ verified 85d ago

xarray-based spatial analysis tools built on top of xarray, dask, and numba. Current version 0.9.7, released frequently (several minor versions per year).

pip install xarray-spatial
INSTALL
IMPORT
SIG · XARRAY-SPATIAL
X
xarray-spatial
datapythonv0.10.10
Install
18.0s avg
Import
3493ms
Disk
543MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
installs and imports cleanly · install 18.0s · import 3.493s · 526MB
543MB installed
● package 543MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

xrspatial
import xrspatial
from xarray_spatial import xrspatial
The library is imported as 'xrspatial', not as a submodule of xarray_spatial.
focal
from xrspatial import focal
hillshade
from xrspatial import hillshade

Import the library and compute a hillshade from an xarray DataArray.

import xarray as xr import xrspatial from xrspatial import hillshade # Create a sample elevation raster ds = xr.tutorial.load_dataset('air_temperature').isel(time=0) elevation = ds['air'] # Compute hillshade hs = hillshade(elevation) print(hs)
Debug
Known issues
gotchaThe top-level import is 'xrspatial', not 'xarray_spatial'. Many users mistakenly try 'import xarray_spatial as xrs' which fails.
fix
Use 'import xrspatial' and functions like 'from xrspatial import focal'.
affects: all
deprecatedAs of v0.9.0, many modules (e.g., zonal) now accept xarray DataArrays directly instead of requiring conversion to a specific format. Older code may break if not updated.
fix
Pass DataArray objects directly; avoid manual conversion to numpy arrays.
affects: >=0.9.0
gotchaIf you install without the 'complete' extra, some features like GeoTIFF I/O (via rioxarray) or GPU acceleration (via cupy) will not be available. Missing dependencies raise ImportError at runtime.
fix
Install with 'pip install xarray-spatial[complete]' or install missing extras individually.
affects: all
gotchaDask arrays can cause memory issues if not handled properly. Some functions (e.g., visibility) may silently convert dask arrays to numpy, leading to large memory usage.
fix
Use .compute() explicitly only when needed; for newer versions, use dask-backed operations.
affects: <0.9.7
breakingIn v0.9.0, the 'rasterize' function signature changed: the 'like' parameter now expects a DataArray with the same spatial reference. Old code using 'like' with a rasterio dataset may break.
fix
Pass an xarray DataArray with a crs attribute as the 'like' parameter.
affects: >=0.9.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'xarray_spatial'
Trying to import the wrong name. The correct top-level import is 'xrspatial'.
fix
Use 'import xrspatial' or 'from xrspatial import hillshade'.
ImportError: cannot import name 'hillshade' from 'xrspatial'
The function may have been moved or renamed. Check the version documentation.
fix
Ensure you have the correct version: 'pip install xarray-spatial[complete]' and import the correct module (e.g., 'from xrspatial import hillshade').
TypeError: 'DataArray' object is not callable
Trying to use a DataArray as a function. Common when mixing up xarray and numpy patterns.
fix
Ensure you call the function from xrspatial (e.g., 'hillshade(elevation)') not on the DataArray itself.
Upgrade
Version history
0.10.10latest on PyPI · released Jun 17, 2026
Audit
Dependencies
xarrayrequiredCore data structure
daskrequiredLazy computation and out-of-core
numbarequiredJIT compilation for performance
numpyrequiredArray operations
rioxarrayoptionalGeospatial raster I/O (GeoTIFF, COG)
pyprojoptionalCoordinate transformations
cupyoptionalGPU acceleration via CuPy
Agent activity
43 hits · last 30 days
node
36
OpenAI (training)
1
Resources
xarray-spatial — pip install xarray-spatial · libregistry