# -*- coding: utf-8 -*- """ #################################################################### # # # AWI Basemap # # COMPUTE SHADING LAYERS # # # #################################################################### This scipt 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 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.4' __date__ = '2013-05-16' __email__ = 'simon.dreutter@awi.de' __status__ = 'Developement' #============================================================================= # IMPORT #============================================================================= # import AWI Basemap configuration from config import * #============================================================================= # PROCESS #============================================================================= # heading print() print('====================================================================') print(f'{"COMPUTE SHADING LAYERS":^68}') # World msg = 'Creating World Hillshade...' cmd = (f'gdaldem' f' hillshade' f' -b 1' f' -z {Z_FACTOR}' f' -s 111120.0' f' -az 315.0' f' -alt 45.0' f' -compute_edges' f' -combined' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_WORLD} {GEBCO_WORLD_HILLSHADE}') run(msg,cmd) msg = 'Creating World ice surface Hillshade...' cmd = (f'gdaldem' f' hillshade' f' -b 1' f' -z {Z_FACTOR}' f' -s 111120.0' f' -az 315.0' f' -alt 45.0' f' -compute_edges' f' -combined' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_WORLD_ICESURFACE} {GEBCO_WORLD_ICESURFACE_HILLSHADE}') run(msg,cmd) msg = 'Creating World sub ice Hillshade...' cmd = (f'gdaldem' f' hillshade' f' -b 1' f' -z {Z_FACTOR}' f' -s 111120.0' f' -az 315.0' f' -alt 45.0' f' -compute_edges' f' -combined' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_WORLD_SUBICE} {GEBCO_WORLD_SUBICE_HILLSHADE}') run(msg,cmd) msg = 'Merging World Hillshades...' cmd = (f'gdal_merge' f' -o {GEBCO_WORLD_HILLSHADE}' f' -n 0' f' -a_nodata 0' f' {GEBCO_WORLD_SUBICE_HILLSHADE} {GEBCO_WORLD_ICESURFACE_HILLSHADE}') run(msg,cmd) # Arctic msg = 'Creating Arctic Hillshade...' cmd = (f'gdaldem' f' hillshade' f' -b 1' f' -z {Z_FACTOR}' f' -s 1.0' f' -az 315.0' f' -alt 45.0' f' -compute_edges' f' -combined' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_ARCTIC} {GEBCO_ARCTIC_HILLSHADE}') run(msg,cmd) # Antarctic msg = 'Creating Antarctic ice surface Hillshade...' cmd = (f'gdaldem' f' hillshade' f' -b 1' f' -z {Z_FACTOR}' f' -s 1.0' f' -az 315.0' f' -alt 45.0' f' -compute_edges' f' -combined' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_ANTARCTIC_ICESURFACE} {GEBCO_ANTARCTIC_ICESURFACE_HILLSHADE}') run(msg,cmd) msg = 'Creating Antarctic sub ice Hillshade...' cmd = (f'gdaldem' f' hillshade' f' -b 1' f' -z {Z_FACTOR}' f' -s 1.0' f' -az 315.0' f' -alt 45.0' f' -compute_edges' f' -combined' f' -of GTiff' f' {GDAL_CREATE_OPTIONS}' f' {GEBCO_ANTARCTIC_SUBICE} {GEBCO_ANTARCTIC_SUBICE_HILLSHADE}') run(msg,cmd) msg = 'Merging Antarctic Hillshades...' cmd = (f'gdal_merge' f' -o {GEBCO_ANTARCTIC_HILLSHADE}' f' -n 0' f' -a_nodata 0' f' {GEBCO_ANTARCTIC_SUBICE_HILLSHADE} {GEBCO_ANTARCTIC_ICESURFACE_HILLSHADE}') run(msg,cmd) # cleanup cleanup(GEBCO_WORLD_ICESURFACE) cleanup(GEBCO_WORLD_ICESURFACE_HILLSHADE) cleanup(GEBCO_WORLD_SUBICE) cleanup(GEBCO_WORLD_SUBICE_HILLSHADE) cleanup(GEBCO_ANTARCTIC_ICESURFACE) cleanup(GEBCO_ANTARCTIC_ICESURFACE_HILLSHADE) cleanup(GEBCO_ANTARCTIC_SUBICE) cleanup(GEBCO_ANTARCTIC_SUBICE_HILLSHADE)