Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion avaframe/out3Plot/plotUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
elevationDegree = cfg.getfloat("elevationDegree")
vertExag = cfg.getfloat("vertExag")
hillshadeContLevs = cfg.getint("hillshadeContLevs")
hsContrastDiff = cfg.getfloat("hsContrastDiff")
hsContrastMult = cfg.getfloat("hsContrastMult")

# define settings for colormaps creation
discreteLevels = cfg.getint("discreteLevels")
Expand Down Expand Up @@ -882,8 +884,14 @@ def addHillShadeContours(
else:
extentPlot = extent

hs = ls.hillshade(data, vert_exag=vertExag, dx=data.shape[1], dy=data.shape[0])
# normalize hillshade and increase the contrast
if np.nanmin(hs) != np.nanmax(hs):
hs = (hs - np.nanmin(hs)) / (np.nanmax(hs) - np.nanmin(hs))
hs = np.clip((hs - hsContrastDiff) * hsContrastMult, 0, 1)

im1 = ax.imshow(
ls.hillshade(data, vert_exag=vertExag, dx=data.shape[1], dy=data.shape[0]),
hs,
cmap="gray",
extent=extentPlot,
origin="lower",
Expand Down
4 changes: 4 additions & 0 deletions avaframe/out3Plot/plotUtilsCfg.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ azimuthDegree = 315
elevationDegree = 15
vertExag = 10
hillshadeContLevs = 15
# to switch off increased contrast: hsContrastDiff = 0, hsContrastMult = 1
# to switch on increased contrast, suggested values are: hsContrastDiff = 0.25, hsContrastMult = 2.2
hsContrastDiff = 0
hsContrastMult = 1


[CONSTANTS]
Expand Down
Loading