-
Notifications
You must be signed in to change notification settings - Fork 2
/
topo_advanced_vis_localrelief.pro
65 lines (58 loc) · 1.66 KB
/
topo_advanced_vis_localrelief.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
;+
; NAME:
;
; Topo_advanced_vis_shade
;
; PURPOSE:
;
; Compute terain gradient - slope in degrees
;
; INPUTS:
;
; This procedure needs
; in_file - path+filename of input DEM to save the outputs
; geotiff - geotiff structure of the input/output
; dem - elvation data
; resolution - spatial resolution of DEM
; sc_slp_ex - extreme values for 8-bit conversion
;
;
; OUTPUTS:
;
; Written 8-bit GEOTIFF files for SVF, anisotropic SVF or openess
;
; AUTHOR:
;
; Klemen Zaksek
;
; DEPENDENCIES:
;
; topo_advanced_vis_slope
;
; MODIFICATION HISTORY:
;
; Written by Klemen Zaksek, 2013.
;
;-
PRO topo_advanced_vis_localrelief, in_file, geotiff, $
dem, resolution, $ ;relief
in_slrm_r_max, sc_slrm_ev, $
overwrite=overwrite
idx_background = where(dem lt -12000 or dem gt 20000, n_idx_background)
if n_idx_background gt 0 then begin
dem_temp = Double(dem)
dem_temp[idx_background] = !Values.F_NaN
endif else dem_temp = dem
;Difference from trend
; gaussian gilter
;diff = Float(dem_temp - Gauss_smooth(Double(dem_temp), /EDGE_TRUNCATE, WIDTH=in_slrm_r_max*2.))
; mean filter
diff = Float(dem_temp - smooth(Double(dem_temp), in_slrm_r_max*2., /EDGE_TRUNCATE, /nan)) ;if width is even number +1 will be added to the width size
;Write results
out_file = in_file + '.tif'
write_image_to_geotiff_float, overwrite, out_file, diff, geotiff=geotiff
diff = HIST_EQUAL(diff, percent=2, binsize=0.05) ; find out what % of values are NAN
out_file = in_file + '_8bit.tif'
write_image_to_geotiff, overwrite, out_file, diff, geotiff=geotiff
diff = !null
END