diff --git a/process/4_process_gebco.py b/process/4_process_gebco.py index b2696d79462adce2e7eee026465043bf1b0a9297..efadd0de7344945b69dd7cfbbcb2c364dbabe4d7 100644 --- a/process/4_process_gebco.py +++ b/process/4_process_gebco.py @@ -51,7 +51,7 @@ print('============================================================') print(' GENERAL BATHYMETRIC CHART OF THE OCEANS / 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) 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 run(msg,cmd) 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) 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}' -#{GEBCO_ARCTIC} +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}' 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...' 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) 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) 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}' -#{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}' +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}' run(msg,cmd) -cleanup(TMP_POLAR) -# /TEMPORARY cleanup(GEBCO_ARCTIC_CLIP_VRT) cleanup(GEBCO_ARCTIC_FULL_VRT) diff --git a/process/config.py b/process/config.py index 1d9928ef6ab37ad6ebcdedddb5847fbf9c73afae..ce165ef58fa4f5ec89542ecb3f7700e07665c6f8 100644 --- a/process/config.py +++ b/process/config.py @@ -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') # temporary files -TMP_POLAR = os.path.join(PATH_GEBCO,'tmp_polar.tif') # DEBUGGING TMP_RGB = os.path.join(PATH_GEBCO,'tmp_rgb.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' 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 warp options +WARP_OPTIONS = '-wo SOURCE_EXTRA=1000 -et 0' #============================================================================= # RUN FUNCTION