Skip to content

Instantly share code, notes, and snippets.

View cjtu's full-sized avatar

Christian J. Tai Udovicic cjtu

View GitHub Profile
@cjtu
cjtu / pool_tutorial.ipynb
Last active June 15, 2021 18:29
Swimming with snakes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cjtu
cjtu / unscale.md
Created June 26, 2025 00:08
Unscale an image with GDAL

Unscaling a DEM with GDAL (gdal_translate plus a VRT)

Some image data like the Moon SLDEMs from https://pgda.gsfc.nasa.gov/products/67 have scale factors applied for image compression. The slope images are supplied as Int format and the label states to multiply by scale of 0.0015 and offest of 45 to convert to slope in degrees.

Often this metadata is machine readable and applied automatically but in this case QGIS doesn't see it.

To manually attach the scale/offset with gdal we can make a VRT (a simple "virtual" image that doesn't copy the original but points to it and adds this metadata):

gdal_translate -a_scale 0.0015 -a_offset 45 SLDEM2015_64_SL_90S_90N_000_360.JP2 tmp.vrt