forked from edinburgh-university-OOSA/active_sensing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
batchBiomass.bash
executable file
·70 lines (57 loc) · 1.23 KB
/
batchBiomass.bash
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
66
67
68
69
#!/bin/bash -f
#################
# Batch process #
# GEDI data #
#################
# defaults
bin="/geos/netdata/avtrain/data/3d/active_sensing/week10/active_sensing"
output="allBiomass.txt"
# Read the command line
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-inDir)
inDir="$2"
shift;shift
;;
-output)
output="$2"
shift;shift
;;
-help)
echo " "
echo "Batch processing of GEDI biomass"
echo " "
echo "-inDir name; directory name to process all HDF5 files within"
echo "-output name; output filename"
echo " "
exit
;;
*)
echo $"Unrecognised option: $key"
exit 1
esac
done # command line reader
# if a directory specified, read directory
list="/tmp/gedoToProcess.$$.txt"
pushd $inDir/
ls -l|grep ".metric.txt"|gawk '{printf("%s/%s\n",dir,$NF)}' dir="$inDir" > $list
popd
# clear old output
if [ -e $output ];then
rm $output
fi
# loop over input files
temp="/tmp/workSpace.biomass.$$.txt"
while read inName; do
python3 $bin/predictBiomass.py --input $inName --output $temp
cat $temp >> $output
if [ -e $temp ];then
rm $temp
fi
done < $list
if [ -e $list ];then
rm $list
fi
echo "Written to $output"