1::
2:: a batch script for generating a pit-free CHM as outlined
3:: in the Silvilaser 2013 poster by A. Khosravipour et al.
4:: with an additional step that incorporated the beam width
5:: of the laser to "airbrush" a fuller canopy.
6::
7:: this version uses a (multi-core) pipeline of las2dem calls
8::
9
10::
11:: specify parameters
12::
13
14:: allows you to run the script from other folders
15set PATH=%PATH%;D:\lastools\bin;
16
17:: here we specify the input (already height-normalized)
18set NORMALIZED_LIDAR=D:\data\normalized\bois_noir.laz
19
20:: specify the desired resolution
21set STEP=0.5
22
23:: specify the radius of the laser beam
24set BEAM_RADIUS=0.1
25
26:: specify the sub-resolution for the beam file (about half the step)
27set SUB_STEP=0.25
28
29:: specify the desired triangle kill (about 3 times the step)
30set KILL=1.5
31
32:: specify a temporary directory for the beam file and the partial CHMs
33set TEMP_CHM_DIR=temp_chms
34
35:: specify the temporary beam file
36set BEAM_LIDAR=%TEMP_CHM_DIR%\beam.laz
37
38:: specify the final output CHM file name and format
39set PIT_FREE_CHM=D:\data\result\chm.tif
40
41rmdir %TEMP_CHM_DIR% /s /q
42mkdir %TEMP_CHM_DIR%
43
44::
45:: do the actual processing
46::
47
48lasthin -i %NORMALIZED_LIDAR% ^
49        -highest ^
50        -step %SUB_STEP% ^
51        -subcircle %BEAM_RADIUS% ^
52        -o %BEAM_LIDAR%
53
54las2dem -i %BEAM_LIDAR% ^
55        -pipe_on ^
56        -step %STEP% ^
57        -o %TEMP_CHM_DIR%\chm_00.bil | ^
58las2dem -stdin ^
59        -drop_z_below 2 ^
60        -pipe_on ^
61        -step %STEP% -kill %KILL% ^
62        -o %TEMP_CHM_DIR%\chm_02.bil | ^
63las2dem -stdin ^
64        -drop_z_below 5 ^
65        -pipe_on ^
66        -step %STEP% -kill %KILL% ^
67        -o %TEMP_CHM_DIR%\chm_05.bil | ^
68las2dem -stdin ^
69        -drop_z_below 10 ^
70        -pipe_on ^
71        -step %STEP% -kill %KILL% ^
72        -o %TEMP_CHM_DIR%\chm_10.bil | ^
73las2dem -stdin ^
74        -drop_z_below 15 ^
75        -pipe_on ^
76        -step %STEP% -kill %KILL% ^
77        -o %TEMP_CHM_DIR%\chm_15.bil | ^
78las2dem -stdin ^
79        -drop_z_below 20 ^
80        -pipe_on ^
81        -step %STEP% -kill %KILL% ^
82        -o %TEMP_CHM_DIR%\chm_20.bil | ^
83las2dem -stdin ^
84        -drop_z_below 25 ^
85        -pipe_on ^
86        -step %STEP% -kill %KILL% ^
87        -o %TEMP_CHM_DIR%\chm_25.bil | ^
88las2dem -stdin ^
89        -drop_z_below 30 ^
90        -pipe_on ^
91        -step %STEP% -kill %KILL% ^
92        -o %TEMP_CHM_DIR%\chm_30.bil
93
94:: merge partial CHMs together into pit-free CHM
95
96lasgrid -i %TEMP_CHM_DIR%\chm_*.bil -merged ^
97        -step %STEP% -highest ^
98        -o %PIT_FREE_CHM%
99
100:: remove the temporary files and directory
101
102rmdir %TEMP_CHM_DIR% /s /q
103
104echo "bye bye"
105