Skip to content

g-adopt/ausdem

Repository files navigation

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.

About

Fetch Australian DEM data from Geoscience Australia WCS services as xarray arrays

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages