|
1 |
# variables derived from the dem following commands in http://www.gdal.org/gdaldem.html#gdaldem_slope
|
|
2 |
# to check ls *.tif | xargs -n 1 -P 30 bash -c $' gdalinfo -mm $1 |grep Max | awk \'{ gsub("[=,]", " ") ; print $3,$4 }\' ' _
|
|
3 |
|
|
4 |
# find /mnt/data2/dem_variables/GMTED2010/{aspect,roughness,slope,tpi,tri} -name *.tif | xargs -n 1 -P 10 rm ;
|
|
5 |
|
|
6 |
# be, ds, md, mn ; Breakline Emphasis, Systematic Subsample, Median Statistic, Mean Statistic ; md ds
|
|
7 |
# for file in `ls /mnt/data2/dem_variables/GMTED2010/tiles/be75_grd_tif/*.tif` ; do echo $file md ; done | xargs -n 2 -P 5 bash /mnt/data2/dem_variables/scripts/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc2a_dem_variables.sh ;
|
|
8 |
# for file in `ls /mnt/data2/dem_variables/GMTED2010/tiles/be75_grd_tif/*.tif` ; do echo $file ds ; done | xargs -n 2 -P 5 bash /mnt/data2/dem_variables/scripts/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc2a_dem_variables.sh
|
|
9 |
|
|
10 |
export file=$1
|
|
11 |
export mm=$2
|
|
12 |
export INDIR=/mnt/data2/dem_variables/GMTED2010/tiles/${mm}75_grd_tif
|
|
13 |
export OUTDIR=/mnt/data2/dem_variables/GMTED2010
|
|
14 |
|
|
15 |
export filename=`basename $file .tif`
|
|
16 |
|
|
17 |
(
|
|
18 |
|
|
19 |
echo altitude variables with file $INDIR/$filename.tif
|
|
20 |
|
|
21 |
# median
|
|
22 |
pkfilter -m -32768 -dx 4 -dy 4 -f median -d 4 -i $INDIR/$filename.tif -o $OUTDIR/altitude/median/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
23 |
# stdev
|
|
24 |
pkfilter -m -32768 -dx 4 -dy 4 -f var -d 4 -i $INDIR/$filename.tif -o /tmp/ramdisk/tmp_${filename}_${mm}.tif -ot Int32 # max 1552385.000 sqrt(1245.947)
|
|
25 |
gdal_calc.py -A /tmp/ramdisk/tmp_${filename}_${mm}.tif --calc="sqrt(A)" --type Int16 --overwrite --outfile $OUTDIR/altitude/stdev/tiles/${filename}_${mm}.tif
|
|
26 |
rm -f /tmp/ramdisk/tmp_${filename}_${mm}.tif
|
|
27 |
# min
|
|
28 |
pkfilter -m -32768 -dx 4 -dy 4 -f min -d 4 -i $INDIR/$filename.tif -o $OUTDIR/altitude/min/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
29 |
# max
|
|
30 |
pkfilter -m -32768 -dx 4 -dy 4 -f max -d 4 -i $INDIR/$filename.tif -o $OUTDIR/altitude/max/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
31 |
# mean
|
|
32 |
pkfilter -m -32768 -dx 4 -dy 4 -f mean -d 4 -i $INDIR/$filename.tif -o $OUTDIR/altitude/mean/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
33 |
|
|
34 |
# starting to use gdaldem to compute variables. Gdaldem use -9999 as no data.
|
|
35 |
|
|
36 |
echo slope with file $INDIR/$filename.tif
|
|
37 |
gdaldem slope -s 111120 -co COMPRESS=LZW $INDIR/$filename.tif $OUTDIR/slope/tiles/${filename}_${mm}.tif # -s to consider xy in degree and z in meters
|
|
38 |
# slope median
|
|
39 |
pkfilter -m -9999 -dx 4 -dy 4 -f median -d 4 -i $OUTDIR/slope/tiles/${filename}_${mm}.tif -o $OUTDIR/slope/median/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Byte
|
|
40 |
# slope stdev
|
|
41 |
pkfilter -m -9999 -dx 4 -dy 4 -f var -d 4 -i $OUTDIR/slope/tiles/${filename}_${mm}.tif -o /tmp/ramdisk/tmp_${filename}_${mm}.tif -ot Int32
|
|
42 |
gdal_calc.py -A /tmp/ramdisk/tmp_${filename}_${mm}.tif --calc="sqrt(A)" --type Int16 --overwrite --outfile $OUTDIR/slope/stdev/tiles/${filename}_${mm}.tif
|
|
43 |
rm -f /tmp/ramdisk/tmp_${filename}_${mm}.tif
|
|
44 |
# slope min
|
|
45 |
pkfilter -m -9999 -dx 4 -dy 4 -f min -d 4 -i $OUTDIR/slope/tiles/${filename}_${mm}.tif -o $OUTDIR/slope/min/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Byte
|
|
46 |
# slope max
|
|
47 |
pkfilter -m -9999 -dx 4 -dy 4 -f max -d 4 -i $OUTDIR/slope/tiles/${filename}_${mm}.tif -o $OUTDIR/slope/max/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Byte
|
|
48 |
# slope mean
|
|
49 |
pkfilter -m -9999 -dx 4 -dy 4 -f mean -d 4 -i $OUTDIR/slope/tiles/${filename}_${mm}.tif -o $OUTDIR/slope/mean/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Byte
|
|
50 |
|
|
51 |
# rm -f $OUTDIR/slope/tiles/$filename.tif
|
|
52 |
|
|
53 |
echo generate a Terrain Ruggedness Index TRI with file $file
|
|
54 |
gdaldem TRI -co COMPRESS=LZW $INDIR/$filename.tif $OUTDIR/tri/tiles/${filename}_${mm}.tif
|
|
55 |
# tri median
|
|
56 |
pkfilter -m -9999 -dx 4 -dy 4 -f median -d 4 -i $OUTDIR/tri/tiles/${filename}_${mm}.tif -o $OUTDIR/tri/median/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
57 |
# tri stdev
|
|
58 |
pkfilter -m -9999 -dx 4 -dy 4 -f var -d 4 -i $OUTDIR/tri/tiles/${filename}_${mm}.tif -o /tmp/ramdisk/tmp_${filename}_${mm}.tif
|
|
59 |
gdal_calc.py -A /tmp/ramdisk/tmp_${filename}_${mm}.tif --calc="sqrt(A)" --type Int16 --overwrite --outfile $OUTDIR/tri/stdev/tiles/${filename}_${mm}.tif
|
|
60 |
rm -f /tmp/ramdisk/tmp_${filename}_${mm}.tif
|
|
61 |
# tri min
|
|
62 |
pkfilter -m -9999 -dx 4 -dy 4 -f min -d 4 -i $OUTDIR/tri/tiles/${filename}_${mm}.tif -o $OUTDIR/tri/min/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
63 |
# tri max
|
|
64 |
pkfilter -m -9999 -dx 4 -dy 4 -f max -d 4 -i $OUTDIR/tri/tiles/${filename}_${mm}.tif -o $OUTDIR/tri/max/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
65 |
# tri mean
|
|
66 |
pkfilter -m -9999 -dx 4 -dy 4 -f mean -d 4 -i $OUTDIR/tri/tiles/${filename}_${mm}.tif -o $OUTDIR/tri/mean/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
67 |
|
|
68 |
# rm -f $OUTDIR/tri/tiles/$filename.tif
|
|
69 |
|
|
70 |
echo generate a Topographic Position Index TPI with file $INDIR/$filename.tif
|
|
71 |
|
|
72 |
gdaldem TPI -co COMPRESS=LZW $INDIR/$filename.tif $OUTDIR/tpi/tiles/${filename}_${mm}.tif # tpi has negative number
|
|
73 |
|
|
74 |
oft-calc -ot Float32 $OUTDIR/tpi/tiles/${filename}_${mm}.tif $OUTDIR/tpi/tiles/${filename}_${mm}"_t10.tif" &> /dev/null <<EOF
|
|
75 |
1
|
|
76 |
#1 10 *
|
|
77 |
EOF
|
|
78 |
|
|
79 |
# tpi median
|
|
80 |
pkfilter -m -9999 -dx 4 -dy 4 -f median -d 4 -i $OUTDIR/tpi/tiles/${filename}_${mm}"_t10.tif" -o $OUTDIR/tpi/median/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
81 |
echo tpi stdev
|
|
82 |
pkfilter -m -9999 -dx 4 -dy 4 -f var -d 4 -i $OUTDIR/tpi/tiles/${filename}_${mm}"_t10.tif" -o /tmp/ramdisk/tmp_${filename}_${mm}.tif
|
|
83 |
gdal_calc.py -A /tmp/ramdisk/tmp_${filename}_${mm}.tif --calc="sqrt(A)" --type Int32 --overwrite --outfile $OUTDIR/tpi/stdev/tiles/${filename}_${mm}.tif
|
|
84 |
rm -f /tmp/ramdisk/tmp_${filename}_${mm}.tif
|
|
85 |
# tpi min
|
|
86 |
pkfilter -m -9999 -dx 4 -dy 4 -f min -d 4 -i $OUTDIR/tpi/tiles/${filename}_${mm}"_t10.tif" -o $OUTDIR/tpi/min/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
87 |
# tpi max
|
|
88 |
pkfilter -m -9999 -dx 4 -dy 4 -f max -d 4 -i $OUTDIR/tpi/tiles/${filename}_${mm}"_t10.tif" -o $OUTDIR/tpi/max/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
89 |
# tpi mean
|
|
90 |
pkfilter -m -9999 -dx 4 -dy 4 -f mean -d 4 -i $OUTDIR/tpi/tiles/${filename}_${mm}"_t10.tif" -o $OUTDIR/tpi/mean/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
91 |
|
|
92 |
|
|
93 |
echo generate roughness with file $INDIR/$filename.tif
|
|
94 |
|
|
95 |
gdaldem roughness -co COMPRESS=LZW $INDIR/$filename.tif $OUTDIR/roughness/tiles/${filename}_${mm}.tif
|
|
96 |
|
|
97 |
# roughness median
|
|
98 |
pkfilter -m -9999 -dx 4 -dy 4 -f median -d 4 -i $OUTDIR/roughness/tiles/${filename}_${mm}.tif -o $OUTDIR/roughness/median/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
99 |
echo roughness stdev
|
|
100 |
pkfilter -m -9999 -dx 4 -dy 4 -f var -d 4 -i $OUTDIR/roughness/tiles/${filename}_${mm}.tif -o /tmp/ramdisk/tmp_${filename}_${mm}.tif
|
|
101 |
gdal_calc.py -A /tmp/ramdisk/tmp_${filename}_${mm}.tif --calc="sqrt(A)" --type Int32 --overwrite --outfile $OUTDIR/roughness/stdev/tiles/${filename}_${mm}.tif
|
|
102 |
rm -f /tmp/ramdisk/tmp_${filename}_${mm}.tif
|
|
103 |
# roughness min
|
|
104 |
pkfilter -m -9999 -dx 4 -dy 4 -f min -d 4 -i $OUTDIR/roughness/tiles/${filename}_${mm}.tif -o $OUTDIR/roughness/min/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
105 |
# roughness max
|
|
106 |
pkfilter -m -9999 -dx 4 -dy 4 -f max -d 4 -i $OUTDIR/roughness/tiles/${filename}_${mm}.tif -o $OUTDIR/roughness/max/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
107 |
# roughness mean
|
|
108 |
pkfilter -m -9999 -dx 4 -dy 4 -f mean -d 4 -i $OUTDIR/roughness/tiles/${filename}_${mm}.tif -o $OUTDIR/roughness/mean/tiles/${filename}_${mm}.tif -co COMPRESS=LZW -ot Int16
|
|
109 |
|
|
110 |
# rm -f $OUTDIR/roughness/tiles/${filename}_${mm}.tif
|
|
111 |
|
|
112 |
|
|
113 |
echo aspect with file $INDIR/$filename.tif
|
|
114 |
|
|
115 |
gdaldem aspect -zero_for_flat -co COMPRESS=LZW $INDIR/$filename.tif $OUTDIR/aspect/tiles/${filename}_${mm}.tif
|
|
116 |
|
|
117 |
# r1 aspect , r2 slope
|
|
118 |
|
|
119 |
gdal_calc.py --NoDataValue -9999 -A $OUTDIR/aspect/tiles/${filename}_${mm}.tif --calc="(sin(A))" --outfile $OUTDIR/aspect/tiles/${filename}_${mm}"_sin.tif" --overwrite --type Float32
|
|
120 |
gdal_calc.py --NoDataValue -9999 -A $OUTDIR/aspect/tiles/${filename}_${mm}.tif --calc="(cos(A))" --outfile $OUTDIR/aspect/tiles/${filename}_${mm}"_cos.tif" --overwrite --type Float32
|
|
121 |
|
|
122 |
gdal_calc.py --NoDataValue -9999 -A $OUTDIR/slope/tiles/${filename}_${mm}.tif -B $OUTDIR/aspect/tiles/${filename}_${mm}"_sin.tif" --calc="((sin(A))*B)" --outfile $OUTDIR/aspect/tiles/${filename}_${mm}"_Ew.tif" --overwrite --type Float32
|
|
123 |
gdal_calc.py --NoDataValue -9999 -A $OUTDIR/slope/tiles/${filename}_${mm}.tif -B $OUTDIR/aspect/tiles/${filename}_${mm}"_cos.tif" --calc="((sin(A))*B)" --outfile $OUTDIR/aspect/tiles/${filename}_${mm}"_Nw.tif" --overwrite --type Float32
|
|
124 |
|
|
125 |
echo aspect sin cos Ew Nw median
|
|
126 |
# sin
|
|
127 |
pkfilter -m -9999 -dx 4 -dy 4 -f median -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_sin.tif" -o $OUTDIR/aspect/median/tiles/${filename}_${mm}"_sin_f.tif" -co COMPRESS=LZW -ot Float32
|
|
128 |
oft-calc -ot Int16 $OUTDIR/aspect/median/tiles/${filename}_${mm}"_sin_f.tif" /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif" &> /dev/null <<EOF
|
|
129 |
1
|
|
130 |
#1 10000 *
|
|
131 |
EOF
|
|
132 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif" $OUTDIR/aspect/median/tiles/${filename}_${mm}"_sin_t10k.tif"
|
|
133 |
rm /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif"
|
|
134 |
# cos
|
|
135 |
pkfilter -m -9999 -dx 4 -dy 4 -f median -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_cos.tif" -o $OUTDIR/aspect/median/tiles/${filename}_${mm}"_cos_f.tif" -co COMPRESS=LZW -ot Float32
|
|
136 |
oft-calc -ot Int16 $OUTDIR/aspect/median/tiles/${filename}_${mm}"_cos_f.tif" /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif" &> /dev/null <<EOF
|
|
137 |
1
|
|
138 |
#1 10000 *
|
|
139 |
EOF
|
|
140 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif" $OUTDIR/aspect/median/tiles/${filename}_${mm}"_cos_t10k.tif"
|
|
141 |
rm /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif"
|
|
142 |
# Ew
|
|
143 |
pkfilter -m -9999 -dx 4 -dy 4 -f median -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_Ew.tif" -o $OUTDIR/aspect/median/tiles/${filename}_${mm}"_Ew_f.tif" -co COMPRESS=LZW -ot Float32
|
|
144 |
oft-calc -ot Int16 $OUTDIR/aspect/median/tiles/${filename}_${mm}"_Ew_f.tif" /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif" &> /dev/null <<EOF
|
|
145 |
1
|
|
146 |
#1 10000 *
|
|
147 |
EOF
|
|
148 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif" $OUTDIR/aspect/median/tiles/${filename}_${mm}"_Ew_t10k.tif"
|
|
149 |
rm /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif"
|
|
150 |
# Nw
|
|
151 |
pkfilter -m -9999 -dx 4 -dy 4 -f median -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_Nw.tif" -o $OUTDIR/aspect/median/tiles/${filename}_${mm}"_Nw_f.tif" -co COMPRESS=LZW -ot Float32
|
|
152 |
oft-calc -ot Int16 $OUTDIR/aspect/median/tiles/${filename}_${mm}"_Nw_f.tif" /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif" &> /dev/null <<EOF
|
|
153 |
1
|
|
154 |
#1 10000 *
|
|
155 |
EOF
|
|
156 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif" $OUTDIR/aspect/median/tiles/${filename}_${mm}"_Nw_t10k.tif"
|
|
157 |
rm /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif"
|
|
158 |
|
|
159 |
|
|
160 |
echo aspect sin cos Ew Nw mean
|
|
161 |
# sin
|
|
162 |
pkfilter -m -9999 -dx 4 -dy 4 -f mean -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_sin.tif" -o $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_sin_f.tif" -co COMPRESS=LZW -ot Float32
|
|
163 |
oft-calc -ot Int16 $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_sin_f.tif" /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif" &> /dev/null <<EOF
|
|
164 |
1
|
|
165 |
#1 10000 *
|
|
166 |
EOF
|
|
167 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif" $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_sin_t10k.tif"
|
|
168 |
rm /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif"
|
|
169 |
# cos
|
|
170 |
pkfilter -m -9999 -dx 4 -dy 4 -f mean -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_cos.tif" -o $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_cos_f.tif" -co COMPRESS=LZW -ot Float32
|
|
171 |
oft-calc -ot Int16 $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_cos_f.tif" /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif" &> /dev/null <<EOF
|
|
172 |
1
|
|
173 |
#1 10000 *
|
|
174 |
EOF
|
|
175 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif" $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_cos_t10k.tif"
|
|
176 |
rm /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif"
|
|
177 |
# Ew
|
|
178 |
pkfilter -m -9999 -dx 4 -dy 4 -f mean -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_Ew.tif" -o $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_Ew_f.tif" -co COMPRESS=LZW -ot Float32
|
|
179 |
oft-calc -ot Int16 $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_Ew_f.tif" /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif" &> /dev/null <<EOF
|
|
180 |
1
|
|
181 |
#1 10000 *
|
|
182 |
EOF
|
|
183 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif" $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_Ew_t10k.tif"
|
|
184 |
rm /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif"
|
|
185 |
# Nw
|
|
186 |
pkfilter -m -9999 -dx 4 -dy 4 -f mean -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_Nw.tif" -o $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_Nw_f.tif" -co COMPRESS=LZW -ot Float32
|
|
187 |
oft-calc -ot Int16 $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_Nw_f.tif" /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif" &> /dev/null <<EOF
|
|
188 |
1
|
|
189 |
#1 10000 *
|
|
190 |
EOF
|
|
191 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif" &> /dev/null <<EOF
|
|
192 |
1
|
|
193 |
#1 10000 *
|
|
194 |
EOF
|
|
195 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif" $OUTDIR/aspect/mean/tiles/${filename}_${mm}"_Nw_t10k.tif"
|
|
196 |
rm /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif"
|
|
197 |
|
|
198 |
echo aspect sin cos Ew Nw max
|
|
199 |
# sin
|
|
200 |
pkfilter -m -9999 -dx 4 -dy 4 -f max -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_sin.tif" -o $OUTDIR/aspect/max/tiles/${filename}_${mm}"_sin_f.tif" -co COMPRESS=LZW -ot Float32
|
|
201 |
oft-calc -ot Int16 $OUTDIR/aspect/max/tiles/${filename}_${mm}"_sin_f.tif" /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif" &> /dev/null <<EOF
|
|
202 |
1
|
|
203 |
#1 10000 *
|
|
204 |
EOF
|
|
205 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif" $OUTDIR/aspect/max/tiles/${filename}_${mm}"_sin_t10k.tif"
|
|
206 |
rm /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif"
|
|
207 |
# cos
|
|
208 |
pkfilter -m -9999 -dx 4 -dy 4 -f max -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_cos.tif" -o $OUTDIR/aspect/max/tiles/${filename}_${mm}"_cos_f.tif" -co COMPRESS=LZW -ot Float32
|
|
209 |
oft-calc -ot Int16 $OUTDIR/aspect/max/tiles/${filename}_${mm}"_cos_f.tif" /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif" &> /dev/null <<EOF
|
|
210 |
1
|
|
211 |
#1 10000 *
|
|
212 |
EOF
|
|
213 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif" $OUTDIR/aspect/max/tiles/${filename}_${mm}"_cos_t10k.tif"
|
|
214 |
rm /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif"
|
|
215 |
# Ew
|
|
216 |
pkfilter -m -9999 -dx 4 -dy 4 -f max -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_Ew.tif" -o $OUTDIR/aspect/max/tiles/${filename}_${mm}"_Ew_f.tif" -co COMPRESS=LZW -ot Float32
|
|
217 |
oft-calc -ot Int16 $OUTDIR/aspect/max/tiles/${filename}_${mm}"_Ew_f.tif" /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif" &> /dev/null <<EOF
|
|
218 |
1
|
|
219 |
#1 10000 *
|
|
220 |
EOF
|
|
221 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif" $OUTDIR/aspect/max/tiles/${filename}_${mm}"_Ew_t10k.tif"
|
|
222 |
rm /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif"
|
|
223 |
# Nw
|
|
224 |
pkfilter -m -9999 -dx 4 -dy 4 -f max -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_Nw.tif" -o $OUTDIR/aspect/max/tiles/${filename}_${mm}"_Nw_f.tif" -co COMPRESS=LZW -ot Float32
|
|
225 |
oft-calc -ot Int16 $OUTDIR/aspect/max/tiles/${filename}_${mm}"_Nw_f.tif" /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif" &> /dev/null <<EOF
|
|
226 |
1
|
|
227 |
#1 10000 *
|
|
228 |
EOF
|
|
229 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif" $OUTDIR/aspect/max/tiles/${filename}_${mm}"_Nw_t10k.tif"
|
|
230 |
rm /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif"
|
|
231 |
|
|
232 |
echo aspect sin cos Ew Nw min
|
|
233 |
# sin
|
|
234 |
pkfilter -m -9999 -dx 4 -dy 4 -f min -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_sin.tif" -o $OUTDIR/aspect/min/tiles/${filename}_${mm}"_sin_f.tif" -co COMPRESS=LZW -ot Float32
|
|
235 |
oft-calc -ot Int16 $OUTDIR/aspect/min/tiles/${filename}_${mm}"_sin_f.tif" /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif" &> /dev/null <<EOF
|
|
236 |
1
|
|
237 |
#1 10000 *
|
|
238 |
EOF
|
|
239 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif" $OUTDIR/aspect/min/tiles/${filename}_${mm}"_sin_t10k.tif"
|
|
240 |
rm /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif"
|
|
241 |
# cos
|
|
242 |
pkfilter -m -9999 -dx 4 -dy 4 -f min -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_cos.tif" -o $OUTDIR/aspect/min/tiles/${filename}_${mm}"_cos_f.tif" -co COMPRESS=LZW -ot Float32
|
|
243 |
oft-calc -ot Int16 $OUTDIR/aspect/min/tiles/${filename}_${mm}"_cos_f.tif" /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif" &> /dev/null <<EOF
|
|
244 |
1
|
|
245 |
#1 10000 *
|
|
246 |
EOF
|
|
247 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif" $OUTDIR/aspect/min/tiles/${filename}_${mm}"_cos_t10k.tif"
|
|
248 |
rm /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif"
|
|
249 |
# Ew
|
|
250 |
pkfilter -m -9999 -dx 4 -dy 4 -f min -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_Ew.tif" -o $OUTDIR/aspect/min/tiles/${filename}_${mm}"_Ew_f.tif" -co COMPRESS=LZW -ot Float32
|
|
251 |
oft-calc -ot Int16 $OUTDIR/aspect/min/tiles/${filename}_${mm}"_Ew_f.tif" /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif" &> /dev/null <<EOF
|
|
252 |
1
|
|
253 |
#1 10000 *
|
|
254 |
EOF
|
|
255 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif" $OUTDIR/aspect/min/tiles/${filename}_${mm}"_Ew_t10k.tif"
|
|
256 |
rm /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif"
|
|
257 |
# Nw
|
|
258 |
pkfilter -m -9999 -dx 4 -dy 4 -f min -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_Nw.tif" -o $OUTDIR/aspect/min/tiles/${filename}_${mm}"_Nw_f.tif" -co COMPRESS=LZW -ot Float32
|
|
259 |
oft-calc -ot Int16 $OUTDIR/aspect/min/tiles/${filename}_${mm}"_Nw_f.tif" /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif" &> /dev/null <<EOF
|
|
260 |
1
|
|
261 |
#1 10000 *
|
|
262 |
EOF
|
|
263 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif" $OUTDIR/aspect/min/tiles/${filename}_${mm}"_Nw_t10k.tif"
|
|
264 |
rm /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif"
|
|
265 |
|
|
266 |
echo aspect sin cos Ew Nw stdev
|
|
267 |
# stdev
|
|
268 |
pkfilter -m -9999 -dx 4 -dy 4 -f var -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_sin.tif" -o $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_sin_f.tif" -co COMPRESS=LZW -ot Float32
|
|
269 |
gdal_calc.py -A $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_sin_f.tif" --calc="(sqrt(A))*10000" --type Int16 --overwrite --outfile /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif"
|
|
270 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif" $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_sin_t10k.tif"
|
|
271 |
rm /tmp/ramdisk/${filename}_${mm}"_sin_t10k_tmp.tif"
|
|
272 |
# cos
|
|
273 |
pkfilter -m -9999 -dx 4 -dy 4 -f var -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_cos.tif" -o $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_cos_f.tif" -co COMPRESS=LZW -ot Float32
|
|
274 |
gdal_calc.py -A $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_cos_f.tif" --calc="(sqrt(A))*10000" --type Int16 --overwrite --outfile /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif"
|
|
275 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif" $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_cos_t10k.tif"
|
|
276 |
rm /tmp/ramdisk/${filename}_${mm}"_cos_t10k_tmp.tif"
|
|
277 |
# Ew
|
|
278 |
pkfilter -m -9999 -dx 4 -dy 4 -f var -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_Ew.tif" -o $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_Ew_f.tif" -co COMPRESS=LZW -ot Float32
|
|
279 |
gdal_calc.py -A $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_Ew_f.tif" --calc="(sqrt(A))*10000" --type Int16 --overwrite --outfile /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif"
|
|
280 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif" $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_Ew_t10k.tif"
|
|
281 |
rm /tmp/ramdisk/${filename}_${mm}"_Ew_t10k_tmp.tif"
|
|
282 |
# Nw
|
|
283 |
pkfilter -m -9999 -dx 4 -dy 4 -f var -d 4 -i $OUTDIR/aspect/tiles/${filename}_${mm}"_Nw.tif" -o $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_Nw_f.tif" -co COMPRESS=LZW -ot Float32
|
|
284 |
gdal_calc.py -A $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_Nw_f.tif" --calc="(sqrt(A))*10000" --type Int16 --overwrite --outfile /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif"
|
|
285 |
gdal_translate -co COMPRESS=LZW -ot Int16 /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif" $OUTDIR/aspect/stdev/tiles/${filename}_${mm}"_Nw_t10k.tif"
|
|
286 |
rm /tmp/ramdisk/${filename}_${mm}"_Nw_t10k_tmp.tif"
|
|
287 |
|
|
288 |
) 2>&1 | tee /mnt/data2/dem_variables/GMTED2010/log_${mm}.txt
|
final version of gmted2010_res_x10/sc2a_dem_variables.sh