From c8a5b8855ce6bd60a4bae9042f92ec1ef10d1f2c Mon Sep 17 00:00:00 2001 From: simondreutter <simon.dreutter@awi.de> Date: Tue, 10 Sep 2024 11:37:26 +0200 Subject: [PATCH] version 2024 (new data) and some changes like moving to pathlib.Path --- data/add/add.md | 8 +- data/gebco/gebco.md | 16 +- data/gimp/gimp.md | 10 +- data/glims/glims.md | 3 +- process/1_process_add.py | 69 +++-- process/2_process_gimp.py | 31 +-- process/3_process_glims.py | 37 ++- process/4_process_gebco.py | 103 ++++--- process/5_create_shading_layers.py | 41 ++- process/6_burn_vector_layers.py | 63 ++--- process/7_create_basemaps.py | 116 +++++--- process/RUN.py | 25 +- process/config.py | 433 ++++++++++++++--------------- 13 files changed, 479 insertions(+), 476 deletions(-) diff --git a/data/add/add.md b/data/add/add.md index bb7712f..676d173 100644 --- a/data/add/add.md +++ b/data/add/add.md @@ -13,14 +13,14 @@ The SCAR ADD consists of geographic information layers including: See the [SCAR website](https://scar.org/data-products/antarctic-digital-database) for more information. -The filename, download link and citation refer to ADD version 7.3 and 7.7 and might need to be adapted when updating the dataset. +The filename, download link and citation refer to ADD version 7.3 and 7.9 and might need to be adapted when updating the dataset. ## Files to download - Title: **Medium resolution vector polygons of the Antarctic coastline** - Format: GeoPackage (GPKG) -- Filename: `add_coastline_medium_res_polygon_v7_7.gpkg` -- Link: https://data.bas.ac.uk/download/4cd6384b-17e2-4c11-82b6-854cbf7a6df2 +- Filename: `add_coastline_medium_res_polygon_v7_9.gpkg` +- Link: https://data.bas.ac.uk/download/51e7374c-4b45-46c8-bcd3-9aa9595f3884 - General Link: https://data.bas.ac.uk/collections/e74543c0-4c4e-4b41-aa33-5bb2f67df389/ @@ -33,6 +33,6 @@ The filename, download link and citation refer to ADD version 7.3 and 7.7 and mi ## Citation -Gerrish, L., Ireland, L., Fretwell, P., & Cooper, P. (2023). Medium resolution vector polygons of the Antarctic coastline (7.7) [Data set]. UK Polar Data Centre, Natural Environment Research Council, UK Research & Innovation. https://doi.org/10.5285/cc111b81-5066-42dd-be60-9f05abcb5873 +Gerrish, L., Ireland, L., Fretwell, P., & Cooper, P. (2024). Medium resolution vector polygons of the Antarctic coastline (7.9) [Data set]. UK Polar Data Centre, Natural Environment Research Council, UK Research & Innovation. https://doi.org/10.5285/aaec1295-b0a8-4c49-a751-d964c326ce8d Gerrish, L., Fretwell, P., & Cooper, P. (2020). Medium resolution vector polygons of Antarctic rock outcrop (7.3) [Data set]. UK Polar Data Centre, Natural Environment Research Council, UK Research & Innovation. https://doi.org/10.5285/077e1f04-7068-4327-a4f2-71d863f70064 diff --git a/data/gebco/gebco.md b/data/gebco/gebco.md index 6249df2..43f6d33 100644 --- a/data/gebco/gebco.md +++ b/data/gebco/gebco.md @@ -6,22 +6,22 @@ GEBCO aims to provide the most authoritative, publicly available bathymetry data See the [GEBCO website](https://www.gebco.net) for more information. -The filename, download link and citation refer to GEBCO version 2023 and might need to be adapted when updating the dataset. +The filename, download link and citation refer to GEBCO version 2024 and might need to be adapted when updating the dataset. ## Files to download -- Title: **GEBCO_2023 Grid (ice surface elevation)** +- Title: **GEBCO_2024 Grid (ice surface elevation)** - Format: netCDF (NC) -- Filename: `GEBCO_2023.nc` -- Link: https://www.bodc.ac.uk/data/open_download/gebco/gebco_2023/zip/ (version 2023) +- Filename: `GEBCO_2024.nc` +- Link: https://www.bodc.ac.uk/data/open_download/gebco/gebco_2024/zip/ (version 2024) - General Link: https://www.gebco.net/data_and_products/gridded_bathymetry_data/ -- Title: **GEBCO_2023 Grid (sub-ice topo/bathy)** +- Title: **GEBCO_2024 Grid (sub-ice topo/bathy)** - Format: netCDF (NC) -- Filename: `GEBCO_2023_sub_ice_topo.nc` -- Link: https://www.bodc.ac.uk/data/open_download/gebco/gebco_2023_sub_ice_topo/zip/ (version 2023) +- Filename: `GEBCO_2024_sub_ice_topo.nc` +- Link: https://www.bodc.ac.uk/data/open_download/gebco/gebco_2024_sub_ice_topo/zip/ (version 2024) - General Link: https://www.gebco.net/data_and_products/gridded_bathymetry_data/ ## Citation (version 2023) -GEBCO Compilation Group (2023) GEBCO 2023 Grid (doi:10.5285/f98b053b-0cbc-6c23-e053-6c86abc0af7b) \ No newline at end of file +GEBCO Compilation Group (2024) GEBCO 2024 Grid. https://doi.org/10.5285/1c44ce99-0a0d-5f4f-e063-7086abc0ea0f \ No newline at end of file diff --git a/data/gimp/gimp.md b/data/gimp/gimp.md index 68e2047..0f6105a 100644 --- a/data/gimp/gimp.md +++ b/data/gimp/gimp.md @@ -6,15 +6,17 @@ The objective of the Greenland Ice sheet Mapping Project (GIMP) is to establish See the [NSIDC website](https://nsidc.org/data/measures/gimp) for more information. -The filename, download link and citation refer to GIMP version 1.1 and might need to be adapted when updating the dataset. +The filename, download link and citation refer to GIMP version 1.2 for 2015 and might need to be adapted when updating the dataset. ## Files to download - Title: **MEaSUREs Greenland Ice Mapping Project (GIMP) Land Ice and Ocean Classification Mask, Version 1** - Format: GeoTIFF (TIF) -- Filename: `GimpIceMask_90m_v1.1.tif` +- Filename: `GimpIceMask_90m_2015_v1.2.tif` - General Link: https://nsidc.org/data/nsidc-0714/versions/1 (NASA Earthdata Login required) -## Citation (version 1.1) +## Citation (version 1.2 / 2015) -Howat, I. 2017. MEaSUREs Greenland Ice Mapping Project (GIMP) Land Ice and Ocean Classification Mask, Version 1. [GimpIceMask_90m_v1.1]. Boulder, Colorado USA. NASA National Snow and Ice Data Center Distributed Active Archive Center. doi: https://doi.org/10.5067/B8X58MQBFUPA. [2020-11-19]. +Howat, I. 2017. MEaSUREs Greenland Ice Mapping Project (GIMP) Land Ice and Ocean Classification Mask, Version 1. [GimpIceMask_90m_2015_v1.2]. Boulder, Colorado USA. NASA National Snow and Ice Data Center Distributed Active Archive Center. https://doi.org/10.5067/B8X58MQBFUPA [2024-09-09] + +Howat, I., A. Negrete, and B. Smith. 2014. The Greenland Ice Mapping Project (GIMP) land classification and surface elevation data sets. The Cryosphere, 8. 1509-1518. https://doi.org/10.5194/tc-8-1509-2014 diff --git a/data/glims/glims.md b/data/glims/glims.md index 7fd1df7..618652c 100644 --- a/data/glims/glims.md +++ b/data/glims/glims.md @@ -13,9 +13,8 @@ The citation refers to GLIMS version 20210914 and might need to be adapted when - Title: **All GLIMS Data** - Format: ESRI Shapefile (SHP) - Filename: `glims_polygons.shp` -- Link: https://daacdata.apps.nsidc.org/pub/DATASETS/nsidc0272_GLIMS_v1/latest - General Link: https://daacdata.apps.nsidc.org/pub/DATASETS/nsidc0272_GLIMS_v1/ ## Citation (version 20210914) -GLIMS Consortium, 2005. GLIMS Glacier Database, Version 1. Boulder Colorado, USA. NASA National Snow and Ice Data Center Distributed Active Archive Center. DOI: https://doi.org/10.7265/N5V98602 (2023-05-16) \ No newline at end of file +GLIMS Consortium, 2005. GLIMS Glacier Database, Version 1. Boulder Colorado, USA. NASA National Snow and Ice Data Center Distributed Active Archive Center. https://doi.org/10.7265/N5V98602 [2023-05-16] diff --git a/process/1_process_add.py b/process/1_process_add.py index 596c83a..2f56a33 100644 --- a/process/1_process_add.py +++ b/process/1_process_add.py @@ -4,7 +4,7 @@ #################################################################### # # # AWI Basemap # -# PROCESS ANTARCTIC DIGITAL DATANASE DATA # +# PROCESS ANTARCTIC DIGITAL DATABASE DATA # # # #################################################################### @@ -16,62 +16,55 @@ and all geometries are fixed (with zero buffer). """ - -#============================================================================= +# ============================================================================ # SCRIPT INFO -#============================================================================= +# ============================================================================ __author__ = 'Simon Dreutter' -__version__ = '0.4' -__date__ = '2013-05-16' +__version__ = '0.5' +__date__ = '2024-09-09' __email__ = 'simon.dreutter@awi.de' -__status__ = 'Developement' - +__status__ = 'Development' -#============================================================================= +# ============================================================================ # IMPORT -#============================================================================= - -import os +# ============================================================================ # import AWI Basemap configuration from config import * - -#============================================================================= +# ============================================================================ # GLOBAL VARIABLES -#============================================================================= +# ============================================================================ # projection of ADD data -EPSG_ADD = 'EPSG:3031' - +EPSG_ADD = 3031 -#============================================================================= +# ============================================================================ # PROCESS -#============================================================================= +# ============================================================================ # layer names -add_coastline_in_name = os.path.splitext(os.path.basename(ADD_COASTLINE_IN))[0] -add_ice_sheet_name = os.path.splitext(os.path.basename(ADD_ICE_SHEET))[0] -add_shelf_ice_name = os.path.splitext(os.path.basename(ADD_SHELF_ICE))[0] -add_rock_outcrop_in_name = os.path.splitext(os.path.basename(ADD_ROCK_OUTCROP_IN))[0] +add_coastline_in_name = ADD_COASTLINE_IN.stem +add_ice_sheet_name = ADD_ICE_SHEET.stem +add_shelf_ice_name = ADD_SHELF_ICE.stem +add_rock_outcrop_in_name = ADD_ROCK_OUTCROP_IN.stem # DEBUG -# inconsistancy with add 7.3 layer names, variable needs to be overwritten -# remove the DEBUG block once this is fixed in the ADD layer +# inconsistency with add 7.3 layer names, variable needs to be overwritten +# TODO: remove the DEBUG block once this is fixed in the ADD layer add_rock_outcrop_in_name = 'add_rock_outcrop_medium_res_polygon_v7_3' -#/DEBUG -add_rock_outcrop_name = os.path.splitext(os.path.basename(ADD_ROCK_OUTCROP))[0] +# /DEBUG +add_rock_outcrop_name = ADD_ROCK_OUTCROP.stem # heading print() print('====================================================================') -print(f'{"ANTARCTIC DIGITAL DATANASE / ADD":^68}') - +print(f'{"ANTARCTIC DIGITAL DATABASE / ADD":^68}') msg = 'Reprojecting and extracting land mask from ADD coastlines...' cmd = (f'ogr2ogr' - f' -s_srs {EPSG_ADD}' - f' -t_srs {EPSG_WORLD}' + f' -s_srs EPSG:{EPSG_ADD}' + f' -t_srs EPSG:{EPSG_WORLD}' f' -wrapdateline -nln "{add_ice_sheet_name}"' f' -nlt MULTIPOLYGON' f' -f GPKG' @@ -79,12 +72,12 @@ cmd = (f'ogr2ogr' f' {ADD_ICE_SHEET} {ADD_COASTLINE_IN}' f' -dialect SQLite' f' -sql "SELECT ST_Buffer(ST_Multi(geom),0.0) from \'{add_coastline_in_name}\' WHERE surface=\'land\'"') -run(msg,cmd) +run(msg, cmd) msg = 'Reprojecting and extracting ice mask from ADD coastlines...' cmd = (f'ogr2ogr' - f' -s_srs {EPSG_ADD}' - f' -t_srs {EPSG_WORLD}' + f' -s_srs EPSG:{EPSG_ADD}' + f' -t_srs EPSG:{EPSG_WORLD}' f' -wrapdateline' f' -nln "{add_shelf_ice_name}"' f' -nlt MULTIPOLYGON' @@ -92,12 +85,12 @@ cmd = (f'ogr2ogr' f' {ADD_SHELF_ICE} {ADD_COASTLINE_IN}' f' -dialect SQLite' f' -sql "SELECT ST_Buffer(ST_Multi(geom),0.0) from \'{add_coastline_in_name}\' WHERE surface IN (\'ice shelf\',\'rumple\',\'ocean\',\'ice tongue\')"') -run(msg,cmd) +run(msg, cmd) msg = 'Reprojecting ADD rock outcrops...' cmd = (f'ogr2ogr' - f' -s_srs {EPSG_ADD}' - f' -t_srs {EPSG_WORLD}' + f' -s_srs EPSG:{EPSG_ADD}' + f' -t_srs EPSG:{EPSG_WORLD}' f' -wrapdateline' f' -nln "{add_rock_outcrop_name}"' f' -nlt MULTIPOLYGON' @@ -106,4 +99,4 @@ cmd = (f'ogr2ogr' f' {ADD_ROCK_OUTCROP} {ADD_ROCK_OUTCROP_IN}' f' -dialect SQLite' f' -sql "SELECT ST_Buffer(ST_Multi(geom),0.0) from \'{add_rock_outcrop_in_name}\'"') -run(msg,cmd) +run(msg, cmd) diff --git a/process/2_process_gimp.py b/process/2_process_gimp.py index cd79194..83dd17e 100644 --- a/process/2_process_gimp.py +++ b/process/2_process_gimp.py @@ -14,37 +14,32 @@ handling and then polygonized to get a vector dataset. """ - -#============================================================================= +# ============================================================================ # SCRIPT INFO -#============================================================================= +# ============================================================================ __author__ = 'Simon Dreutter' -__version__ = '0.4' -__date__ = '2013-05-16' +__version__ = '0.5' +__date__ = '2024-09-09' __email__ = 'simon.dreutter@awi.de' -__status__ = 'Developement' - +__status__ = 'Development' -#============================================================================= +# ============================================================================ # IMPORT -#============================================================================= - -import os +# ============================================================================ # import AWI Basemap configuration from config import * - -#============================================================================= +# ============================================================================ # PROCESS -#============================================================================= +# ============================================================================ # resolution for GIMP_RASTER gimp_res = RESOLUTION_DEG / 2 # layer names -gimp_name = os.path.splitext(os.path.basename(GIMP))[0] +gimp_name = GIMP.stem # heading print() @@ -53,13 +48,13 @@ print(f'{"GREENLAND ICE MAPPING PROJECT / GIMP":^68}') msg = 'Reprojecting and resampling GIMP raster...' cmd = (f'gdalwarp' - f' -t_srs {EPSG_WORLD}' + f' -t_srs EPSG:{EPSG_WORLD}' f' -dstnodata 0.0' f' -tr {gimp_res} {gimp_res}' f' -r near' f' -of GTiff' f' {GIMP_IN} {GIMP_RASTER}') -run(msg,cmd) +run(msg, cmd) msg = 'Polygonizing GIMP raster...' cmd = (f'gdal_polygonize' @@ -67,7 +62,7 @@ cmd = (f'gdal_polygonize' f' -of "GPKG"' f' {GIMP_RASTER} {GIMP}' f' {gimp_name} DN') -run(msg,cmd) +run(msg, cmd) # cleanup cleanup(GIMP_RASTER) diff --git a/process/3_process_glims.py b/process/3_process_glims.py index e0bd0df..74d74fa 100644 --- a/process/3_process_glims.py +++ b/process/3_process_glims.py @@ -15,37 +15,32 @@ Arctic and the Antarctic. """ - -#============================================================================= +# ============================================================================ # SCRIPT INFO -#============================================================================= +# ============================================================================ __author__ = 'Simon Dreutter' -__version__ = '0.4' -__date__ = '2013-05-16' +__version__ = '0.5' +__date__ = '2024-09-09' __email__ = 'simon.dreutter@awi.de' -__status__ = 'Developement' - +__status__ = 'Development' -#============================================================================= +# ============================================================================ # IMPORT -#============================================================================= - -import os +# ============================================================================ # import AWI Basemap configuration from config import * - -#============================================================================= +# ============================================================================ # PROCESS -#============================================================================= +# ============================================================================ # layer names -glims_in_name = os.path.splitext(os.path.basename(GLIMS_IN))[0] -glims_world_name = os.path.splitext(os.path.basename(GLIMS_WORLD))[0] -glims_arctic_name = os.path.splitext(os.path.basename(GLIMS_ARCTIC))[0] -glims_antarctic_name = os.path.splitext(os.path.basename(GLIMS_ANTARCTIC))[0] +glims_in_name = GLIMS_IN.stem +glims_world_name = GLIMS_WORLD.stem +glims_arctic_name = GLIMS_ARCTIC.stem +glims_antarctic_name = GLIMS_ANTARCTIC.stem # heading print() @@ -57,7 +52,7 @@ cmd = (f'ogr2ogr' f' {GLIMS_WORLD} {GLIMS_IN}' f' -dialect sqlite' f' -sql "SELECT ST_Union(ST_Buffer(geometry, 0.0)) AS geometry,* FROM \"{glims_in_name}\"" -nln "{glims_world_name}" -f "GPKG"') -run(msg,cmd) +run(msg, cmd) msg = 'Clipping GLIMS for the Arctic...' cmd = (f'ogr2ogr' @@ -66,7 +61,7 @@ cmd = (f'ogr2ogr' f' {GLIMS_ARCTIC} {GLIMS_WORLD} {glims_world_name}' f' -nln "{glims_arctic_name}"' f' -f "GPKG"') -run(msg,cmd) +run(msg, cmd) msg = 'Clipping GLIMS for the Antarctic...' cmd = (f'ogr2ogr' @@ -75,4 +70,4 @@ cmd = (f'ogr2ogr' f' {GLIMS_ANTARCTIC} {GLIMS_WORLD} {glims_world_name}' f' -nln "{glims_antarctic_name}"' f' -f "GPKG"') -run(msg,cmd) +run(msg, cmd) diff --git a/process/4_process_gebco.py b/process/4_process_gebco.py index 67659f2..cf26904 100644 --- a/process/4_process_gebco.py +++ b/process/4_process_gebco.py @@ -10,13 +10,13 @@ This script is processing the General Bathymetric Chart of the Oceans (GEBCO) input for the AWI Basemap. The global map is -downsampled to the target resolution (RESOLUTION_DEG) set in the +down-sampled to the target resolution (RESOLUTION_DEG) set in the configuration. Then the global grid is clipped to the Arctic and Antarctic extent, reprojected (warped) to the Arctic and Antarctic -projections (EPSG_ARCTIC and EPSG_ANTARCTIC), and downsampled to the -target resolution (RESOLUTION_M). +projections (EPSG_ARCTIC and EPSG_ANTARCTIC), and down-sampled to +the target resolution (RESOLUTION_M). -Due to ice shelfs there is a very steep drop in the DEM from shelf +Due to ice shelves there is a very steep drop in the DEM from shelf ice edge down to the seabed, which creates hillshade artifacts. To avoid these, the GEBCO grid for World and Antarctic outputs will be processed twice, once the ice surface DEM and once the sub ice @@ -27,31 +27,28 @@ replaced in these areas. """ - -#============================================================================= +# ============================================================================ # SCRIPT INFO -#============================================================================= +# ============================================================================ __author__ = 'Simon Dreutter' -__version__ = '0.4' -__date__ = '2013-05-16' +__version__ = '0.5' +__date__ = '2024-09-09' __email__ = 'simon.dreutter@awi.de' -__status__ = 'Developement' - +__status__ = 'Development' -#============================================================================= +# ============================================================================ # IMPORT -#============================================================================= +# ============================================================================ import shutil # import AWI Basemap configuration from config import * - -#============================================================================= +# ============================================================================ # PROCESS -#============================================================================= +# ============================================================================ # heading print() @@ -62,15 +59,15 @@ print(f'{"GENERAL BATHYMETRIC CHART OF THE OCEANS / GEBCO":^68}') # ice surface msg = 'Resampling GEBCO ice surface...' cmd = (f'gdalwarp' - f' -s_srs {EPSG_WORLD}' - f' -t_srs {EPSG_WORLD}' + f' -s_srs EPSG:{EPSG_WORLD}' + f' -t_srs EPSG:{EPSG_WORLD}' f' -tr {RESOLUTION_DEG} {RESOLUTION_DEG}' f' -r cubic' f' -of GTiff' f' {WARP_OPTIONS}' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_IN} {GEBCO_WORLD_ICESURFACE_TMP1}') -run(msg,cmd) +run(msg, cmd) msg = 'Copying World DEM...' print('====================================================================') @@ -79,7 +76,7 @@ print(msg) print() shutil.copy(GEBCO_WORLD_ICESURFACE_TMP1, GEBCO_WORLD) -msg = 'Extracting World DEM above sealevel...' +msg = 'Extracting World DEM above sea level...' cmd = (f'gdal_calc' f' --calc "(A >= 0) * A"' f' --format GTiff' @@ -88,93 +85,91 @@ cmd = (f'gdal_calc' f' --overwrite' f' --outfile {GEBCO_WORLD_ICESURFACE_TMP2}' f' --NoDataValue=0') -run(msg,cmd) +run(msg, cmd) -msg = 'Fixing Antarctic DEM above sealevel NoData...' +msg = 'Fixing Antarctic DEM above sea level NoData...' cmd = (f'gdalwarp' f' -overwrite' f' -srcnodata 0' f' {GEBCO_WORLD_ICESURFACE_TMP2}' f' {GEBCO_WORLD_ICESURFACE}') -run(msg,cmd) +run(msg, cmd) # sub ice msg = 'Resampling GEBCO sub ice...' cmd = (f'gdalwarp' - f' -s_srs {EPSG_WORLD}' - f' -t_srs {EPSG_WORLD}' + f' -s_srs EPSG:{EPSG_WORLD}' + f' -t_srs EPSG:{EPSG_WORLD}' f' -tr {RESOLUTION_DEG} {RESOLUTION_DEG}' f' -r cubic' f' -of GTiff' f' {WARP_OPTIONS}' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_SUBICE_IN} {GEBCO_WORLD_SUBICE}') -run(msg,cmd) - +run(msg, cmd) # Arctic msg = 'Clipping GEBCO for the Arctic...' cmd = (f'gdal_translate' f' -projwin -180.0 90.0 180.0 {ARCTIC_EXTENT_LAT}' - f' -a_srs {EPSG_WORLD}' + f' -a_srs EPSG:{EPSG_WORLD}' f' -of VRT' f' {GEBCO_IN} {GEBCO_ARCTIC_CLIP_VRT}') -run(msg,cmd) +run(msg, cmd) msg = 'Reprojecting GEBCO for the Arctic...' cmd = (f'gdalwarp' - f' -s_srs {EPSG_WORLD}' - f' -t_srs {EPSG_ARCTIC}' + f' -s_srs EPSG:{EPSG_WORLD}' + f' -t_srs EPSG:{EPSG_ARCTIC}' f' -r near' f' -of VRT' f' {WARP_OPTIONS}' f' {GEBCO_ARCTIC_CLIP_VRT} {GEBCO_ARCTIC_FULL_VRT}') -run(msg,cmd) +run(msg, cmd) msg = 'Resampling Arctic to target resolution...' cmd = (f'gdalwarp' - f' -s_srs {EPSG_ARCTIC}' - f' -t_srs {EPSG_ARCTIC}' + f' -s_srs EPSG:{EPSG_ARCTIC}' + f' -t_srs EPSG:{EPSG_ARCTIC}' f' -tr {RESOLUTION_M} {RESOLUTION_M}' f' -r cubic' f' -of GTiff' f' {WARP_OPTIONS}' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_ARCTIC_FULL_VRT} {GEBCO_ARCTIC}') -run(msg,cmd) - +run(msg, cmd) # Antarctic # ice surface msg = 'Clipping GEBCO ice surface for the Antarctic...' cmd = (f'gdal_translate' f' -projwin -180.0 {ANTARCTIC_EXTENT_LAT} 180.0 -90.0' - f' -a_srs {EPSG_WORLD}' + f' -a_srs EPSG:{EPSG_WORLD}' f' -of VRT' f' {GEBCO_IN} {GEBCO_ANTARCTIC_ICESURFACE_CLIP_VRT}') -run(msg,cmd) +run(msg, cmd) msg = 'Reprojecting GEBCO ice surface for the Antarctic...' cmd = (f'gdalwarp' - f' -s_srs {EPSG_WORLD}' - f' -t_srs {EPSG_ANTARCTIC}' + f' -s_srs EPSG:{EPSG_WORLD}' + f' -t_srs EPSG:{EPSG_ANTARCTIC}' f' -r near' f' -of VRT' f' {WARP_OPTIONS}' f' {GEBCO_ANTARCTIC_ICESURFACE_CLIP_VRT} {GEBCO_ANTARCTIC_ICESURFACE_FULL_VRT}') -run(msg,cmd) +run(msg, cmd) msg = 'Resampling Antarctic ice surface to target resolution...' cmd = (f'gdalwarp' - f' -s_srs {EPSG_ANTARCTIC}' - f' -t_srs {EPSG_ANTARCTIC}' + f' -s_srs EPSG:{EPSG_ANTARCTIC}' + f' -t_srs EPSG:{EPSG_ANTARCTIC}' f' -tr {RESOLUTION_M} {RESOLUTION_M}' f' -r cubic' f' -of GTiff' f' {WARP_OPTIONS}' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_ANTARCTIC_ICESURFACE_FULL_VRT} {GEBCO_ANTARCTIC_ICESURFACE_TMP1}') -run(msg,cmd) +run(msg, cmd) msg = 'Copying Antarctic DEM...' print('====================================================================') @@ -192,7 +187,7 @@ cmd = (f'gdal_calc' f' --overwrite' f' --outfile {GEBCO_ANTARCTIC_ICESURFACE_TMP2}' f' --NoDataValue=0') -run(msg,cmd) +run(msg, cmd) msg = 'Fixing Antarctic DEM above sealevel NoData...' cmd = (f'gdalwarp' @@ -200,38 +195,38 @@ cmd = (f'gdalwarp' f' -srcnodata 0' f' {GEBCO_ANTARCTIC_ICESURFACE_TMP2}' f' {GEBCO_ANTARCTIC_ICESURFACE}') -run(msg,cmd) +run(msg, cmd) # sub ice msg = 'Clipping GEBCO sub ice for the Antarctic...' cmd = (f'gdal_translate' f' -projwin -180.0 {ANTARCTIC_EXTENT_LAT} 180.0 -90.0' - f' -a_srs {EPSG_WORLD}' + f' -a_srs EPSG:{EPSG_WORLD}' f' -of VRT' f' {GEBCO_SUBICE_IN} {GEBCO_ANTARCTIC_SUBICE_CLIP_VRT}') -run(msg,cmd) +run(msg, cmd) msg = 'Reprojecting GEBCO sub ice for the Antarctic...' cmd = (f'gdalwarp' - f' -s_srs {EPSG_WORLD}' - f' -t_srs {EPSG_ANTARCTIC}' + f' -s_srs EPSG:{EPSG_WORLD}' + f' -t_srs EPSG:{EPSG_ANTARCTIC}' f' -r near' f' -of VRT' f' {WARP_OPTIONS}' f' {GEBCO_ANTARCTIC_SUBICE_CLIP_VRT} {GEBCO_ANTARCTIC_SUBICE_FULL_VRT}') -run(msg,cmd) +run(msg, cmd) msg = 'Resampling Antarctic sub ice to target resolution...' cmd = (f'gdalwarp' - f' -s_srs {EPSG_ANTARCTIC}' - f' -t_srs {EPSG_ANTARCTIC}' + f' -s_srs EPSG:{EPSG_ANTARCTIC}' + f' -t_srs EPSG:{EPSG_ANTARCTIC}' f' -tr {RESOLUTION_M} {RESOLUTION_M}' f' -r cubic' f' -of GTiff' f' {WARP_OPTIONS}' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_ANTARCTIC_SUBICE_FULL_VRT} {GEBCO_ANTARCTIC_SUBICE}') -run(msg,cmd) +run(msg, cmd) # cleanup cleanup(GEBCO_WORLD_ICESURFACE_TMP1) diff --git a/process/5_create_shading_layers.py b/process/5_create_shading_layers.py index 59f071b..afdab0f 100644 --- a/process/5_create_shading_layers.py +++ b/process/5_create_shading_layers.py @@ -8,7 +8,7 @@ # # #################################################################### -This scipt computes the hillshade layers for the World, the Arctic +This script computes the hillshade layers for the World, the Arctic and the Antarctic basemap. The hillshades are computed with a synthetic light source from 315° Azimuth and 45° Altitude and with and exaggeration / z factor of 10 (Z_FACTOR in config). The combined @@ -18,29 +18,26 @@ inclination. """ - -#============================================================================= +# ============================================================================ # SCRIPT INFO -#============================================================================= +# ============================================================================ __author__ = 'Simon Dreutter' -__version__ = '0.4' -__date__ = '2013-05-16' +__version__ = '0.5' +__date__ = '2024-09-09' __email__ = 'simon.dreutter@awi.de' -__status__ = 'Developement' - +__status__ = 'Development' -#============================================================================= +# ============================================================================ # IMPORT -#============================================================================= +# ============================================================================ # import AWI Basemap configuration from config import * - -#============================================================================= +# ============================================================================ # PROCESS -#============================================================================= +# ============================================================================ # heading print() @@ -61,7 +58,7 @@ cmd = (f'gdaldem' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_WORLD} {GEBCO_WORLD_HILLSHADE}') -run(msg,cmd) +run(msg, cmd) msg = 'Creating World ice surface Hillshade...' cmd = (f'gdaldem' @@ -76,7 +73,7 @@ cmd = (f'gdaldem' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_WORLD_ICESURFACE} {GEBCO_WORLD_ICESURFACE_HILLSHADE}') -run(msg,cmd) +run(msg, cmd) msg = 'Creating World sub ice Hillshade...' cmd = (f'gdaldem' @@ -91,7 +88,7 @@ cmd = (f'gdaldem' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_WORLD_SUBICE} {GEBCO_WORLD_SUBICE_HILLSHADE}') -run(msg,cmd) +run(msg, cmd) msg = 'Merging World Hillshades...' cmd = (f'gdal_merge' @@ -99,8 +96,7 @@ cmd = (f'gdal_merge' f' -n 0' f' -a_nodata 0' f' {GEBCO_WORLD_SUBICE_HILLSHADE} {GEBCO_WORLD_ICESURFACE_HILLSHADE}') -run(msg,cmd) - +run(msg, cmd) # Arctic msg = 'Creating Arctic Hillshade...' @@ -116,8 +112,7 @@ cmd = (f'gdaldem' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_ARCTIC} {GEBCO_ARCTIC_HILLSHADE}') -run(msg,cmd) - +run(msg, cmd) # Antarctic msg = 'Creating Antarctic ice surface Hillshade...' @@ -133,7 +128,7 @@ cmd = (f'gdaldem' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_ANTARCTIC_ICESURFACE} {GEBCO_ANTARCTIC_ICESURFACE_HILLSHADE}') -run(msg,cmd) +run(msg, cmd) msg = 'Creating Antarctic sub ice Hillshade...' cmd = (f'gdaldem' @@ -148,7 +143,7 @@ cmd = (f'gdaldem' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_ANTARCTIC_SUBICE} {GEBCO_ANTARCTIC_SUBICE_HILLSHADE}') -run(msg,cmd) +run(msg, cmd) msg = 'Merging Antarctic Hillshades...' cmd = (f'gdal_merge' @@ -156,7 +151,7 @@ cmd = (f'gdal_merge' f' -n 0' f' -a_nodata 0' f' {GEBCO_ANTARCTIC_SUBICE_HILLSHADE} {GEBCO_ANTARCTIC_ICESURFACE_HILLSHADE}') -run(msg,cmd) +run(msg, cmd) # cleanup cleanup(GEBCO_WORLD_ICESURFACE) diff --git a/process/6_burn_vector_layers.py b/process/6_burn_vector_layers.py index fa47cca..0d05e57 100644 --- a/process/6_burn_vector_layers.py +++ b/process/6_burn_vector_layers.py @@ -15,40 +15,35 @@ wherever they intersect with the vector layers. """ - -#============================================================================= +# ============================================================================ # SCRIPT INFO -#============================================================================= +# ============================================================================ __author__ = 'Simon Dreutter' -__version__ = '0.4' -__date__ = '2013-05-16' +__version__ = '0.5' +__date__ = '2024-09-09' __email__ = 'simon.dreutter@awi.de' -__status__ = 'Developement' - +__status__ = 'Development' -#============================================================================= +# ============================================================================ # IMPORT -#============================================================================= - -import os +# ============================================================================ # import AWI Basemap configuration from config import * - -#============================================================================= +# ============================================================================ # PROCESS -#============================================================================= +# ============================================================================ # layer names -add_ice_sheet_name = os.path.splitext(os.path.basename(ADD_ICE_SHEET))[0] -add_shelf_ice_name = os.path.splitext(os.path.basename(ADD_SHELF_ICE))[0] -add_rock_outcrop_name = os.path.splitext(os.path.basename(ADD_ROCK_OUTCROP))[0] -gimp_name = os.path.splitext(os.path.basename(GIMP))[0] -glims_world_name = os.path.splitext(os.path.basename(GLIMS_WORLD))[0] -glims_arctic_name = os.path.splitext(os.path.basename(GLIMS_ARCTIC))[0] -glims_antarctic_name = os.path.splitext(os.path.basename(GLIMS_ANTARCTIC))[0] +add_ice_sheet_name = ADD_ICE_SHEET.stem +add_shelf_ice_name = ADD_SHELF_ICE.stem +add_rock_outcrop_name = ADD_ROCK_OUTCROP.stem +gimp_name = GIMP.stem +glims_world_name = GLIMS_WORLD.stem +glims_arctic_name = GLIMS_ARCTIC.stem +glims_antarctic_name = GLIMS_ANTARCTIC.stem # burn values V_ROCK_OUTCROPS = 3000.0 @@ -60,19 +55,19 @@ print() print('====================================================================') print(f'{"BURN VECTOR LAYERS":^68}') -msg = 'Burning Antarctic ice shelfs in World raster...' +msg = 'Burning Antarctic ice shelves in World raster...' cmd = (f'gdal_rasterize' f' -l {add_shelf_ice_name}' f' -burn {V_SHELF_ICE}' f' {ADD_SHELF_ICE} {GEBCO_WORLD}') -run(msg,cmd) +run(msg, cmd) msg = 'Burning Antarctic ice sheet in World raster...' cmd = (f'gdal_rasterize' f' -l {add_ice_sheet_name}' f' -burn {V_ICE_SHEET}' f' {ADD_ICE_SHEET} {GEBCO_WORLD}') -run(msg,cmd) +run(msg, cmd) msg = 'Burning Antarctic rock outcrops in World raster...' cmd = (f'gdal_rasterize' @@ -80,49 +75,49 @@ cmd = (f'gdal_rasterize' f' -burn {V_ROCK_OUTCROPS}' f' -at' f' {ADD_ROCK_OUTCROP} {GEBCO_WORLD}') -run(msg,cmd) +run(msg, cmd) msg = 'Burning Greenland ice sheet in World raster...' cmd = (f'gdal_rasterize' f' -l {gimp_name}' f' -burn {V_ICE_SHEET}' f' {GIMP} {GEBCO_WORLD}') -run(msg,cmd) +run(msg, cmd) msg = 'Burning glaciers in World raster...' cmd = (f'gdal_rasterize' f' -l {glims_world_name}' f' -burn {V_ICE_SHEET}' f' {GLIMS_WORLD} {GEBCO_WORLD}') -run(msg,cmd) +run(msg, cmd) msg = 'Burning Greenland ice sheet in Arctic raster...' cmd = (f'gdal_rasterize' f' -l {gimp_name}' f' -burn {V_ICE_SHEET}' f' {GIMP} {GEBCO_ARCTIC}') -run(msg,cmd) +run(msg, cmd) msg = 'Burning glaciers in Arctic raster...' cmd = (f'gdal_rasterize' f' -l {glims_arctic_name}' f' -burn {V_ICE_SHEET}' f' {GLIMS_ARCTIC} {GEBCO_ARCTIC}') -run(msg,cmd) +run(msg, cmd) -msg = 'Burning Antarctic ice shelfs in Antarctic raster...' +msg = 'Burning Antarctic ice shelves in Antarctic raster...' cmd = (f'gdal_rasterize' f' -l {add_shelf_ice_name}' f' -burn {V_SHELF_ICE}' f' {ADD_SHELF_ICE} {GEBCO_ANTARCTIC}') -run(msg,cmd) +run(msg, cmd) msg = 'Burning Antarctic ice sheet in Antarctic raster...' cmd = (f'gdal_rasterize' f' -l {add_ice_sheet_name}' f' -burn {V_ICE_SHEET}' f' {ADD_ICE_SHEET} {GEBCO_ANTARCTIC}') -run(msg,cmd) +run(msg, cmd) msg = 'Burning Antarctic rock outcrops in Antarctic raster...' cmd = (f'gdal_rasterize' @@ -130,14 +125,14 @@ cmd = (f'gdal_rasterize' f' -burn {V_ROCK_OUTCROPS}' f' -at' f' {ADD_ROCK_OUTCROP} {GEBCO_ANTARCTIC}') -run(msg,cmd) +run(msg, cmd) msg = 'Burning glaciers in Antarctic raster...' cmd = (f'gdal_rasterize' f' -l {glims_antarctic_name}' f' -burn {V_ICE_SHEET}' f' {GLIMS_ANTARCTIC} {GEBCO_ANTARCTIC}') -run(msg,cmd) +run(msg, cmd) # cleanup cleanup(ADD_SHELF_ICE) diff --git a/process/7_create_basemaps.py b/process/7_create_basemaps.py index 649638b..e554252 100644 --- a/process/7_create_basemaps.py +++ b/process/7_create_basemaps.py @@ -9,8 +9,8 @@ #################################################################### This script creates the final AWI Basemaps in all three projections -and with different color palettes. This happens in two setps. First -the DEM is rendered with the color palette into a RGB color raster. +and with different color palettes. This happens in two steps. First +the DEM is rendered with the color palette into an RGB color raster. Then the shaded map is calculated by combining the colored raster with the shading raster. At the end, the raster files are finalized by creating tiles and @@ -18,33 +18,30 @@ pyramids and by adding metadata tags. """ - -#============================================================================= +# ============================================================================ # SCRIPT INFO -#============================================================================= +# ============================================================================ __author__ = 'Simon Dreutter' -__version__ = '0.4' -__date__ = '2013-05-16' +__version__ = '0.5' +__date__ = '2024-09-09' __email__ = 'simon.dreutter@awi.de' -__status__ = 'Developement' - +__status__ = 'Development' -#============================================================================= +# ============================================================================ # IMPORT -#============================================================================= +# ============================================================================ import textwrap -import rasterio +# import rasterio # import AWI Basemap configuration from config import * - -#============================================================================= +# ============================================================================ # GLOBAL VARIABLES -#============================================================================= +# ============================================================================ # GDAL creation options for final result GDAL_CREATE_OPTIONS_FINAL = '-co TILED=YES -co BLOCKXSIZE=512 -co BLOCKYSIZE=512 -co COPY_SRC_OVERVIEWS=FALSE -co COMPRESS=NONE -co BIGTIFF=IF_NEEDED' @@ -53,9 +50,9 @@ GDAL_CREATE_OPTIONS_FINAL = '-co TILED=YES -co BLOCKXSIZE=512 -co BLOCKYSIZE=512 OVERVIEW_METHOD = 'cubic' -#============================================================================= +# ============================================================================ # FUNCTIONS -#============================================================================= +# ============================================================================ def create_basemap(name, grid, hillshade, color_palette, epsg, output): """Create the AWI Basemap RGB grid from various inputs @@ -70,7 +67,7 @@ def create_basemap(name, grid, hillshade, color_palette, epsg, output): Path to input hillshade grid color_palette : str Path to input color palette file - epsg : str + epsg : int EPSG code output : str Path to output RGB grid @@ -87,8 +84,8 @@ def create_basemap(name, grid, hillshade, color_palette, epsg, output): f' -b 1' f' -compute_edges' f' {GDAL_CREATE_OPTIONS}') - run(msg,cmd) - + run(msg, cmd) + # compile shaded and colored RGB grid msg = f'Creating shaded {name} map...' cmd = (f'gdal_calc' @@ -103,25 +100,25 @@ def create_basemap(name, grid, hillshade, color_palette, epsg, output): f' --overwrite' f' --outfile {TMP_SHADED}') # {GDAL_CREATE_OPTIONS_PY} - run(msg,cmd) - + run(msg, cmd) + # cleanup cleanup(TMP_RGB) - + # finalize grid with GDAL create options msg = f'Finalizing {name}...' cmd = (f'gdal_translate' - f' -a_srs {epsg}' + f' -a_srs EPSG:{epsg}' f' -stats' f' -of GTiff' f' {GDAL_CREATE_OPTIONS_FINAL}' f' {TMP_SHADED} {output}') - run(msg,cmd) - + run(msg, cmd) + # cleanup cleanup(TMP_SHADED) cleanup(f'{TMP_SHADED}.aux.xml') - + # create internal pyramid layers msg = f'Creating pyramids for {name}...' cmd = (f'gdaladdo' @@ -132,8 +129,8 @@ def create_basemap(name, grid, hillshade, color_palette, epsg, output): f' --config GDAL_TIFF_OVR_BLOCKSIZE 512' f' {output}' f' 2 4 8 16 32 64') - run(msg,cmd) - + run(msg, cmd) + # set metadata in GeoTIFF tags print('====================================================================') print() @@ -146,9 +143,9 @@ def create_basemap(name, grid, hillshade, color_palette, epsg, output): print() -#============================================================================= +# ============================================================================ # PROCESS -#============================================================================= +# ============================================================================ # heading print() @@ -167,10 +164,9 @@ cleanup(GEBCO_ARCTIC_HILLSHADE) cleanup(GEBCO_ANTARCTIC) cleanup(GEBCO_ANTARCTIC_HILLSHADE) - -#============================================================================= +# ============================================================================ # METADATA -#============================================================================= +# ============================================================================ # write metadata to text file with open(METADATA_FILE, 'w') as f: @@ -181,10 +177,56 @@ with open(METADATA_FILE, 'w') as f: f.write(f'# #\n') f.write(f'####################################################################\n\n') for key, val in METADATA.items(): - if not key in ['VERSION','NAME','EPSG']: - f.write(f'{key.replace("_"," ")}\n') + if key not in ['VERSION', 'NAME', 'EPSG']: + f.write(f'{key.replace("_", " ")}\n') f.write(f'--------------------------------------------------------------------\n') for line in val.splitlines(): - f.write(textwrap.fill(line,width=68,initial_indent='', subsequent_indent=' ')) + # f.write(textwrap.fill(line, width=68, initial_indent='', subsequent_indent=' ')) + f.write(textwrap.fill(line, width=69, initial_indent='', subsequent_indent='')) f.write('\n\n') f.write(f'\n') + +# ============================================================================ +# SERVICE.CONF +# ============================================================================ + +# write metadata to text file +with open(SERVICE_CONF_FILE, 'w') as f: + f.write(f'''[SERVICE] +maintainer = https://www.awi.de/en/about-us/service/computing-centre/data-products.html +online.resource = https://maps.awi.de/services/basemaps/gs/awi +title = AWI Basemap Service +abstract = The AWI Basemap is a global basemap intended to be used as a + background for GIS applications or web map viewers like the DAM + marine data portal. The map is a rendered and shaded RGB version + of the current GEBCO grid with ice overlays from ADD, GLIMS and + GIMP. It is available in three projections, EPSG:4326 for the + global map as well as EPSG:3995 and EPSG:3031 for the polar + stereographic versions. +fees = NONE +access constraints = CC-BY 4.0 +keywords = Basemap,Bathymetry,Topography,GEBCO + +[LAYER.ROOT] +title = AWI Basemaps +abstract = The AWI Basemap is a global basemap intended to be used as a + background for GIS applications or web map viewers like the DAM + marine data portal. The map is a rendered and shaded RGB version + of the current GEBCO grid with ice overlays from ADD, GLIMS and + GIMP. + +[LAYER.world_<color>] +name = world_<color> +title = AWI Basemap World View (<color>) +abstract = AWI Basemap World in EPSG:4326 [WGS84 / Geographic] with global coverage. + +[LAYER.arctic_<color>] +name = arctic_<color> +title = AWI Basemap Arctic View (<color>) +abstract = AWI Basemap Arctic in EPSG:3995 [WGS 84 / Arctic Polar Stereographic] from the North Pole to {ARCTIC_EXTENT_LAT:.0f}°N. + +[LAYER.antarctic_<color>] +name = antarctic_<color> +title = AWI Basemap Antarctic View (<color>) +abstract = AWI Basemap Antarctic in EPSG:3031 [WGS 84 / Antarctic Polar Stereographic] from the South Pole to {-ANTARCTIC_EXTENT_LAT:.0f}°S. +''') diff --git a/process/RUN.py b/process/RUN.py index be2926a..3cd1a24 100644 --- a/process/RUN.py +++ b/process/RUN.py @@ -9,29 +9,26 @@ """ - -#============================================================================= +# ============================================================================ # SCRIPT INFO -#============================================================================= +# ============================================================================ __author__ = 'Simon Dreutter' -__version__ = '0.4' -__date__ = '2013-05-16' +__version__ = '0.5' +__date__ = '2024-09-09' __email__ = 'simon.dreutter@awi.de' -__status__ = 'Developement' - +__status__ = 'Development' -#============================================================================= +# ============================================================================ # IMPORT -#============================================================================= +# ============================================================================ import subprocess import sys - -#============================================================================= +# ============================================================================ # RUN -#============================================================================= +# ============================================================================ print(__doc__) print('--------------------------------------------------------------------') @@ -42,7 +39,7 @@ print(f'status: {__status__}') print('--------------------------------------------------------------------') print() -#============================================================================= +# ============================================================================ PYTHON = sys.executable @@ -54,7 +51,7 @@ subprocess.call([PYTHON, '5_create_shading_layers.py']) subprocess.call([PYTHON, '6_burn_vector_layers.py']) subprocess.call([PYTHON, '7_create_basemaps.py']) -#============================================================================= +# ============================================================================ print() print('--------------------------------------------------------------------') diff --git a/process/config.py b/process/config.py index 274f6e0..e4dc7b0 100644 --- a/process/config.py +++ b/process/config.py @@ -24,38 +24,36 @@ here: """ - -#============================================================================= +# ============================================================================ # SCRIPT INFO -#============================================================================= +# ============================================================================ __author__ = 'Simon Dreutter' -__version__ = '0.4' -__date__ = '2023-05-16' +__version__ = '0.5' +__date__ = '2024-09-09' __email__ = 'simon.dreutter@awi.de' -__status__ = 'Developement' - +__status__ = 'Development' -#============================================================================= +# ============================================================================ # IMPORT -#============================================================================= +# ============================================================================ import datetime as dt import os +from pathlib import Path import sys from osgeo import gdal import rasterio - -#============================================================================= +# ============================================================================ # METADATA -#============================================================================= +# ============================================================================ # metadata fields as convenient text blocks for easy writing TITLE = 'AWI Basemap' -VERSION = '2023' +VERSION = '2024' ABSTRACT = f''' The AWI Basemap is a global basemap intended to be used as a background for GIS applications or web map viewers like the DAM marine data portal. The map is a rendered and shaded RGB version of the current GEBCO grid with ice overlays from ADD, GLIMS and GIMP. It is available in three projections, EPSG:4326 for the global map as well as EPSG:3995 and EPSG:3031 for the polar stereographic versions. @@ -63,10 +61,11 @@ AWI Basemaps are created by {__author__} ({__email__}), Bathymetry Group, Alfred ''' SOURCES = ''' -GEBCO Compilation Group (2023) GEBCO 2023 Grid (doi:10.5285/f98b053b-0cbc-6c23-e053-6c86abc0af7b) +GEBCO Compilation Group (2024) GEBCO 2024 Grid. https://doi.org/10.5285/1c44ce99-0a0d-5f4f-e063-7086abc0ea0f GLIMS Consortium, 2005. GLIMS Glacier Database, Version 1. Boulder Colorado, USA. NASA National Snow and Ice Data Center Distributed Active Archive Center. DOI: https://doi.org/10.7265/N5V98602 (2023-05-16) -Howat, I. 2017. MEaSUREs Greenland Ice Mapping Project (GIMP) Land Ice and Ocean Classification Mask, Version 1. [GimpIceMask_90m_v1.1]. Boulder, Colorado USA. NASA National Snow and Ice Data Center Distributed Active Archive Center. doi: https://doi.org/10.5067/B8X58MQBFUPA. [2020-11-19]. -Gerrish, L., Ireland, L., Fretwell, P., & Cooper, P. (2023). Medium resolution vector polygons of the Antarctic coastline (7.7) [Data set]. UK Polar Data Centre, Natural Environment Research Council, UK Research & Innovation. https://doi.org/10.5285/cc111b81-5066-42dd-be60-9f05abcb5873 +Howat, I. 2017. MEaSUREs Greenland Ice Mapping Project (GIMP) Land Ice and Ocean Classification Mask, Version 1. [GimpIceMask_90m_2015_v1.2]. Boulder, Colorado USA. NASA National Snow and Ice Data Center Distributed Active Archive Center. https://doi.org/10.5067/B8X58MQBFUPA [2024-09-09] +Howat, I., A. Negrete, and B. Smith. 2014. The Greenland Ice Mapping Project (GIMP) land classification and surface elevation data sets. The Cryosphere, 8. 1509-1518. https://doi.org/10.5194/tc-8-1509-2014 +Gerrish, L., Ireland, L., Fretwell, P., & Cooper, P. (2024). Medium resolution vector polygons of the Antarctic coastline (7.9) [Data set]. UK Polar Data Centre, Natural Environment Research Council, UK Research & Innovation. https://doi.org/10.5285/aaec1295-b0a8-4c49-a751-d964c326ce8d Gerrish, L., Fretwell, P., & Cooper, P. (2020). Medium resolution vector polygons of Antarctic rock outcrop (7.3) [Data set]. UK Polar Data Centre, Natural Environment Research Council, UK Research & Innovation. https://doi.org/10.5285/077e1f04-7068-4327-a4f2-71d863f70064 ''' @@ -82,66 +81,63 @@ AWI Basemap script version {__version__} ({__date__}) grid creation date: {dt.date.today():%Y-%m-%d} ''' -#============================================================================= +# ============================================================================ # metadata compiled as dictionary for later script usage METADATA = { - 'VERSION' : VERSION.strip(), - 'ABSTRACT' : ABSTRACT.strip(), - 'SOURCES' : SOURCES.strip(), - 'LICENSE' : LICENSE.strip(), - 'USAGE_FEES' : USAGE_FEES.strip(), - 'CREATION_COMMENTS' : CREATION_COMMENTS.strip() + 'VERSION': VERSION.strip(), + 'ABSTRACT': ABSTRACT.strip(), + 'SOURCES': SOURCES.strip(), + 'LICENSE': LICENSE.strip(), + 'USAGE_FEES': USAGE_FEES.strip(), + 'CREATION_COMMENTS': CREATION_COMMENTS.strip() } - -#============================================================================= +# ============================================================================ # INPUT FOLDERS -#============================================================================= +# ============================================================================ # These folders are part of the processing infrastructure. Only change the # variables if the directory names or locations have been changed. # path to data directory -PATH_DATA = os.path.abspath(os.path.join('..','data')) +PATH_DATA = Path('..', 'data').resolve() # path to separate datasets -PATH_ADD = os.path.join(PATH_DATA,'add') -PATH_GEBCO = os.path.join(PATH_DATA,'gebco') -PATH_GIMP = os.path.join(PATH_DATA,'gimp') -PATH_GLIMS = os.path.join(PATH_DATA,'glims') +PATH_ADD = PATH_DATA / 'add' +PATH_GEBCO = PATH_DATA / 'gebco' +PATH_GIMP = PATH_DATA / 'gimp' +PATH_GLIMS = PATH_DATA / 'glims' # path to result directory -PATH_RESULT = os.path.abspath(os.path.join('..','result')) +PATH_RESULT = Path('..', 'result').resolve() - -#============================================================================= +# ============================================================================ # INPUT FILES -#============================================================================= +# ============================================================================ # These file paths are using the current version of the input files' names. If # any of the input files are updated in the data directory, their filenames # need to updated in this section. # input filepath to ADD Coastlines -ADD_COASTLINE_IN = os.path.join(PATH_ADD,'add_coastline_medium_res_polygon_v7_7.gpkg') +ADD_COASTLINE_IN = PATH_ADD / 'add_coastline_medium_res_polygon_v7_9.gpkg' # input filepath to ADD Rock Outcrops -ADD_ROCK_OUTCROP_IN = os.path.join(PATH_ADD,'add_rock_outcrop_medium_res_polygon_v7.3.gpkg') +ADD_ROCK_OUTCROP_IN = PATH_ADD / 'add_rock_outcrop_medium_res_polygon_v7.3.gpkg' # input filepath to GEBCO netCDF grids -GEBCO_IN = os.path.join(PATH_GEBCO,'GEBCO_2023.nc') -GEBCO_SUBICE_IN = os.path.join(PATH_GEBCO,'GEBCO_2023_sub_ice_topo.nc') +GEBCO_IN = PATH_GEBCO / 'GEBCO_2024.nc' +GEBCO_SUBICE_IN = PATH_GEBCO / 'GEBCO_2024_sub_ice_topo.nc' # input filepath to GIMP GeoTIFF -GIMP_IN = os.path.join(PATH_GIMP,'GimpIceMask_90m_v1.1.tif') +GIMP_IN = PATH_GIMP / 'GimpIceMask_90m_2015_v1.2.tif' # input filepath to GLIMS Esri Shapefile -GLIMS_IN = os.path.join(PATH_GLIMS,'glims_polygons.shp') - +GLIMS_IN = PATH_GLIMS / 'glims_polygons.shp' -#============================================================================= +# ============================================================================ # GENERAL CREATE OPTIONS -#============================================================================= +# ============================================================================ # Here are some general options for the resulting grids like resolution and # shading exaggeration. Adjusting the resolution of the output grid will @@ -156,227 +152,223 @@ GLIMS_IN = os.path.join(PATH_GLIMS,'glims_polygons.shp') # Polar: 1000 meter # # The extent of the Polar maps should be kept to an acceptable minium (larger -# number) to reduce file size and atrifacts from warping in the lower +# number) to reduce file size and artifacts from warping in the lower # latitudes. # Final AWI Basemap (World) resolution -#RESOLUTION_DEG = 0.004166666666666666 # 15 arc seconds (original GEBCO resolution) -RESOLUTION_DEG = 0.008333333333333333 # 30 arc seconds +# RESOLUTION_DEG = 0.004166666666666666 # 15 arc seconds (original GEBCO resolution) +RESOLUTION_DEG = 0.008333333333333333 # 30 arc seconds # Final AWI Basemap (Arctic and Antarctic) resolution -#RESOLUTION_M = 500.0 # approximate pendant to 15 arc seconds -RESOLUTION_M = 1000.0 # approximate pendant to 30 arc seconds +# RESOLUTION_M = 500.0 # approximate pendant to 15 arc seconds +RESOLUTION_M = 1000.0 # approximate pendant to 30 arc seconds # Arctic extent down to X degree latitude (positive) ARCTIC_EXTENT_LAT = 30.0 # Antarctic extent up to X degree latitude (negative) -ANTARCTIC_EXTENT_LAT= -30.0 +ANTARCTIC_EXTENT_LAT = -30.0 # Hillshade z factor / vertical exaggeration Z_FACTOR = 10.0 - -#============================================================================= +# ============================================================================ # TEMPORARY FILES -#============================================================================= +# ============================================================================ # These are file paths to temporary files that will be created (and cleaned -# up) during the process. The varibales care used throughout the different +# up) during the process. The variables care used throughout the different # scripts. # ADD: -ADD_ICE_SHEET = os.path.join(PATH_ADD,'add_ice_sheet.gpkg') -ADD_SHELF_ICE = os.path.join(PATH_ADD,'add_shelf_ice.gpkg') -ADD_ROCK_OUTCROP = os.path.join(PATH_ADD,'add_rock_outcrop.gpkg') +ADD_ICE_SHEET = PATH_ADD / 'add_ice_sheet.gpkg' +ADD_SHELF_ICE = PATH_ADD / 'add_shelf_ice.gpkg' +ADD_ROCK_OUTCROP = PATH_ADD / 'add_rock_outcrop.gpkg' -#============================================================================= +# ============================================================================ # GIMP: -GIMP_RASTER = os.path.join(PATH_GIMP,'gimp_ice_mask.tif') -GIMP = os.path.join(PATH_GIMP,'gimp_ice_mask.gpkg') +GIMP_RASTER = PATH_GIMP / 'gimp_ice_mask.tif' +GIMP = PATH_GIMP / 'gimp_ice_mask.gpkg' -#============================================================================= +# ============================================================================ # GLIMS: -GLIMS_WORLD = os.path.join(PATH_GLIMS,'glims_world.gpkg') -GLIMS_ARCTIC = os.path.join(PATH_GLIMS,'glims_arctic.gpkg') -GLIMS_ANTARCTIC = os.path.join(PATH_GLIMS,'glims_antarctic.gpkg') +GLIMS_WORLD = PATH_GLIMS / 'glims_world.gpkg' +GLIMS_ARCTIC = PATH_GLIMS / 'glims_arctic.gpkg' +GLIMS_ANTARCTIC = PATH_GLIMS / 'glims_antarctic.gpkg' -#============================================================================= +# ============================================================================ # GEBCO: # GEBCO World ice surface -GEBCO_WORLD_ICESURFACE_TMP1 = os.path.join(PATH_GEBCO,'gebco_world_icesurface_tmp1.tif') -GEBCO_WORLD_ICESURFACE_TMP2 = os.path.join(PATH_GEBCO,'gebco_world_icesurface_tmp2.tif') -GEBCO_WORLD_ICESURFACE = os.path.join(PATH_GEBCO,'gebco_world_icesurface.tif') -GEBCO_WORLD_ICESURFACE_HILLSHADE = os.path.join(PATH_GEBCO,'gebco_world_icesurface_hillshade.tif') +GEBCO_WORLD_ICESURFACE_TMP1 = PATH_GEBCO / 'gebco_world_icesurface_tmp1.tif' +GEBCO_WORLD_ICESURFACE_TMP2 = PATH_GEBCO / 'gebco_world_icesurface_tmp2.tif' +GEBCO_WORLD_ICESURFACE = PATH_GEBCO / 'gebco_world_icesurface.tif' +GEBCO_WORLD_ICESURFACE_HILLSHADE = PATH_GEBCO / 'gebco_world_icesurface_hillshade.tif' # GEBCO World sub ice -GEBCO_WORLD_SUBICE = os.path.join(PATH_GEBCO,'gebco_world_subice.tif') -GEBCO_WORLD_SUBICE_HILLSHADE = os.path.join(PATH_GEBCO,'gebco_world_subice_hillshade.tif') +GEBCO_WORLD_SUBICE = PATH_GEBCO / 'gebco_world_subice.tif' +GEBCO_WORLD_SUBICE_HILLSHADE = PATH_GEBCO / 'gebco_world_subice_hillshade.tif' # GEBCO World combined -GEBCO_WORLD = os.path.join(PATH_GEBCO,'gebco_world.tif') -GEBCO_WORLD_HILLSHADE = os.path.join(PATH_GEBCO,'gebco_world_hillshade.tif') - +GEBCO_WORLD = PATH_GEBCO / 'gebco_world.tif' +GEBCO_WORLD_HILLSHADE = PATH_GEBCO / 'gebco_world_hillshade.tif' # GEBCO Arctic -GEBCO_ARCTIC_CLIP_VRT = os.path.join(PATH_GEBCO,'gebco_arctic_clip.vrt') -GEBCO_ARCTIC_FULL_VRT = os.path.join(PATH_GEBCO,'gebco_arctic_full.vrt') -GEBCO_ARCTIC = os.path.join(PATH_GEBCO,'gebco_arctic.tif') -GEBCO_ARCTIC_HILLSHADE = os.path.join(PATH_GEBCO,'gebco_arctic_hillshade.tif') - +GEBCO_ARCTIC_CLIP_VRT = PATH_GEBCO / 'gebco_arctic_clip.vrt' +GEBCO_ARCTIC_FULL_VRT = PATH_GEBCO / 'gebco_arctic_full.vrt' +GEBCO_ARCTIC = PATH_GEBCO / 'gebco_arctic.tif' +GEBCO_ARCTIC_HILLSHADE = PATH_GEBCO / 'gebco_arctic_hillshade.tif' # GEBCO Antarctic ice surface -GEBCO_ANTARCTIC_ICESURFACE_CLIP_VRT = os.path.join(PATH_GEBCO,'gebco_antarctic_icesurface_clip.vrt') -GEBCO_ANTARCTIC_ICESURFACE_FULL_VRT = os.path.join(PATH_GEBCO,'gebco_antarctic_icesurface_full.vrt') -GEBCO_ANTARCTIC_ICESURFACE_TMP1 = os.path.join(PATH_GEBCO,'gebco_antarctic_icesurface_tmp1.tif') -GEBCO_ANTARCTIC_ICESURFACE_TMP2 = os.path.join(PATH_GEBCO,'gebco_antarctic_icesurface_tmp2.tif') -GEBCO_ANTARCTIC_ICESURFACE = os.path.join(PATH_GEBCO,'gebco_antarctic_icesurface.tif') -GEBCO_ANTARCTIC_ICESURFACE_HILLSHADE = os.path.join(PATH_GEBCO,'gebco_antarctic_icesurface_hillshade.tif') +GEBCO_ANTARCTIC_ICESURFACE_CLIP_VRT = PATH_GEBCO / 'gebco_antarctic_icesurface_clip.vrt' +GEBCO_ANTARCTIC_ICESURFACE_FULL_VRT = PATH_GEBCO / 'gebco_antarctic_icesurface_full.vrt' +GEBCO_ANTARCTIC_ICESURFACE_TMP1 = PATH_GEBCO / 'gebco_antarctic_icesurface_tmp1.tif' +GEBCO_ANTARCTIC_ICESURFACE_TMP2 = PATH_GEBCO / 'gebco_antarctic_icesurface_tmp2.tif' +GEBCO_ANTARCTIC_ICESURFACE = PATH_GEBCO / 'gebco_antarctic_icesurface.tif' +GEBCO_ANTARCTIC_ICESURFACE_HILLSHADE = PATH_GEBCO / 'gebco_antarctic_icesurface_hillshade.tif' # GEBCO Antarctic sub ice -GEBCO_ANTARCTIC_SUBICE_CLIP_VRT = os.path.join(PATH_GEBCO,'gebco_antarctic_subice_clip.vrt') -GEBCO_ANTARCTIC_SUBICE_FULL_VRT = os.path.join(PATH_GEBCO,'gebco_antarctic_subice_full.vrt') -GEBCO_ANTARCTIC_SUBICE = os.path.join(PATH_GEBCO,'gebco_antarctic_subice.tif') -GEBCO_ANTARCTIC_SUBICE_HILLSHADE = os.path.join(PATH_GEBCO,'gebco_antarctic_subice_hillshade.tif') +GEBCO_ANTARCTIC_SUBICE_CLIP_VRT = PATH_GEBCO / 'gebco_antarctic_subice_clip.vrt' +GEBCO_ANTARCTIC_SUBICE_FULL_VRT = PATH_GEBCO / 'gebco_antarctic_subice_full.vrt' +GEBCO_ANTARCTIC_SUBICE = PATH_GEBCO / 'gebco_antarctic_subice.tif' +GEBCO_ANTARCTIC_SUBICE_HILLSHADE = PATH_GEBCO / 'gebco_antarctic_subice_hillshade.tif' # Antarctic combined -GEBCO_ANTARCTIC = os.path.join(PATH_GEBCO,'gebco_antarctic.tif') -GEBCO_ANTARCTIC_HILLSHADE = os.path.join(PATH_GEBCO,'gebco_antarctic_hillshade.tif') +GEBCO_ANTARCTIC = PATH_GEBCO / 'gebco_antarctic.tif' +GEBCO_ANTARCTIC_HILLSHADE = PATH_GEBCO / 'gebco_antarctic_hillshade.tif' -#============================================================================= +# ============================================================================ # temporary files for final shading -TMP_RGB = os.path.join(PATH_GEBCO,'tmp_rgb.tif') -TMP_SHADED = os.path.join(PATH_GEBCO,'tmp_shaded.tif') - +TMP_RGB = PATH_GEBCO / 'tmp_rgb.tif' +TMP_SHADED = PATH_GEBCO / 'tmp_shaded.tif' -#============================================================================= +# ============================================================================ # PROJECTIONS -#============================================================================= +# ============================================================================ # The EPSG codes for the three map projections only need to be changed, if a # different projection is required for the Map Viewers. # EPSG code for World Basemap -EPSG_WORLD = 'EPSG:4326' # WGS84 / Geographic +EPSG_WORLD = 4326 # WGS84 / Geographic # EPSG code for Arctic Basemap -EPSG_ARCTIC = 'EPSG:3995' # WGS 84 / Arctic Polar Stereographic +EPSG_ARCTIC = 3995 # WGS 84 / Arctic Polar Stereographic # EPSG code for Antarctic Basemap -EPSG_ANTARCTIC = 'EPSG:3031' # WGS 84 / Antarctic Polar Stereographic +EPSG_ANTARCTIC = 3031 # WGS 84 / Antarctic Polar Stereographic - -#============================================================================= +# ============================================================================ # MAP VERSIONS -#============================================================================= +# ============================================================================ # In this section the different map versions are defined, based on the World, -# Arctic and Antarctic files. The version defintion includes output, name and +# Arctic and Antarctic files. The version definition includes output, name and # color palette information. -#============================================================================= +# ============================================================================ # Final Output: # blue colors -BASEMAP_WORLD_BLUE = os.path.join(PATH_RESULT,'AWI_Basemap_World_blue.tif') -BASEMAP_ARCTIC_BLUE = os.path.join(PATH_RESULT,'AWI_Basemap_Arctic_blue.tif') -BASEMAP_ANTARCTIC_BLUE = os.path.join(PATH_RESULT,'AWI_Basemap_Antarctic_blue.tif') +BASEMAP_WORLD_BLUE = PATH_RESULT / 'AWI_Basemap_World_blue.tif' +BASEMAP_ARCTIC_BLUE = PATH_RESULT / 'AWI_Basemap_Arctic_blue.tif' +BASEMAP_ANTARCTIC_BLUE = PATH_RESULT / 'AWI_Basemap_Antarctic_blue.tif' # greyblue colors -BASEMAP_WORLD_GREYBLUE = os.path.join(PATH_RESULT,'AWI_Basemap_World_greyblue.tif') -BASEMAP_ARCTIC_GREYBLUE = os.path.join(PATH_RESULT,'AWI_Basemap_Arctic_greyblue.tif') -BASEMAP_ANTARCTIC_GREYBLUE = os.path.join(PATH_RESULT,'AWI_Basemap_Antarctic_greyblue.tif') +BASEMAP_WORLD_GREYBLUE = PATH_RESULT / 'AWI_Basemap_World_greyblue.tif' +BASEMAP_ARCTIC_GREYBLUE = PATH_RESULT / 'AWI_Basemap_Arctic_greyblue.tif' +BASEMAP_ANTARCTIC_GREYBLUE = PATH_RESULT / 'AWI_Basemap_Antarctic_greyblue.tif' # grey colors -BASEMAP_WORLD_GREY = os.path.join(PATH_RESULT,'AWI_Basemap_World_grey.tif') -BASEMAP_ARCTIC_GREY = os.path.join(PATH_RESULT,'AWI_Basemap_Arctic_grey.tif') -BASEMAP_ANTARCTIC_GREY = os.path.join(PATH_RESULT,'AWI_Basemap_Antarctic_grey.tif') +BASEMAP_WORLD_GREY = PATH_RESULT / 'AWI_Basemap_World_grey.tif' +BASEMAP_ARCTIC_GREY = PATH_RESULT / 'AWI_Basemap_Arctic_grey.tif' +BASEMAP_ANTARCTIC_GREY = PATH_RESULT / 'AWI_Basemap_Antarctic_grey.tif' -#============================================================================= +# ============================================================================ # color palettes -CP_BLUE = os.path.abspath(os.path.join('..','styles','color_palettes','basemap_blue.txt')) -CP_GREYBLUE = os.path.abspath(os.path.join('..','styles','color_palettes','basemap_greyblue.txt')) -CP_GREY = os.path.abspath(os.path.join('..','styles','color_palettes','basemap_grey.txt')) +CP_BLUE = Path('..', 'styles', 'color_palettes', 'basemap_blue.txt').resolve() +CP_GREYBLUE = Path('..', 'styles', 'color_palettes', 'basemap_greyblue.txt').resolve() +CP_GREY = Path('..', 'styles', 'color_palettes', 'basemap_grey.txt').resolve() -#============================================================================= +# ============================================================================ # map combinations to be compiled at the end MAPS = [ - {'name' : 'AWI Basemap World blue', - 'grid' : GEBCO_WORLD, - 'hillshade' : GEBCO_WORLD_HILLSHADE, - 'color_palette' : CP_BLUE, - 'epsg' : EPSG_WORLD, - 'output' : BASEMAP_WORLD_BLUE}, - - {'name' : 'AWI Basemap Arctic blue', - 'grid' : GEBCO_ARCTIC, - 'hillshade' : GEBCO_ARCTIC_HILLSHADE, - 'color_palette' : CP_BLUE, - 'epsg' : EPSG_ARCTIC, - 'output' : BASEMAP_ARCTIC_BLUE}, - - {'name' : 'AWI Basemap Antarctic blue', - 'grid' : GEBCO_ANTARCTIC, - 'hillshade' : GEBCO_ANTARCTIC_HILLSHADE, - 'color_palette' : CP_BLUE, - 'epsg' : EPSG_ANTARCTIC, - 'output' : BASEMAP_ANTARCTIC_BLUE}, - - {'name' : 'AWI Basemap World greyblue', - 'grid' : GEBCO_WORLD, - 'hillshade' : GEBCO_WORLD_HILLSHADE, - 'color_palette' : CP_GREYBLUE, - 'epsg' : EPSG_WORLD, - 'output' : BASEMAP_WORLD_GREYBLUE }, - - {'name' : 'AWI Basemap Arctic greyblue', - 'grid' : GEBCO_ARCTIC, - 'hillshade' : GEBCO_ARCTIC_HILLSHADE, - 'color_palette' : CP_GREYBLUE, - 'epsg' : EPSG_ARCTIC, - 'output' : BASEMAP_ARCTIC_GREYBLUE }, - - {'name' : 'AWI Basemap Antarctic greyblue', - 'grid' : GEBCO_ANTARCTIC, - 'hillshade' : GEBCO_ANTARCTIC_HILLSHADE, - 'color_palette' : CP_GREYBLUE, - 'epsg' : EPSG_ANTARCTIC, - 'output' : BASEMAP_ANTARCTIC_GREYBLUE }, - - {'name' : 'AWI Basemap World grey', - 'grid' : GEBCO_WORLD, - 'hillshade' : GEBCO_WORLD_HILLSHADE, - 'color_palette' : CP_GREY, - 'epsg' : EPSG_WORLD, - 'output' : BASEMAP_WORLD_GREY }, - - {'name' : 'AWI Basemap Arctic grey', - 'grid' : GEBCO_ARCTIC, - 'hillshade' : GEBCO_ARCTIC_HILLSHADE, - 'color_palette' : CP_GREY, - 'epsg' : EPSG_ARCTIC, - 'output' : BASEMAP_ARCTIC_GREY }, - - {'name' : 'AWI Basemap Antarctic grey', - 'grid' : GEBCO_ANTARCTIC, - 'hillshade' : GEBCO_ANTARCTIC_HILLSHADE, - 'color_palette' : CP_GREY, - 'epsg' : EPSG_ANTARCTIC, - 'output' : BASEMAP_ANTARCTIC_GREY }, + {'name': 'AWI Basemap World blue', + 'grid': GEBCO_WORLD, + 'hillshade': GEBCO_WORLD_HILLSHADE, + 'color_palette': CP_BLUE, + 'epsg': EPSG_WORLD, + 'output': BASEMAP_WORLD_BLUE}, + + {'name': 'AWI Basemap Arctic blue', + 'grid': GEBCO_ARCTIC, + 'hillshade': GEBCO_ARCTIC_HILLSHADE, + 'color_palette': CP_BLUE, + 'epsg': EPSG_ARCTIC, + 'output': BASEMAP_ARCTIC_BLUE}, + + {'name': 'AWI Basemap Antarctic blue', + 'grid': GEBCO_ANTARCTIC, + 'hillshade': GEBCO_ANTARCTIC_HILLSHADE, + 'color_palette': CP_BLUE, + 'epsg': EPSG_ANTARCTIC, + 'output': BASEMAP_ANTARCTIC_BLUE}, + + {'name': 'AWI Basemap World greyblue', + 'grid': GEBCO_WORLD, + 'hillshade': GEBCO_WORLD_HILLSHADE, + 'color_palette': CP_GREYBLUE, + 'epsg': EPSG_WORLD, + 'output': BASEMAP_WORLD_GREYBLUE}, + + {'name': 'AWI Basemap Arctic greyblue', + 'grid': GEBCO_ARCTIC, + 'hillshade': GEBCO_ARCTIC_HILLSHADE, + 'color_palette': CP_GREYBLUE, + 'epsg': EPSG_ARCTIC, + 'output': BASEMAP_ARCTIC_GREYBLUE}, + + {'name': 'AWI Basemap Antarctic greyblue', + 'grid': GEBCO_ANTARCTIC, + 'hillshade': GEBCO_ANTARCTIC_HILLSHADE, + 'color_palette': CP_GREYBLUE, + 'epsg': EPSG_ANTARCTIC, + 'output': BASEMAP_ANTARCTIC_GREYBLUE}, + + {'name': 'AWI Basemap World grey', + 'grid': GEBCO_WORLD, + 'hillshade': GEBCO_WORLD_HILLSHADE, + 'color_palette': CP_GREY, + 'epsg': EPSG_WORLD, + 'output': BASEMAP_WORLD_GREY}, + + {'name': 'AWI Basemap Arctic grey', + 'grid': GEBCO_ARCTIC, + 'hillshade': GEBCO_ARCTIC_HILLSHADE, + 'color_palette': CP_GREY, + 'epsg': EPSG_ARCTIC, + 'output': BASEMAP_ARCTIC_GREY}, + + {'name': 'AWI Basemap Antarctic grey', + 'grid': GEBCO_ANTARCTIC, + 'hillshade': GEBCO_ANTARCTIC_HILLSHADE, + 'color_palette': CP_GREY, + 'epsg': EPSG_ANTARCTIC, + 'output': BASEMAP_ANTARCTIC_GREY}, ] -METADATA_FILE = os.path.join(PATH_RESULT,'AWI_Basemap_Metadata.txt') - +# additional output +METADATA_FILE = PATH_RESULT / 'AWI_Basemap_Metadata.txt' +SERVICE_CONF_FILE = PATH_RESULT / 'service.conf' -#============================================================================= +# ============================================================================ # OPERATIONAL PARAMETERS -#============================================================================= +# ============================================================================ # The following settings are operational parameters for the process. If the # temporary GeoTIFFs created by GDAL shall be created with different create @@ -384,23 +376,25 @@ METADATA_FILE = os.path.join(PATH_RESULT,'AWI_Basemap_Metadata.txt') # results, however, are specified in the last python script. # GDAL creation options -GDAL_CREATE_OPTIONS = '-co COMPRESS=NONE -co BIGTIFF=IF_NEEDED' -#GDAL_CREATE_OPTIONS = '-co COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=9 -co BIGTIFF=YES' +# GDAL_CREATE_OPTIONS = '-co COMPRESS=NONE -co BIGTIFF=IF_NEEDED' +# GDAL_CREATE_OPTIONS = '-co COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=9 -co BIGTIFF=YES' +GDAL_CREATE_OPTIONS = '-co COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=9 -co BIGTIFF=IF_NEEDED' # GDAL creation options for python modules -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=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=IF_NEEDED' # GDAL warp options WARP_OPTIONS = '-wo SOURCE_EXTRA=1000 -et 0' -#============================================================================= +# ============================================================================ # RUN FUNCTION -#============================================================================= +# ============================================================================ # function to run a shell command and print a message to stdout -def run(msg,cmd): +def run(msg, cmd): print('====================================================================') print() print(msg) @@ -411,38 +405,39 @@ def run(msg,cmd): print() -#============================================================================= +# ============================================================================ # CLEANUP -#============================================================================= +# ============================================================================ # list of temporary files that shall not be deleted DONT_DELETE = [ - #ADD_SHELF_ICE, - #ADD_ICE_SHEET, - #ADD_ROCK_OUTCROP, - #GIMP_RASTER, - #GIMP, - #GLIMS_WORLD, - #GLIMS_ARCTIC, - #GLIMS_ANTARCTIC, - #GEBCO_WORLD_ICESURFACE, - #GEBCO_WORLD_ICESURFACE_HILLSHADE, - #GEBCO_WORLD_SUBICE, - #GEBCO_WORLD_SUBICE_HILLSHADE, - #GEBCO_WORLD, - #GEBCO_WORLD_HILLSHADE, - #GEBCO_ARCTIC, - #GEBCO_ARCTIC_HILLSHADE, - #GEBCO_ANTARCTIC_ICESURFACE, - #GEBCO_ANTARCTIC_ICESURFACE_HILLSHADE, - #GEBCO_ANTARCTIC_SUBICE, - #GEBCO_ANTARCTIC_SUBICE_HILLSHADE, - #GEBCO_ANTARCTIC, - #GEBCO_ANTARCTIC_HILLSHADE + # ADD_SHELF_ICE, + # ADD_ICE_SHEET, + # ADD_ROCK_OUTCROP, + # GIMP_RASTER, + # GIMP, + # GLIMS_WORLD, + # GLIMS_ARCTIC, + # GLIMS_ANTARCTIC, + # GEBCO_WORLD_ICESURFACE, + # GEBCO_WORLD_ICESURFACE_HILLSHADE, + # GEBCO_WORLD_SUBICE, + # GEBCO_WORLD_SUBICE_HILLSHADE, + # GEBCO_WORLD, + # GEBCO_WORLD_HILLSHADE, + # GEBCO_ARCTIC, + # GEBCO_ARCTIC_HILLSHADE, + # GEBCO_ANTARCTIC_ICESURFACE, + # GEBCO_ANTARCTIC_ICESURFACE_HILLSHADE, + # GEBCO_ANTARCTIC_SUBICE, + # GEBCO_ANTARCTIC_SUBICE_HILLSHADE, + # GEBCO_ANTARCTIC, + # GEBCO_ANTARCTIC_HILLSHADE ] -# function to cleanup temporary files if they are not in the DONT_DELETE list + +# function to clean up temporary files if they are not in the DONT_DELETE list def cleanup(dataset): if dataset not in DONT_DELETE: - if os.path.isfile(dataset): - os.remove(dataset) + if dataset.is_file(): + dataset.unlink() -- GitLab