Skip to main content

Fetch Australian Digital Elevation Model (DEM) data from Geoscience Australia WCS services as xarray arrays.

Project description

ausdem

CI PyPI Python versions License: MIT

Fetch Australian Digital Elevation Model (DEM) data from Geoscience Australia straight into Python as georeferenced xarray arrays.

It talks to GA's public Web Coverage Services, asking only for the bounding box you want rather than downloading whole continental tiles. The data and services come from GA's Digital Elevation Data page.

Install

pip install ausdem

Requires requests, numpy, xarray, rioxarray and rasterio (pulled in automatically).

Usage

import ausdem

# A small area around Canberra (min_lon, min_lat, max_lon, max_lat)
dem = ausdem.get_dem((149.0, -35.4, 149.1, -35.3))

dem.plot()                       # it's a normal xarray DataArray
print(float(dem.max()))          # highest point in the box

ausdem.save_geotiff(dem, "canberra.tif")   # or: dem.rio.to_raster("canberra.tif")

The returned object is an xarray.DataArray with dimensions (y, x), a NaN no-data mask, and a .rio accessor (CRS, transform, to_raster). So you get the array for analysis and can drop it to a GeoTIFF whenever you like.

Choosing a dataset

ausdem.list_datasets()
# ['lidar_5m', 'srtm_1s_dem', 'srtm_1s_dem_h']

dem_h = ausdem.get_dem(bbox, dataset="srtm_1s_dem_h")   # hydro-enforced
lidar = ausdem.get_dem(bbox, dataset="lidar_5m")        # 5 m, where surveyed
key product resolution
srtm_1s_dem SRTM 1 Second DEM (bare earth), national ~30 m
srtm_1s_dem_h SRTM 1 Second DEM-H (hydro-enforced) ~30 m
lidar_5m LiDAR-derived 5 m DEM (surveyed areas) 5 m

The smoothed DEM-S product is not served over WCS; download it from the ELVIS portal. The LiDAR DEM only covers surveyed areas (coastal zone, Murray-Darling floodplains, population centres); requests outside coverage either come back as a no-data (NaN) tile or raise ausdem.WCSError, depending on the area.

Pass resolution= (in degrees) to resample, e.g. resolution=0.001 for a coarser, lighter grid.

Command line

ausdem 149.0 -35.4 149.1 -35.3 -o canberra.tif
ausdem 149.0 -35.4 149.1 -35.3 -o canberra_demh.tif -d srtm_1s_dem_h
ausdem --list

Notes

Coordinates are decimal degrees. SRTM products are served in WGS84 (EPSG:4326) and the LiDAR product in GDA94 (EPSG:4283); for input bounding boxes the two are interchangeable at this scale. Very large requests are rejected client-side to avoid pulling huge rasters by accident; tile your area or coarsen the resolution if you hit that.

Example

There is a small standalone script in examples/ that fetches a DEM and plots it:

python examples/plot_dem.py            # a box near Canberra, writes dem.png

Development

git clone https://github.com/g-adopt/ausdem
cd ausdem
pip install -e ".[dev]"
pytest -m "not network"      # offline tests
pytest                        # include the live GA WCS test

License

MIT, see LICENSE.

Citation

If you use ausdem in your work, please cite it. Release archives are deposited on Zenodo and a DOI will be added here after the first release; in the meantime see CITATION.cff.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ausdem-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ausdem-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file ausdem-0.1.0.tar.gz.

File metadata

  • Download URL: ausdem-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ausdem-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3b7b1c90e304bece8c193c5e2b49b26d8c0c1e00c3f0175174f321a755906aca
MD5 061e380ea8b0f240825026a4654164cb
BLAKE2b-256 00efffbec762a81879ea4683020ce50eff28c97d5d4da6c4d5413cc7fd05f3cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for ausdem-0.1.0.tar.gz:

Publisher: publish.yml on g-adopt/ausdem

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ausdem-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ausdem-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ausdem-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf357cba047a176ca186bb75212f01718a3524db8def551e047f66c9010ecb4c
MD5 2f02eda55486409056af1c3f6cb76e6f
BLAKE2b-256 0488d6ad3edf8df94b7f1fd6e62dfa11b35b99b8daf298bada7e69ae62c8cfd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ausdem-0.1.0-py3-none-any.whl:

Publisher: publish.yml on g-adopt/ausdem

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page