palettes-test-crameri-dem.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import ee
  2. from ee_plugin import Map
  3. from ee_plugin.contrib import utils, palettes
  4. dem = ee.Image("AHN/AHN2_05M_RUW") \
  5. .resample('bicubic') \
  6. .convolve(ee.Kernel.gaussian(0.5, 0.25, 'meters'))
  7. # palette = palettes.crameri['lisbon'][50]
  8. palette = palettes.crameri['oleron'][50]
  9. # palette = palettes.crameri['roma'][50].slice(0).reverse()
  10. demRGB = dem.visualize(**{ 'min': -5, 'max': 15, 'palette': palette })
  11. weight = 0.4 # wegith of Hillshade vs RGB intensity (0 - flat, 1 - HS)
  12. exaggeration = 5 # vertical exaggeration
  13. azimuth = 315 # Sun azimuth
  14. zenith = 20 # Sun elevation
  15. brightness = -0.05 # 0 - default
  16. contrast = 0.05 # 0 - default
  17. saturation = 0.8 # 1 - default
  18. castShadows = False
  19. # no shadows
  20. rgb = utils.hillshadeRGB(demRGB, dem, weight, exaggeration, azimuth, zenith, contrast, brightness, saturation, castShadows)
  21. Map.addLayer(rgb, {}, 'DEM (no shadows)', False)
  22. # with shadows
  23. castShadows = True
  24. rgb = utils.hillshadeRGB(demRGB, dem, weight, exaggeration, azimuth, zenith, contrast, brightness, saturation, castShadows)
  25. Map.addLayer(rgb, {}, 'DEM')
  26. Map.addLayer(dem, {}, 'DEM (raw)', False)
  27. Map.setCenter(4.408241, 52.177595, 18)