# -*- coding: utf-8 -*- """ #################################################################### # # # AWI Basemap # # CONFIGURATION # # # #################################################################### This script holds the configuration for the AWI Basemap creation process. Adjust the settings the below and the other basemap python scripts will source these settings. The following can be adjusted here: - Input folder paths - Input file paths - General create options (like resolution, extent, etc.) - Paths to temporary files - Output file paths - Operational parameters for the commands - A small set of functions used by the other scripts """ #============================================================================= # SCRIPT INFO #============================================================================= __author__ = 'Simon Dreutter' __version__ = '0.1' __date__ = '2020-12-17' __email__ = 'simon.dreutter@awi.de' __status__ = 'Developement' #============================================================================= # IMPORT #============================================================================= # import standard libraries import os #============================================================================= # INPUT FOLDERS #============================================================================= # path to data directory PATH_DATA = os.path.abspath(os.path.join('..','data')) # 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 to result directory PATH_RESULT = os.path.abspath(os.path.join('..','result')) #============================================================================= # INPUT FILES #============================================================================= # input filepath to ADD Coastlines ADD_COASTLINE_IN = os.path.join(PATH_ADD,'add_coastline_medium_res_polygon_v7.3.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') # input filepath to GEBCO netCDF grid GEBCO_IN = os.path.join(PATH_GEBCO,'GEBCO_2020.nc') # input filepath to GIMP GeoTIFF GIMP_IN = os.path.join(PATH_GIMP,'GimpIceMask_90m_v1.1.tif') # input filepath to GLIMS Esri Shapefile GLIMS_IN = os.path.join(PATH_GLIMS,'glims_polygons.shp') # color palettes CP_DEFAULT = os.path.abspath(os.path.join('..','styles','color_palettes','basemap_default.txt')) CP_BRIGHT = os.path.abspath(os.path.join('..','styles','color_palettes','basemap_bright.txt')) CP_DARK = os.path.abspath(os.path.join('..','styles','color_palettes','basemap_dark.txt')) #============================================================================= # GENERAL CREATE OPTIONS #============================================================================= # Final AWI Basemap (World) resolution # 15 arc seconds (original GEBCO resolution) #RESOLUTION_DEG = 0.004166666666666666 # 30 arc seconds RESOLUTION_DEG = 0.008333333333333333 #RESOLUTION_DEG = 0.025 # DEBUGGING # Final AWI Basemap (Arctic and Antarctic) resolution # pendant to 15 arc seconds RESOLUTION_M = 500.0 # pendant to 30 arc seconds #RESOLUTION_M = 1000.0 # number of pixels for interpolation (fill NoData at poles) INTERPOLATION = 1 / RESOLUTION_M * 5000 # DEBUGGING # GIMP Resolution # 7.5 arc seconds (half the original GEBCO resolution) GIMP_RESOLUTION = 0.0020833333333333333 #GIMP_RESOLUTION = 0.01 # DEBUGGING # Hillshade z factor / vertical exaggeration Z_FACTOR = 10.0 # 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 #============================================================================= # TEMPORARY FILES #============================================================================= # ADD: # ADD land with cut rock outcrops ADD_ICE_SHEET = os.path.join(PATH_ADD,'add_ice_sheet.gpkg') # ADD ice mask ADD_SHELF_ICE = os.path.join(PATH_ADD,'add_shelf_ice.gpkg') # ADD rock outcrops ADD_ROCK_OUTCROP = os.path.join(PATH_ADD,'add_rock_outcrop.gpkg') #============================================================================= # GIMP: # GIMP raster GIMP_RASTER = os.path.join(PATH_GIMP,'GimpIceMask.tif') # GIMP vector GIMP = os.path.join(PATH_GIMP,'GimpIceMask.gpkg') #============================================================================= # GLIMS: # GLIMS World GLIMS_WORLD = os.path.join(PATH_GLIMS,'glims_world.gpkg') # GLIMS Arctic GLIMS_ARCTIC = os.path.join(PATH_GLIMS,'glims_arctic.gpkg') # GLIMS Antarctic GLIMS_ANTARCTIC = os.path.join(PATH_GLIMS,'glims_antarctic.gpkg') #============================================================================= # GEBCO: # GEBCO World GEBCO_WORLD = os.path.join(PATH_GEBCO,'GEBCO_world.tif') GEBCO_WORLD_HILLSHADE = os.path.join(PATH_GEBCO,'GEBCO_world_hillshade.tif') #GEBCO_WORLD_RGB = os.path.join(PATH_GEBCO,'GEBCO_world_rgb.tif') # GEBCO Arctic GEBCO_ARCTIC_CLIP = os.path.join(PATH_GEBCO,'GEBCO_arctic_clip.tif') GEBCO_ARCTIC_CLIP_VRT = os.path.join(PATH_GEBCO,'GEBCO_arctic_clip.vrt') # DEBUGGING GEBCO_ARCTIC_FULL = os.path.join(PATH_GEBCO,'GEBCO_arctic_full.tif') # DEBUGGING GEBCO_ARCTIC_FULL_VRT = os.path.join(PATH_GEBCO,'GEBCO_arctic_full.vrt') # DEBUGGING GEBCO_ARCTIC = os.path.join(PATH_GEBCO,'GEBCO_arctic.tif') GEBCO_ARCTIC_HILLSHADE = os.path.join(PATH_GEBCO,'GEBCO_arctic_hillshade.tif') #GEBCO_ARCTIC_RGB = os.path.join(PATH_GEBCO,'GEBCO_arctic_rgb.tif') # GEBCO Antarctic GEBCO_ANTARCTIC_CLIP = os.path.join(PATH_GEBCO,'GEBCO_antarctic_clip.tif') GEBCO_ANTARCTIC_CLIP_VRT = os.path.join(PATH_GEBCO,'GEBCO_antarctic_clip.vrt') # DEBUGGING GEBCO_ANTARCTIC_FULL = os.path.join(PATH_GEBCO,'GEBCO_antarctic_full.tif') # DEBUGGING GEBCO_ANTARCTIC_FULL_VRT = os.path.join(PATH_GEBCO,'GEBCO_antarctic_full.vrt') # DEBUGGING GEBCO_ANTARCTIC = os.path.join(PATH_GEBCO,'GEBCO_antarctic.tif') GEBCO_ANTARCTIC_HILLSHADE = os.path.join(PATH_GEBCO,'GEBCO_antarctic_hillshade.tif') #GEBCO_ANTARCTIC_RGB = os.path.join(PATH_GEBCO,'GEBCO_antarctic_rgb.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') #============================================================================= # Final Output: # default colors BASEMAP_WORLD = os.path.join(PATH_RESULT,'AWI_Basemap_World.tif') BASEMAP_ARCTIC = os.path.join(PATH_RESULT,'AWI_Basemap_Arctic.tif') BASEMAP_ANTARCTIC = os.path.join(PATH_RESULT,'AWI_Basemap_Antarctic.tif') # bright colors BASEMAP_WORLD_BRIGHT = os.path.join(PATH_RESULT,'AWI_Basemap_World_bright.tif') BASEMAP_ARCTIC_BRIGHT = os.path.join(PATH_RESULT,'AWI_Basemap_Arctic_bright.tif') BASEMAP_ANTARCTIC_BRIGHT = os.path.join(PATH_RESULT,'AWI_Basemap_Antarctic_bright.tif') # dark colors BASEMAP_WORLD_DARK = os.path.join(PATH_RESULT,'AWI_Basemap_World_dark.tif') BASEMAP_ARCTIC_DARK = os.path.join(PATH_RESULT,'AWI_Basemap_Arctic_dark.tif') BASEMAP_ANTARCTIC_DARK = os.path.join(PATH_RESULT,'AWI_Basemap_Antarctic_dark.tif') #============================================================================= # PROJECTIONS #============================================================================= # EPSG code for World Basemap EPSG_WORLD = 'EPSG:4326' # EPSG code for Arctic Basemap EPSG_ARCTIC = 'EPSG:3995' # EPSG code for Antarctic Basemap EPSG_ANTARCTIC = 'EPSG:3031' #============================================================================= # OPERATIONAL PARAMETERS #============================================================================= # Python executable PYTHON = 'python3' # GDAL creation options #GDAL_CREATE_OPTIONS = '-co COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=9 -co BIGTIFF=YES' GDAL_CREATE_OPTIONS = '' # GDAL creation options for python modules #GDAL_CREATE_OPTIONS_PY = '--co COMPRESS=DEFLATE --co PREDICTOR=2 --co ZLEVEL=9 --co BIGTIFF=YES' GDAL_CREATE_OPTIONS_PY = '' # Warp options for gdalwarp SOURCE_EXTRA = 1500 MEM = 750 GDAL_CACHEMAX = 9000 WARP_OPTIONS = f'-wo SOURCE_EXTRA={SOURCE_EXTRA} -wm {MEM} -multi -wo NUM_THTEADS=ALL_CGUS -et 0' # Method to create overviews OVERVIEW_METHOD = 'cubic' #============================================================================= # RUN FUNCTION #============================================================================= def run(msg,cmd): print('===================================================') print() print(msg) print() os.system(cmd) print() #============================================================================= # CLEANUP #============================================================================= DONT_DELETE = [ GEBCO_WORLD, GEBCO_WORLD_HILLSHADE, GEBCO_ARCTIC, GEBCO_ARCTIC_HILLSHADE, GEBCO_ANTARCTIC, GEBCO_ANTARCTIC_HILLSHADE ] def cleanup(dataset): if dataset not in DONT_DELETE: if os.path.isfile(dataset): os.remove(dataset)