Quick start#
Sample data#
xDEM comes with some sample data that is used throughout this documentation to demonstrate the features. If not done already, the sample data can be downloaded with the command
xdem.examples.download_longyearbyen_examples()
The dataset keys and paths can be found from
xdem.examples.available
Load DEMs and calculate elevation difference#
import xdem
# Load data
dem_2009 = xdem.DEM(xdem.examples.get_path("longyearbyen_ref_dem"))
dem_1990 = xdem.DEM(xdem.examples.get_path("longyearbyen_tba_dem_coreg"))
# Calculate the difference
ddem = dem_2009 - dem_1990
# Plot
ddem.show(cmap='coolwarm_r', vmin=-20, vmax=20, cb_title="Elevation change (m)")
# Save to file
ddem.save("temp.tif")
A detailed example on how to load raster data, reproject it to a different grid/projection, run simple arithmetic operations such as subtraction, plotting the data and saving to file can be found in the example gallery DEM subtraction.