Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Created February 11, 2025 06:32
Show Gist options
  • Save mdsumner/34ca31fd5dc2d562e33f5e5b48f5c6e9 to your computer and use it in GitHub Desktop.
Save mdsumner/34ca31fd5dc2d562e33f5e5b48f5c6e9 to your computer and use it in GitHub Desktop.

Crop out NZ from COP30 or GEBCO:

export dsn=/vsicurl/https://opentopography.s3.sdsc.edu/raster/COP30/COP30_hh.vrt
gdalwarp $dsn nz.tif -te 165 -51 180 -33 -ts 1024 0 out.tif

if you want bathymetry as well use GEBCO (will also be a lot quicker, so maybe this and then mask, see gdal_calc.py in linux)

export dsn=/vsicurl/https://gebco2023.s3.valeria.science/gebco_2023_land_cog.tif
gdalwarp $dsn gebco.tif  -te 165 -51 180 -33 -ts 1024 0

gdal_calc.py -A gebco.tif --outfile=result.tif --calc="A*logical(A>0,A<1e6)"

result.tif

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment