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

initial commit (py version)

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 1253 additions and 0 deletions
# Basemap
Utility to create the **AWI Basemap** for [maps.awi.de](maps.awi.de), [data.awi.de](data.awi.de) and [marine-data.de](marine-data.de).
## Description
The above mentioned websites use a global basemap with a colored and shaded digital elevation model (DEM) as a background. This basemap is an RGB GeoTIFF created from various geodata sources that need to be analysed (hillshade, slope), converted (raster to vector, vector to raster calculation), combined, colored and rendered to RGB. To ease the update process (e.g. new GEBCO version or any ofther data sources updated) this git provides the tools to create and update the **AWI Basemap**, as well as scripts to automate the process.
At this point, the **AWI Basemap**s is available in three color sets. All three are based on the AWI blues (RGB bright: 7/172/231, RGB dark: 0/62/110). Yet, the "default" color palette reduces these blues to half their saturation, the "bright" color palette uses the blues directly, and the "dark" color palette uses the blues with a quarter of their saturation.
<!---
## Instructions
`INSTRUCTIONS.md` holds the instructions for manually creating the **AWI Basemap** with QGIS tools, as well as instructions on the usage of the scripts.
-->
## Data
In `data`, all the necessary data sources are listed. As data is not stored in this git, textfiles give information on where to download the data and in which format it needs to be available for the process.
## Process
In `process`, all the required scripts are stored.
## Styles
In `styles`, all the required color palettes and QGIS layer style files (QML) are stored.
## Sources
References and citations for data sources are listed in `SOURCES.md`.
<!--
## Results
This is how the results look like:
##### World
Default:
![AWI Basemap World Default](https://gitlab.awi.de/sdreutte/basemap/-/raw/master/images/AWI_Basemap_World.png)
Bright:
![AWI Basemap World Bright](https://gitlab.awi.de/sdreutte/basemap/-/raw/master/images/AWI_Basemap_World_bright.png)
Dark:
![AWI Basemap World Dark](https://gitlab.awi.de/sdreutte/basemap/-/raw/master/images/AWI_Basemap_World_dark.png)
##### Arctic
Default:
![AWI Basemap Arctic Default](https://gitlab.awi.de/sdreutte/basemap/-/raw/master/images/AWI_Basemap_Arctic.png)
Bright:
![AWI Basemap Arctic Bright](https://gitlab.awi.de/sdreutte/basemap/-/raw/master/images/AWI_Basemap_Arctic_bright.png)
Dark:
![AWI Basemap Arctic Dark](https://gitlab.awi.de/sdreutte/basemap/-/raw/master/images/AWI_Basemap_Arctic_dark.png)
##### Antarctic
Default:
![AWI Basemap Antarctic Default](https://gitlab.awi.de/sdreutte/basemap/-/raw/master/images/AWI_Basemap_Antarctic.png)
Bright:
![AWI Basemap Antarctic Bright](https://gitlab.awi.de/sdreutte/basemap/-/raw/master/images/AWI_BasemapAntarctic_bright.png)
Dark:
![AWI Basemap Antarctic Dark](https://gitlab.awi.de/sdreutte/basemap/-/raw/master/images/AWI_Basemap_Antarctic_dark.png)
-->
\ No newline at end of file
**General Bathymetric Chart of the Oceans (GEBCO_2020)**
GEBCO Compilation Group (2020) GEBCO 2020 Grid (doi:10.5285/a29c5465-b138-234d-e053-6c86abc040b9)
**Global Land Ice Measurements from Space (GLIMS version 20200630)**
GLIMS and NSIDC (2005, updated 2020): Global Land Ice Measurements from Space glacier database. Compiled and made available by the international GLIMS community and the National Snow and Ice Data Center, Boulder CO, U.S.A. DOI:10.7265/N5V98602
**Greenland Ice Mapping Project (GIMP version 1.1)**
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].
**SCAR Antarctic Digital Database (ADD v7.3)**
Gerrish, L., Fretwell, P., & Cooper, P. (2020). Medium resolution vector polygons of the Antarctic coastline (7.3) [Data set]. UK Polar Data Centre, Natural Environment Research Council, UK Research & Innovation. https://doi.org/10.5285/ed0a7b70-5adc-4c1e-8d8a-0bb5ee659d18
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
# SCAR Antarctic Digital Database (ADD)
## Summary
The Scientific Committee on Antarctic Research (SCAR) Antarctic Digital Database (ADD) aims to provide a seamless topographic map compiled from the best available international geographic information for all areas. It covers Antarctica south of 60°S.
The SCAR ADD consists of geographic information layers including:
- coastline
- ice-shelf grounding line
- rock outcrop
- contours
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 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.3.gpkg`
- Link: https://data.bas.ac.uk/download/f18d638d4-3c71-442f-9415-01d17842d98d
- General Link: https://data.bas.ac.uk/collections/e74543c0-4c4e-4b41-aa33-5bb2f67df389/
- Title: **Medium resolution vector polygons of Antarctic rock outcrop**
- Format: GeoPackage (GPKG)
- Filename: `add_rock_outcrop_medium_res_polygon_v7.3.gpkg`
- Links: https://data.bas.ac.uk/download/fe90d6aec-b53e-40c1-ad52-c05e03a58c1d
- General Link: https://data.bas.ac.uk/collections/e74543c0-4c4e-4b41-aa33-5bb2f67df389/
## Citation
Gerrish, L., Fretwell, P., & Cooper, P. (2020). Medium resolution vector polygons of the Antarctic coastline (7.3) [Data set]. UK Polar Data Centre, Natural Environment Research Council, UK Research & Innovation. https://doi.org/10.5285/ed0a7b70-5adc-4c1e-8d8a-0bb5ee659d18
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
# General Bathymetric Chart of the Oceans (GEBCO)
## Summary
GEBCO aims to provide the most authoritative, publicly available bathymetry data sets for the world’s oceans.
See the [GEBCO website](https://www.gebco.net) for more information.
The filename, download link and citation refer to GEBCO version 2020 and might need to be adapted when updating the dataset.
## Files to download
- Title: **GEBCO global coverage grid**
- Format: netCDF (NC)
- Filename: `GEBCO_2020.nc`
- Link: https://www.bodc.ac.uk/data/open_download/gebco/gebco_2020/zip/ (version 2020)
- General Link: https://www.gebco.net/data_and_products/gridded_bathymetry_data/
## Citation (version 2020)
GEBCO Compilation Group (2020) GEBCO 2020 Grid (doi:10.5285/a29c5465-b138-234d-e053-6c86abc040b9)
# Greenland Ice Mapping Project (GIMP)
## Summary
The objective of the Greenland Ice sheet Mapping Project (GIMP) is to establish benchmark data sets for observing ice sheet change and stability. The acquired data cover multiple years, beginning in 2000, and originate from a variety of satellites and sensors, including the U.S. Geological Survey's (USGS) and NASA's Landsat 7 and Landsat 8, the European Space Agency's (ESA) Copernicus Sentinel-1, the German Aerospace Center's (DLR) TerraSAR-X, and the Canadian Space Agency's (CSA) RADARSAT-1 and RADARSAT-2. These data include ice sheet-wide ice velocity, surface elevation, and surface morphology maps.
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.
## 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`
- General Link: https://nsidc.org/data/nsidc-0714/versions/1 (NASA Earthdata Login required)
## Citation (version 1.1)
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].
# Global Land Ice Measurements from Space (GLIMS)
## Summary
GLIMS (Global Land Ice Measurements from Space) is an initiative designed to monitor the world's glaciers primarily using data from optical satellite instruments.
See the [GLIMS website](https://www.glims.org) for more information.
The citation refers to GLIMS version 20200630 and might need to be adapted when updating the dataset.
## Files to download
- Title: **All GLIMS Data**
- Format: ESRI Shapefile (SHP)
- Filename: `glims_polygons.shp`
- Link: http://www.glims.org/download/latest
- General Link: http://www.glims.org/download/
## Citation (version 20200630)
GLIMS and NSIDC (2005, updated 2020): Global Land Ice Measurements from Space glacier database. Compiled and made available by the international GLIMS community and the National Snow and Ice Data Center, Boulder CO, U.S.A. DOI:10.7265/N5V98602
# -*- coding: utf-8 -*-
"""
####################################################################
# #
# AWI Basemap #
# PROCESS ANTARCTIC DIGITAL DATANASE DATA #
# #
####################################################################
This script is processing the Antarctic Digital Database (ADD) input
for the AWI Basemap. Input layers are the ADD coastlines and the ADD
rock outcrops. Both layers are reprojected to a global CRS
(EPSG_WORLD), coastlines are separated by shelf ice and ice sheet,
and all geometries are fixed (with zero buffer).
"""
#=============================================================================
# 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
# import AWI Basemap configuration
from config import *
#=============================================================================
# PROCESS
#=============================================================================
EPSG_ADD = 'EPSG:3031'
# name of geometry column
#geometry = 'geometry'
# 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_rock_outcrop_in_name = 'add_rock_outcrop_medium_res_polygon_v7' # inconsistancy with add 7.3 layer names
add_rock_outcrop_name = os.path.splitext(os.path.basename(ADD_ROCK_OUTCROP))[0]
msg = 'Reprojecting and extracting land mask from ADD coastlines...'
cmd = f'ogr2ogr -s_srs {EPSG_ADD} -t_srs {EPSG_WORLD} -wrapdateline -nln "{add_ice_sheet_name}" -nlt MULTIPOLYGON -f GPKG -overwrite {ADD_ICE_SHEET} {ADD_COASTLINE_IN} -dialect SQLite -sql "SELECT ST_Buffer(ST_Multi(geom),0.0) from \'{add_coastline_in_name}\' WHERE surface=\'land\'"'
run(msg,cmd)
msg = 'Reprojecting and extracting ice mask from ADD coastlines...'
cmd = f'ogr2ogr -s_srs {EPSG_ADD} -t_srs {EPSG_WORLD} -wrapdateline -nln "{add_shelf_ice_name}" -nlt MULTIPOLYGON -f GPKG -overwrite {ADD_SHELF_ICE} {ADD_COASTLINE_IN} -dialect SQLite -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)
msg = 'Reprojecting ADD rock outcrops...'
cmd = f'ogr2ogr -s_srs {EPSG_ADD} -t_srs {EPSG_WORLD} -wrapdateline -nln "{add_rock_outcrop_name}" -nlt MULTIPOLYGON -f GPKG -overwrite {ADD_ROCK_OUTCROP} {ADD_ROCK_OUTCROP_IN} -dialect SQLite -sql "SELECT ST_Buffer(ST_Multi(geom),0.0) from \'{add_rock_outcrop_in_name}\'"'
run(msg,cmd)
# -*- coding: utf-8 -*-
"""
####################################################################
# #
# AWI Basemap #
# PROCESS ANTARCTIC DIGITAL DATANASE DATA #
# #
####################################################################
This script is processing the Antarctic Digital Database (ADD) input
for the AWI Basemap. Input layers are the ADD coastlines and the ADD
rock outcrops. Both layers are reprojected to a global CRS
(EPSG_WORLD), coastlines are separated by shelf ice and ice sheet,
and the rock outcrop geometries are fixed.
"""
#=============================================================================
# SCRIPT INFO
#=============================================================================
__author__ = 'Simon Dreutter'
__version__ = '0.1'
__date__ = '2020-12-17'
__email__ = 'simon.dreutter@awi.de'
__status__ = 'Developement'
#=============================================================================
# IMPORT
#=============================================================================
# import AWI Basemap configuration
from config import *
#=============================================================================
# PROCESS
#=============================================================================
EPSG_ADD = 'EPSG:3031'
msg = 'Reprojecting and extracting land mask from ADD coastlines...'
cmd = f'ogr2ogr -s_srs {EPSG_ADD} -t_srs {EPSG_WORLD} -nln "add_coastline_land" -where "\"surface\" = \'land\'" -wrapdateline -f GPKG {ADD_COASTLINE_LAND} {ADD_COASTLINE_IN}'
run(msg,cmd)
msg = 'Reprojecting and extracting ice mask from ADD coastlines...'
cmd = f'ogr2ogr -s_srs {EPSG_ADD} -t_srs {EPSG_WORLD} -nln "add_coastline_ice" -where "\"surface\" = \'ice shelf\' OR \"surface\" = \'rumple\' OR \"surface\" = \'ocean\' OR \"surface\" = \'ice tongue\'" -wrapdateline -f GPKG {ADD_SHELF_ICE} {ADD_COASTLINE_IN}'
run(msg,cmd)
msg = 'Reprojecting ADD rock outcrops...'
cmd = f'ogr2ogr -s_srs {EPSG_ADD} -t_srs {EPSG_WORLD} -nln "add_rock_outcrop" -wrapdateline -f GPKG {ADD_ROCK_OUTCROP} {ADD_ROCK_OUTCROP_IN}'
run(msg,cmd)
msg = 'Fixing ADD rock outcrops geometries...'
cmd = f'ogr2ogr -dialect sqlite -sql "SELECT ST_Buffer(geom, 0.0) AS geom,* FROM \"add_rock_outcrop\"" -nln "add_rock_outcrop_fixed" -f GPKG {ADD_ROCK_OUTCROP_FIXED} {ADD_ROCK_OUTCROP}'
run(msg,cmd)
print()
print('ADD done!')
print()
print('Now do not forget to manually cut the rock outcrops from the ADD land layer!')
print()
input('Press Enter to exit!')
print()
#=============================================================================
# TODO
#=============================================================================
"""
- find a scripted solution for 'Difference'
- once found, add cleanup
"""
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
####################################################################
# #
# AWI Basemap #
# PROCESS ANTARCTIC DIGITAL DATANASE DATA #
# #
####################################################################
This script is processing the Antarctic Digital Database (ADD) input
for the AWI Basemap. Input layers are the ADD coastlines and the ADD
rock outcrops. Both layers are reprojected to a global CRS
(EPSG_WORLD), coastlines are separated by shelf ice and ice sheet,
and the rock outcrop geometries are fixed.
"""
#=============================================================================
# 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
# import AWI Basemap configuration
from config import *
#=============================================================================
# PROCESS
#=============================================================================
EPSG_ADD = 'EPSG:3031'
# name of geometry column
geometry = 'geometry'
# layer names
add_coastline_in_name = os.path.splitext(os.path.basename(ADD_COASTLINE_IN))[0]
add_coastline_land_name = os.path.splitext(os.path.basename(ADD_COASTLINE_LAND))[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_rock_outcrop_in_name = 'add_rock_outcrop_medium_res_polygon_v7' # inconsistancy with add layer names
add_rock_outcrop_name = os.path.splitext(os.path.basename(ADD_ROCK_OUTCROP))[0]
add_rock_outcrop_fixed_name = os.path.splitext(os.path.basename(ADD_ROCK_OUTCROP_FIXED))[0]
msg = 'Reprojecting and extracting land mask from ADD coastlines...'
cmd = f'ogr2ogr -s_srs {EPSG_ADD} -t_srs {EPSG_WORLD} -wrapdateline -nln "{add_coastline_land_name}" -nlt MULTIPOLYGON -f "ESRI Shapefile" -overwrite {ADD_COASTLINE_LAND} {ADD_COASTLINE_IN} -dialect SQLite -sql "SELECT ST_Multi(geom) from \'{add_coastline_in_name}\' WHERE surface=\'land\'"'
run(msg,cmd)
msg = 'Reprojecting and extracting ice mask from ADD coastlines...'
cmd = f'ogr2ogr -s_srs {EPSG_ADD} -t_srs {EPSG_WORLD} -wrapdateline -nln "{add_shelf_ice_name}" -nlt MULTIPOLYGON -f GPKG -overwrite {ADD_SHELF_ICE} {ADD_COASTLINE_IN} -dialect SQLite -sql "SELECT ST_Multi(geom) from \'{add_coastline_in_name}\' WHERE surface IN (\'ice shelf\',\'rumple\',\'ocean\',\'ice tongue\')"'
run(msg,cmd)
msg = 'Reprojecting and fixing ADD rock outcrops...'
cmd = f'ogr2ogr -s_srs {EPSG_ADD} -t_srs {EPSG_WORLD} -wrapdateline -nln "{add_rock_outcrop_name}" -nlt MULTIPOLYGON -f "ESRI Shapefile" -overwrite {ADD_ROCK_OUTCROP} {ADD_ROCK_OUTCROP_IN} -dialect SQLite -sql "SELECT ST_Buffer(ST_Multi(geom),0.0) from \'{add_rock_outcrop_in_name}\'"'
run(msg,cmd)
msg = 'Cutting rock outcrops from ice sheet...'
cmd = f'ogr2ogr -dialect SQLite -sql "select ST_Difference(a.{geometry}, ST_Simplify(b.{geometry},500)) as {geometry} from {add_coastline_land_name} as a, \'{ADD_ROCK_OUTCROP}\'.{add_rock_outcrop_name} as b" -overwrite -f GPKG {ADD_ICE_SHEET} {ADD_COASTLINE_LAND}'
run(msg,cmd)
#msg = 'Fixing ADD rock outcrops geometries...'
#cmd = f'ogr2ogr -dialect sqlite -sql "SELECT ST_Buffer({geometry}, 0.0) AS {geometry},* FROM \"{add_rock_outcrop_name}\"" -nln "{add_rock_outcrop_fixed_name}" -overwrite -f "ESRI Shapefile" {ADD_ROCK_OUTCROP_FIXED} {ADD_ROCK_OUTCROP}'
#run(msg,cmd)
#msg = 'Cutting rock outcrops from ice sheet...'
#cmd = f'ogr2ogr -dialect SQLite -sql "select ST_Difference(a.{geometry}, ST_Simplify(b.{geometry},500)) as {geometry} from {add_coastline_land_name} as a, \'{ADD_ROCK_OUTCROP_FIXED}\'.{add_rock_outcrop_fixed_name} as b" -overwrite -f "ESRI Shapefile" {ADD_ICE_SHEET} {ADD_COASTLINE_LAND}'
#run(msg,cmd)
#=============================================================================
# TODO
#=============================================================================
"""
- find a scripted solution for 'Difference'
- once found, add cleanup
"""
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
####################################################################
# #
# AWI Basemap #
# PROCESS GREENLAND ICE MAPPING PROJECT DATA #
# #
####################################################################
This script is processing the Greenland Ice Mapping Project (GIMP)
input for the AWI Basemap. The raster is downsampled for easier data
handling and then polygonized to get a vector dataset.
"""
#=============================================================================
# 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
# import AWI Basemap configuration
from config import *
#=============================================================================
# PROCESS
#=============================================================================
# layer names
gimp_name = os.path.splitext(os.path.basename(GIMP))[0]
msg = 'Reprojecting and downsampling GIMP raster...'
cmd = f'gdalwarp -t_srs {EPSG_WORLD} -dstnodata 0.0 -tr {GIMP_RESOLUTION} {GIMP_RESOLUTION} -r near -of GTiff {GIMP_IN} {GIMP_RASTER}'
#{GDAL_CREATE_OPTIONS}
run(msg,cmd)
msg = 'Polygonizing GIMP raster...'
cmd = f'{PYTHON} -m gdal_polygonize {GIMP_RASTER} {GIMP} -b 1 -f "GPKG" {gimp_name} DN'
run(msg,cmd)
cleanup(GIMP_RASTER)
# -*- coding: utf-8 -*-
"""
####################################################################
# #
# AWI Basemap #
# PROCESS GLOBAL LAND ICE MEASUREMENTS FROM SPACE DATA #
# #
####################################################################
This script is processing the Global Land Ice Measurements from
Space (GLIMS) input for the AWI Basemap. The GLIMS geometries are
fixed and the global dataset is clipped for the Arctic and the
Antarctic.
"""
#=============================================================================
# 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
# 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]
msg = 'Fixing GLIMS geometries...'
cmd = f'ogr2ogr {GLIMS_WORLD} {GLIMS_IN} -dialect sqlite -sql "SELECT ST_Buffer(geometry, 0.0) AS geometry,* FROM \"{glims_in_name}\"" -nln "{glims_world_name}" -f "GPKG"'
run(msg,cmd)
msg = 'Clipping GLIMS for the Arctic...'
cmd = f'ogr2ogr -spat -180.0 90.0 180.0 {ARCTIC_EXTENT_LAT} -clipsrc spat_extent {GLIMS_ARCTIC} {GLIMS_WORLD} {glims_world_name} -nln "{glims_arctic_name}" -f "GPKG"'
run(msg,cmd)
msg = 'Clipping GLIMS for the Antarctic...'
cmd = f'ogr2ogr -spat -180.0 {ANTARCTIC_EXTENT_LAT} 180.0 -90.0 -clipsrc spat_extent {GLIMS_ANTARCTIC} {GLIMS_WORLD} {glims_world_name} -nln "{glims_antarctic_name}" -f "GPKG"'
run(msg,cmd)
# -*- coding: utf-8 -*-
"""
####################################################################
# #
# AWI Basemap #
# PROCESS GENERAL BATHYMETRIC CHART OF THE OCEANS DATA #
# #
####################################################################
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
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).
"""
#=============================================================================
# SCRIPT INFO
#=============================================================================
__author__ = 'Simon Dreutter'
__version__ = '0.1'
__date__ = '2020-12-17'
__email__ = 'simon.dreutter@awi.de'
__status__ = 'Developement'
#=============================================================================
# IMPORT
#=============================================================================
# import AWI Basemap configuration
from config import *
#=============================================================================
# PROCESS
#=============================================================================
msg = 'Resampling GEBCO...'
cmd = f'gdalwarp {WARP_OPTIONS} -s_srs {EPSG_WORLD} -t_srs {EPSG_WORLD} -tr {RESOLUTION_DEG} {RESOLUTION_DEG} -r cubic -of GTiff {GEBCO_IN} {GEBCO_WORLD}'
# {GDAL_CREATE_OPTIONS}
#run(msg,cmd)
msg = 'Clipping GEBCO for the Arctic...'
cmd = f'gdal_translate -projwin -180.0 90.0 180.0 {ARCTIC_EXTENT_LAT} -of VRT {GEBCO_IN} {GEBCO_ARCTIC_CLIP_VRT}'
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}'
#{WARP_OPTIONS}
run(msg,cmd)
msg = 'Resampling Arctic to target resolution...'
cmd = f'gdalwarp {WARP_OPTIONS} -s_srs {EPSG_ARCTIC} -t_srs {EPSG_ARCTIC} -tr {RESOLUTION_M} {RESOLUTION_M} -r cubic -of GTiff {GEBCO_ARCTIC_FULL_VRT} {TMP_POLAR}'
#{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 -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}'
#{WARP_OPTIONS}
run(msg,cmd)
msg = 'Resampling Antarctic to target resolution...'
cmd = f'gdalwarp {WARP_OPTIONS} -s_srs {EPSG_ANTARCTIC} -t_srs {EPSG_ANTARCTIC} -tr {RESOLUTION_M} {RESOLUTION_M} -r cubic -of GTiff {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}'
run(msg,cmd)
cleanup(TMP_POLAR)
# /TEMPORARY
cleanup(GEBCO_ARCTIC_CLIP_VRT)
cleanup(GEBCO_ARCTIC_FULL_VRT)
cleanup(GEBCO_ANTARCTIC_CLIP_VRT)
cleanup(GEBCO_ANTARCTIC_FULL_VRT)
#=============================================================================
# NOTES / TODO
#=============================================================================
"""
The current solution for creating the polar stereographic GEBCO grids (VRT)
produces holes on the north and south pole. Another solution needs to be
found. Normal clip and warp however produces issues:
- Nearest Neighbor: raster artifacts
- Cubic (and others): dateline blur
What to do?
- get rid of interpolation (because of the ugly extrapolation)
"""
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
####################################################################
# #
# AWI Basemap #
# CREATE SHADING LAYERS #
# #
####################################################################
This scipt creates 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. The combined shading is used to
get Simon's magical relief visualization, which combines shading
by synthetic illumination and shading by slope inclination.
"""
#=============================================================================
# SCRIPT INFO
#=============================================================================
__author__ = 'Simon Dreutter'
__version__ = '0.1'
__date__ = '2020-12-17'
__email__ = 'simon.dreutter@awi.de'
__status__ = 'Developement'
#=============================================================================
# IMPORT
#=============================================================================
# import AWI Basemap configuration
from config import *
#=============================================================================
# PROCESS
#=============================================================================
msg = 'Creating World Hillshade...'
cmd = f'gdaldem hillshade {GEBCO_WORLD} {GEBCO_WORLD_HILLSHADE} -of GTiff -b 1 -z {Z_FACTOR} -s 111120.0 -az 315.0 -alt 45.0 -compute_edges -combined {GDAL_CREATE_OPTIONS}'
run(msg,cmd)
msg = 'Creating Arctic Hillshade...'
cmd = f'gdaldem hillshade {GEBCO_ARCTIC} {GEBCO_ARCTIC_HILLSHADE} -of GTiff -b 1 -z {Z_FACTOR} -s 1.0 -az 315.0 -alt 45.0 -compute_edges -combined {GDAL_CREATE_OPTIONS}'
run(msg,cmd)
msg = 'Creating Antarctic Hillshade...'
cmd = f'gdaldem hillshade {GEBCO_ANTARCTIC} {GEBCO_ANTARCTIC_HILLSHADE} -of GTiff -b 1 -z {Z_FACTOR} -s 1.0 -az 315.0 -alt 45.0 -compute_edges -combined {GDAL_CREATE_OPTIONS}'
run(msg,cmd)
# -*- coding: utf-8 -*-
"""
####################################################################
# #
# AWI Basemap #
# BURN VECTOR LAYERS #
# #
####################################################################
This script burns ths vector layers into the raster DEM layers. That
means, that raster cells are overwritten with the values 3000 (rock
outcrops) 20000 (shelf ice) and 30000 (ice sheets and glaciers)
whereever they intersect with the vector layers.
"""
#=============================================================================
# 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
# 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]
# burn values
v_rock_outcrops = 3000.0
v_shelf_ice = 20000.0
v_ice_sheet = 30000.0
msg = 'Burning Antarctic ice shelfs in World raster...'
cmd = f'gdal_rasterize -l {add_shelf_ice_name} -burn {v_shelf_ice} {ADD_SHELF_ICE} {GEBCO_WORLD}'
run(msg,cmd)
msg = 'Burning Antarctic ice sheet in World raster...'
cmd = f'gdal_rasterize -l {add_ice_sheet_name} -burn {v_ice_sheet} {ADD_ICE_SHEET} {GEBCO_WORLD}'
run(msg,cmd)
msg = 'Burning Antarctic rock outcrops in World raster...'
cmd = f'gdal_rasterize -l {add_rock_outcrop_name} -burn {v_rock_outcrops} {ADD_ROCK_OUTCROP} {GEBCO_WORLD}'
run(msg,cmd)
msg = 'Burning Greenland ice sheet in World raster...'
cmd = f'gdal_rasterize -l {gimp_name} -burn {v_ice_sheet} {GIMP} {GEBCO_WORLD}'
run(msg,cmd)
msg = 'Burning glaciers in World raster...'
cmd = f'gdal_rasterize -l {glims_world_name} -burn {v_ice_sheet} {GLIMS_WORLD} {GEBCO_WORLD}'
run(msg,cmd)
msg = 'Burning Greenland ice sheet in Arctic raster...'
cmd = f'gdal_rasterize -l {gimp_name} -burn {v_ice_sheet} {GIMP} {GEBCO_ARCTIC}'
run(msg,cmd)
msg = 'Burning glaciers in Arctic raster...'
cmd = f'gdal_rasterize -l {glims_arctic_name} -burn {v_ice_sheet} {GLIMS_ARCTIC} {GEBCO_ARCTIC}'
run(msg,cmd)
msg = 'Burning Antarctic ice shelfs in Antarctic raster...'
cmd = f'gdal_rasterize -l {add_shelf_ice_name} -burn {v_shelf_ice} {ADD_SHELF_ICE} {GEBCO_ANTARCTIC}'
run(msg,cmd)
msg = 'Burning Antarctic ice sheet in Antarctic raster...'
cmd = f'gdal_rasterize -l {add_ice_sheet_name} -burn {v_ice_sheet} {ADD_ICE_SHEET} {GEBCO_ANTARCTIC}'
run(msg,cmd)
msg = 'Burning Antarctic rock outcrops in Antarctic raster...'
cmd = f'gdal_rasterize -l {add_rock_outcrop_name} -burn {v_rock_outcrops} {ADD_ROCK_OUTCROP} {GEBCO_ANTARCTIC}'
run(msg,cmd)
msg = 'Burning glaciers in Antarctic raster...'
cmd = f'gdal_rasterize -l {glims_antarctic_name} -burn {v_ice_sheet} {GLIMS_ANTARCTIC} {GEBCO_ANTARCTIC}'
run(msg,cmd)
# -*- coding: utf-8 -*-
"""
####################################################################
# #
# AWI Basemap #
# CREATE BASEMAPS #
# #
####################################################################
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.
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
pyramids.
"""
#=============================================================================
# SCRIPT INFO
#=============================================================================
__author__ = 'Simon Dreutter'
__version__ = '0.1'
__date__ = '2020-12-17'
__email__ = 'simon.dreutter@awi.de'
__status__ = 'Developement'
#=============================================================================
# IMPORT
#=============================================================================
# import AWI Basemap configuration
from config import *
#=============================================================================
# FUNCTIONS
#=============================================================================
def create_basemap(map_params):
name,gebco,hs,cp,epsg,output = map_params
msg = f'Creating {name} RGB...'
cmd = f'gdaldem color-relief {gebco} {cp} {TMP_RGB} -of GTiff -b 1 -compute_edges {GDAL_CREATE_OPTIONS}'
run(msg,cmd)
msg = f'Creating shaded {name} map...'
cmd = f'{PYTHON} -m gdal_calc --calc "uint8(((A/255.)*(((B*0.75)+(255.*0.25))/255.))*255)" --format GTiff --type Byte -A {TMP_RGB} --A_band 1 -B {hs} --B_band 1 --allBands=A --overwrite --outfile {TMP_SHADED}'
# {GDAL_CREATE_OPTIONS_PY}
run(msg,cmd)
cleanup(TMP_RGB)
msg = f'Finalizing AWI Basemap {name}...'
cmd = f'gdal_translate -a_srs {epsg} -co TILED=YES -co BLOCKXSIZE=512 -co BLOCKYSIZE=512 -co COPY_SRC_OVERVIEWS=FALSE -co COMPRESS=NONE -stats -of GTiff {TMP_SHADED} {output}'
run(msg,cmd)
cleanup(TMP_SHADED)
msg = f'Creating pyramids for AWI Basemap {name}...'
cmd = f'gdaladdo -r {OVERVIEW_METHOD} --config COMPRESS_OVERVIEW NONE --config INTERLEAVE_OVERVIEW PIXEL --config BIGTIFF_OVERVIEW IF_NEEDED --config GDAL_TIFF_OVR_BLOCKSIZE 512 {output} 2 4 8 16 32 64'
run(msg,cmd)
#=============================================================================
# PROCESS
#=============================================================================
maps = [
('World [default]', GEBCO_WORLD, GEBCO_WORLD_HILLSHADE, CP_DEFAULT, EPSG_WORLD, BASEMAP_WORLD ),
('Arctic [default]', GEBCO_ARCTIC, GEBCO_ARCTIC_HILLSHADE, CP_DEFAULT, EPSG_ARCTIC, BASEMAP_ARCTIC ),
('Antarctic [default]', GEBCO_ANTARCTIC, GEBCO_ANTARCTIC_HILLSHADE, CP_DEFAULT, EPSG_ANTARCTIC, BASEMAP_ANTARCTIC ),
('World [bright]', GEBCO_WORLD, GEBCO_WORLD_HILLSHADE, CP_BRIGHT, EPSG_WORLD, BASEMAP_WORLD_BRIGHT ),
('Arctic [bright]', GEBCO_ARCTIC, GEBCO_ARCTIC_HILLSHADE, CP_BRIGHT, EPSG_ARCTIC, BASEMAP_ARCTIC_BRIGHT ),
('Antarctic [bright]', GEBCO_ANTARCTIC, GEBCO_ANTARCTIC_HILLSHADE, CP_BRIGHT, EPSG_ANTARCTIC, BASEMAP_ANTARCTIC_BRIGHT ),
('World [dark]', GEBCO_WORLD, GEBCO_WORLD_HILLSHADE, CP_DARK, EPSG_WORLD, BASEMAP_WORLD_DARK ),
('Arctic [dark]', GEBCO_ARCTIC, GEBCO_ARCTIC_HILLSHADE, CP_DARK, EPSG_ARCTIC, BASEMAP_ARCTIC_DARK ),
('Antarctic [dark]', GEBCO_ANTARCTIC, GEBCO_ANTARCTIC_HILLSHADE, CP_DARK, EPSG_ANTARCTIC, BASEMAP_ANTARCTIC_DARK )
]
for map_params in maps:
create_basemap(map_params)
cleanup(GEBCO_WORLD)
cleanup(GEBCO_WORLD_HILLSHADE)
cleanup(GEBCO_ARCTIC)
cleanup(GEBCO_ARCTIC_HILLSHADE)
cleanup(GEBCO_ANTARCTIC)
cleanup(GEBCO_ANTARCTIC_HILLSHADE)
#=============================================================================
# TODO
#=============================================================================
"""
Metadata
"""
#=============================================================================
# BACKUP
#=============================================================================
"""
msg = 'Creating World RGB...'
cmd = f'gdaldem color-relief {GEBCO_WORLD} {CP_DEFAULT} {GEBCO_WORLD_RGB} -of GTiff -b 1 -compute_edges {GDAL_CREATE_OPTIONS}')
run(msg,cmd)
msg = 'Creating AWI Basemap World...'
cmd = f'python3 -m gdal_calc --calc "uint8(((A/255.)*(((B*0.75)+(255.*0.25))/255.))*255)" --format GTiff --type Byte -A {GEBCO_WORLD_RGB} --A_band 1 -B {GEBCO_WORLD_HILLSHADE} --B_band 1 {GDAL_CREATE_OPTIONS_PY} --allBands=A --overwrite --outfile {BASEMAP_WORLD}')
run(msg,cmd)
msg = 'Creating Arctic RGB...'
cmd = f'gdaldem color-relief {GEBCO_ARCTIC} {CP_DEFAULT} {GEBCO_ARCTIC_RGB} -of GTiff -b 1 -compute_edges {GDAL_CREATE_OPTIONS}')
run(msg,cmd)
msg = 'Creating AWI Basemap Arctic...'
cmd = f'python3 -m gdal_calc --calc "uint8(((A/255.)*(((B*0.75)+(255.*0.25))/255.))*255)" --format GTiff --type Byte -A {GEBCO_ARCTIC_RGB} --A_band 1 -B {GEBCO_ARCTIC_HILLSHADE} --B_band 1 {GDAL_CREATE_OPTIONS_PY} --allBands=A --overwrite --outfile {BASEMAP_ARCTIC}')
run(msg,cmd)
msg = 'Creating Antarctic RGB...'
cmd = f'gdaldem color-relief {GEBCO_ANTARCTIC} {CP_DEFAULT} {GEBCO_ANTARCTIC_RGB} -of GTiff -b 1 -compute_edges {GDAL_CREATE_OPTIONS}')
run(msg,cmd)
msg = 'Creating AWI Basemap Antarctic...'
cmd = f'python3 -m gdal_calc --calc "uint8(((A/255.)*(((B*0.75)+(255.*0.25))/255.))*255)" --format GTiff --type Byte -A {GEBCO_ANTARCTIC_RGB} --A_band 1 -B {GEBCO_ANTARCTIC_HILLSHADE} --B_band 1 {GDAL_CREATE_OPTIONS_PY} --allBands=A --overwrite --outfile {BASEMAP_ANTARCTIC}')
run(msg,cmd)
"""
# -*- 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)
@echo off
python3 1_process_add.py
python3 2_process_gimp.py
python3 3_process_glims.py
python3 4_process_gebco.py
python3 5_create_shading_layers.py
python3 6_burn_vector_layers.py
python3 7_create_basemaps.py
# Result directory
This is where the resulting Basemaps will be created in.
-12000 0 36 64 255
-6000 0 62 110 255
-1000 7 172 231 255
-10 191 239 255 255
-4 255 255 255 255
5 230 230 230 255
100 204 204 204 255
1000 179 179 179 255
10000 153 153 153 255
20000 242 242 242 255
30000 255 255 255 255
\ No newline at end of file
-12000 48 57 64 255
-6000 82 98 110 255
-1000 153 191 204 255
-10 225 234 237 255
-4 255 255 255 255
5 230 230 230 255
100 204 204 204 255
1000 179 179 179 255
10000 153 153 153 255
20000 242 242 242 255
30000 255 255 255 255
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