1
|
|
2
|
|
3
|
# for dir in `seq -600 100 8700` ; do echo $dir ; done | xargs -n 1 -P 36 bash /mnt/data/jetzlab/Data/environ/global/dem_class/sc2_dem_treshold_density_merge.sh
|
4
|
|
5
|
DIR=$1
|
6
|
|
7
|
INDIR=/mnt/data/jetzlab/Data/environ/global/dem_class/class$DIR
|
8
|
OUTDIR=/mnt/data/jetzlab/Data/environ/global/dem_class/percent
|
9
|
|
10
|
rm $INDIR/file_processed_sc1.txt # the file has ben processed by the script sc1_dem_treshold_percent.sh
|
11
|
|
12
|
for tile in `cat $OUTDIR/../geo_file/list_tiles.txt ` ; do
|
13
|
|
14
|
# for tile in `grep -e N45E09* -e N50E09* -e N55E09* $OUTDIR/../list_tiles.txt` ; do
|
15
|
|
16
|
if [ -f $INDIR/$tile"_C"$DIR"Perc.tif" ] ; then
|
17
|
|
18
|
echo the file $INDIR/$tile"_C"$DIR"Perc.tif" exist and will be merged as it is
|
19
|
echo $tile"_C"$DIR"Perc.tif" >> $INDIR/file_processed_sc1.txt # usefull to list file processed by script sc1, in case of delatio use this.
|
20
|
|
21
|
else
|
22
|
|
23
|
max=$( awk '{print $2 * 100 }' /mnt/data/jetzlab/Data/environ/global/dem_class/txt/$tile"_min_max.txt")
|
24
|
min=$( awk '{print $1 * 100 }' /mnt/data/jetzlab/Data/environ/global/dem_class/txt/$tile"_min_max.txt")
|
25
|
|
26
|
echo $min and $max compare to $DIR
|
27
|
|
28
|
if [ $max -lt $DIR ] ; then
|
29
|
echo building the $INDIR/$tile"_C"$DIR"Perc.tif" with 0 value
|
30
|
pkgetmask -min 100 -max 101 -t 0 -ot Byte -i $INDIR/../class/$tile"_class.tif" -co COMPRESS=LZW -o $INDIR/$tile"_C"$DIR"Perc.tif"
|
31
|
gdalwarp -tr 0.00833333333333 -0.00833333333333 -co COMPRESS=LZW -ot Byte $INDIR/$tile"_C"$DIR"Perc_tmp.tif" $INDIR/$tile"_C"$DIR"Perc.tif"
|
32
|
rm $INDIR/$tile"_C"$DIR"Perc_tmp.tif"
|
33
|
fi
|
34
|
|
35
|
if [ $min -gt $DIR ] ; then
|
36
|
echo building the $INDIR/$tile"_C"$DIR"Perc.tif" with 100 value
|
37
|
pkgetmask -min 100 -max 101 -t 0 -f 100 -ot Byte -co COMPRESS=LZW -i $INDIR/../class/$tile"_class.tif" -o $INDIR/$tile"_C"$DIR"Perc.tif"
|
38
|
gdalwarp -tr 0.00833333333333 -0.00833333333333 -co COMPRESS=LZW -ot Byte $INDIR/$tile"_C"$DIR"Perc_tmp.tif" $INDIR/$tile"_C"$DIR"Perc.tif"
|
39
|
rm $INDIR/$tile"_C"$DIR"Perc_tmp.tif"
|
40
|
fi
|
41
|
|
42
|
fi
|
43
|
|
44
|
done
|
45
|
|
46
|
# pkcrop -ulx -180 -uly 83 -lrx 180 -lry -60 -ot Byte -co COMPRESS=LZW -o $OUTDIR/perc_$DIR.tif $(for file in $INDIR/Smoothed_N*E*_C$DIR"Perc.tif" ; do echo -n "-i $file " ; done)
|
47
|
|
48
|
gdal_merge.py -ul_lr -180 83 180 -60 -ps -0.008333333333330 -0.008333333333330 -ot Byte -o $OUTDIR/perc_NE_$DIR.tif $INDIR/Smoothed_N*E*_C$DIR"Perc.tif"
|
49
|
gdal_merge.py -ul_lr -180 83 180 -60 -ps -0.008333333333330 -0.008333333333330 -ot Byte -o $OUTDIR/perc_NW_$DIR.tif $INDIR/Smoothed_N*W*_C$DIR"Perc.tif"
|
50
|
gdal_merge.py -ul_lr -180 83 180 -60 -ps -0.008333333333330 -0.008333333333330 -ot Byte -o $OUTDIR/perc_SE_$DIR.tif $INDIR/Smoothed_S*E*_C$DIR"Perc.tif"
|
51
|
gdal_merge.py -ul_lr -180 83 180 -60 -ps -0.008333333333330 -0.008333333333330 -ot Byte -o $OUTDIR/perc_SW_$DIR.tif $INDIR/Smoothed_S*W*_C$DIR"Perc.tif"
|
52
|
|
53
|
gdal_merge.py -ul_lr -180 83 180 -60 -co COMPRESS=LZW -ps -0.008333333333330 -0.008333333333330 -ot Byte -o $OUTDIR/perc_$DIR.tif $INDIR/Smoothed_N*E*_C$DIR"Perc.tif" $INDIR/Smoothed_N*W*_C$DIR"Perc.tif" $INDIR/Smoothed_S*E*_C$DIR"Perc.tif" $INDIR/Smoothed_S*W*_C$DIR"Perc.tif"
|
54
|
|