xcorduroy
Dask aware lightweight DEM utilities for Xarray
Documentation · Usage · Design · API
xcorduroy is a small Xarray accessor for computing hillshade, slope and aspect
from DEMs, with dask, numpy, xarray and xproj as its only dependencies.
Gradients use the Horn (1981) 3x3 kernel; aspect and hillshade follow the
ESRI/GDAL conventions (not numerically cross-checked against gdaldem). Chunked arrays are
handled with a dask halo, so lazy and in-memory results are identical.
Warning: experimental. APIs may change without notice.
Installation
uv add xcorduroy
# or
pip install xcorduroy
Example
import xarray as xr
import xproj # registers the .proj accessor
import xcorduroy # registers the .dem accessor
ds = xr.open_dataset("DEM.zarr", engine="zarr", chunks="auto")
ds = ds.proj.assign_crs(spatial_ref="EPSG:4326")
slope = ds["dem"].dem.slope() # degrees, 0-90
aspect = ds["dem"].dem.aspect() # degrees clockwise from north; flat cells NaN
hillshade = ds["dem"].dem.hillshade() # 0-1, light from azimuth 315 / altitude 45
A plotted, runnable version is in notebooks/DEM_example.ipynb. See
Usage for resolution=,
z_factor=, dimension naming and chunking, and
Design for the conventions
and the degree-to-metre approximation.
Scope
The methods are inspired by xdem and xarray-spatial. If you need
well-validated functions for scientific analysis, use one of those. This is a
limited-scope, lightweight take on a few of the methods, not a replacement.
Development
uv sync --all-groups
uv run pytest tests -n auto # tests
uv run ty check src/ # type check
uv run prek run --all-files # lint and format
uv run mkdocs serve # docs preview
See Contributing.
What's in the name
Corduroy is the textured snow surface left by groomers, regular peaks and valleys.
Metadata
Release files for xcorduroy 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xcorduroy-0.0.3.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xcorduroy-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.8 kB
Release files / xcorduroy-0.0.3.tar.gz
| Download URL | xcorduroy-0.0.3.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a87673c2b8a58f1292b66e36170d532944183ae22515d42f3c5382ec826c4bf
|
|
BLAKE2b-256 checksum How to use checksums |
e819cdc713586b6a564f9db85cc4172f70dd1b3bc716c51c4cfd323da9e3ff36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / xcorduroy-0.0.3-py3-none-any.whl
| Download URL | xcorduroy-0.0.3-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e70a4a7bd33eff6ee98f3ac286f350198f2f0d496fa35cc3c3b4bfc88289d0ed
|
|
BLAKE2b-256 checksum How to use checksums |
433d30fb975953b37366b6b96c77c022c15baddf99314a3e932c1cbbc77a6ac5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|