Skip to content
Snippets Groups Projects
Commit 3abc58ef authored by Simon Dreutter's avatar Simon Dreutter
Browse files

Fixed pole gap issue with gdal warp options

parent 12cc9373
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ print('============================================================') ...@@ -51,7 +51,7 @@ print('============================================================')
print(' GENERAL BATHYMETRIC CHART OF THE OCEANS / GEBCO ') print(' GENERAL BATHYMETRIC CHART OF THE OCEANS / GEBCO ')
msg = 'Resampling GEBCO...' msg = 'Resampling GEBCO...'
cmd = f'gdalwarp -s_srs {EPSG_WORLD} -t_srs {EPSG_WORLD} -tr {RESOLUTION_DEG} {RESOLUTION_DEG} -r cubic -of GTiff {GDAL_CREATE_OPTIONS} {GEBCO_IN} {GEBCO_WORLD}' cmd = f'gdalwarp -s_srs {EPSG_WORLD} -t_srs {EPSG_WORLD} -tr {RESOLUTION_DEG} {RESOLUTION_DEG} -r cubic -of GTiff {WARP_OPTIONS} {GDAL_CREATE_OPTIONS} {GEBCO_IN} {GEBCO_WORLD}'
run(msg,cmd) run(msg,cmd)
msg = 'Clipping GEBCO for the Arctic...' msg = 'Clipping GEBCO for the Arctic...'
...@@ -59,40 +59,24 @@ cmd = f'gdal_translate -projwin -180.0 90.0 180.0 {ARCTIC_EXTENT_LAT} -a_srs {EP ...@@ -59,40 +59,24 @@ cmd = f'gdal_translate -projwin -180.0 90.0 180.0 {ARCTIC_EXTENT_LAT} -a_srs {EP
run(msg,cmd) run(msg,cmd)
msg = 'Reprojecting GEBCO for the Arctic...' msg = 'Reprojecting GEBCO for the Arctic...'
cmd = f'gdalwarp -s_srs {EPSG_WORLD} -t_srs {EPSG_ARCTIC} -r near -of VRT {GEBCO_ARCTIC_CLIP_VRT} {GEBCO_ARCTIC_FULL_VRT}' cmd = f'gdalwarp -s_srs {EPSG_WORLD} -t_srs {EPSG_ARCTIC} -r near -of VRT {WARP_OPTIONS} {GEBCO_ARCTIC_CLIP_VRT} {GEBCO_ARCTIC_FULL_VRT}'
run(msg,cmd) run(msg,cmd)
msg = 'Resampling Arctic to target resolution...' msg = 'Resampling Arctic to target resolution...'
cmd = f'gdalwarp -s_srs {EPSG_ARCTIC} -t_srs {EPSG_ARCTIC} -tr {RESOLUTION_M} {RESOLUTION_M} -r cubic -of GTiff {GDAL_CREATE_OPTIONS} {GEBCO_ARCTIC_FULL_VRT} {TMP_POLAR}' cmd = f'gdalwarp -s_srs {EPSG_ARCTIC} -t_srs {EPSG_ARCTIC} -tr {RESOLUTION_M} {RESOLUTION_M} -r cubic -of GTiff {WARP_OPTIONS} {GDAL_CREATE_OPTIONS} {GEBCO_ARCTIC_FULL_VRT} {GEBCO_ARCTIC}'
#{GEBCO_ARCTIC}
run(msg,cmd) run(msg,cmd)
# TEMPORARY
msg = 'Filling North Pole gap...'
cmd = f'{PYTHON} -m gdal_fillnodata -md {interpolation} -b 1 -of GTiff {TMP_POLAR} {GEBCO_ARCTIC}'
run(msg,cmd)
cleanup(TMP_POLAR)
# /TEMPORARY
msg = 'Clipping GEBCO for the Antarctic...' msg = 'Clipping GEBCO for the Antarctic...'
cmd = f'gdal_translate -projwin -180.0 {ANTARCTIC_EXTENT_LAT} 180.0 -90.0 -a_srs {EPSG_WORLD} -of VRT {GEBCO_IN} {GEBCO_ANTARCTIC_CLIP_VRT}' cmd = f'gdal_translate -projwin -180.0 {ANTARCTIC_EXTENT_LAT} 180.0 -90.0 -a_srs {EPSG_WORLD} -of VRT {GEBCO_IN} {GEBCO_ANTARCTIC_CLIP_VRT}'
run(msg,cmd) run(msg,cmd)
msg = 'Reprojecting GEBCO for the Antarctic...' msg = 'Reprojecting GEBCO for the Antarctic...'
cmd = f'gdalwarp -s_srs {EPSG_WORLD} -t_srs {EPSG_ANTARCTIC} -r near -of VRT {GEBCO_ANTARCTIC_CLIP_VRT} {GEBCO_ANTARCTIC_FULL_VRT}' cmd = f'gdalwarp -s_srs {EPSG_WORLD} -t_srs {EPSG_ANTARCTIC} -r near -of VRT {WARP_OPTIONS} {GEBCO_ANTARCTIC_CLIP_VRT} {GEBCO_ANTARCTIC_FULL_VRT}'
run(msg,cmd) run(msg,cmd)
msg = 'Resampling Antarctic to target resolution...' msg = 'Resampling Antarctic to target resolution...'
cmd = f'gdalwarp -s_srs {EPSG_ANTARCTIC} -t_srs {EPSG_ANTARCTIC} -tr {RESOLUTION_M} {RESOLUTION_M} -r cubic -of GTiff {GDAL_CREATE_OPTIONS} {GEBCO_ANTARCTIC_FULL_VRT} {TMP_POLAR}' cmd = f'gdalwarp -s_srs {EPSG_ANTARCTIC} -t_srs {EPSG_ANTARCTIC} -tr {RESOLUTION_M} {RESOLUTION_M} -r cubic -of GTiff {WARP_OPTIONS} {GDAL_CREATE_OPTIONS} {GEBCO_ANTARCTIC_FULL_VRT} {GEBCO_ANTARCTIC}'
#{GEBCO_ANTARCTIC}
run(msg,cmd)
# TEMPORARY
msg = 'Filling South Pole gap...'
cmd = f'{PYTHON} -m gdal_fillnodata -md {interpolation} -b 1 -of GTiff {TMP_POLAR} {GEBCO_ANTARCTIC}'
run(msg,cmd) run(msg,cmd)
cleanup(TMP_POLAR)
# /TEMPORARY
cleanup(GEBCO_ARCTIC_CLIP_VRT) cleanup(GEBCO_ARCTIC_CLIP_VRT)
cleanup(GEBCO_ARCTIC_FULL_VRT) cleanup(GEBCO_ARCTIC_FULL_VRT)
......
...@@ -201,7 +201,6 @@ GEBCO_ANTARCTIC = os.path.join(PATH_GEBCO,'GEBCO_antarctic.tif') ...@@ -201,7 +201,6 @@ GEBCO_ANTARCTIC = os.path.join(PATH_GEBCO,'GEBCO_antarctic.tif')
GEBCO_ANTARCTIC_HILLSHADE = os.path.join(PATH_GEBCO,'GEBCO_antarctic_hillshade.tif') GEBCO_ANTARCTIC_HILLSHADE = os.path.join(PATH_GEBCO,'GEBCO_antarctic_hillshade.tif')
# temporary files # temporary files
TMP_POLAR = os.path.join(PATH_GEBCO,'tmp_polar.tif') # DEBUGGING
TMP_RGB = os.path.join(PATH_GEBCO,'tmp_rgb.tif') TMP_RGB = os.path.join(PATH_GEBCO,'tmp_rgb.tif')
TMP_SHADED = os.path.join(PATH_GEBCO,'tmp_shaded.tif') TMP_SHADED = os.path.join(PATH_GEBCO,'tmp_shaded.tif')
...@@ -264,6 +263,8 @@ GDAL_CREATE_OPTIONS = '-co COMPRESS=NONE -co BIGTIFF=IF_NEEDED' ...@@ -264,6 +263,8 @@ GDAL_CREATE_OPTIONS = '-co COMPRESS=NONE -co BIGTIFF=IF_NEEDED'
GDAL_CREATE_OPTIONS_PY = '--co COMPRESS=NONE --co BIGTIFF=IF_NEEDED' GDAL_CREATE_OPTIONS_PY = '--co COMPRESS=NONE --co BIGTIFF=IF_NEEDED'
#GDAL_CREATE_OPTIONS_PY = '--co COMPRESS=DEFLATE --co PREDICTOR=2 --co ZLEVEL=9 --co BIGTIFF=YES' #GDAL_CREATE_OPTIONS_PY = '--co COMPRESS=DEFLATE --co PREDICTOR=2 --co ZLEVEL=9 --co BIGTIFF=YES'
# GDAL warp options
WARP_OPTIONS = '-wo SOURCE_EXTRA=1000 -et 0'
#============================================================================= #=============================================================================
# RUN FUNCTION # RUN FUNCTION
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment