Skip to content

Instantly share code, notes, and snippets.

@mpetroff
Created October 4, 2014 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpetroff/5fa4c374426daa6be476 to your computer and use it in GitHub Desktop.
Save mpetroff/5fa4c374426daa6be476 to your computer and use it in GitHub Desktop.
Convert marine gravity anomaly map to GeoTIFF
# Convert to NetCDF
img2grd grav.img.23.1 -Ggrav.nc -Rg
# Reencode since gdal didn't like NetCDF file
cdo -f nc4c -k lines copy grav.nc grav2.nc
# Create GeoTIFF
gdal_translate -a_srs EPSG:4326 grav2.nc grav.tif
# Reproject as EPSG:3857
gdalwarp -multi -wo SOURCE_EXTRA=100 -r cubic -t_srs EPSG:3857 grav.tif grav2.tif
# Convert from floating point to integer and compress
gdal_translate -scale -647 729 -ot byte -co COMPRESS=DEFLATE grav2.tif gravity.tif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment