-
Notifications
You must be signed in to change notification settings - Fork 35
/
run_SLCcropStack_mod.csh
136 lines (113 loc) · 3.48 KB
/
run_SLCcropStack_mod.csh
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/tcsh -f
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# copyright: 2016 to the present, california institute of technology.
# all rights reserved. united states government sponsorship acknowledged.
#
# THESE SCRIPTS ARE PROVIDED TO YOU "AS IS" WITH NO WARRANTIES OF CORRECTNESS. USE AT YOUR OWN RISK.
#
# Author: David Bekaert
# Organization: Jet Propulsion Laboratory, California Institute of Technology
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Script is part of StaMPS https://github.com/dbekaert/StaMPS/releases/tag/v4.1-beta
#
# -------------------------------------------------------
# Modified:
# - Alexis Hrysiewicz, UCD / iCRAG
set overwrite = $1
set data_path = $2
set proc_dir = $3
# check if the procesing dir already exists
if (! -e $proc_dir) then
mkdir $proc_dir
endif
# getting the crop extend
cd $data_path/geom_reference
set cmd=`echo "crop_rdr.py -b '"$4" "$5" "$6" "$7"' > $proc_dir/crop_log.txt"`
eval $cmd
#### NO changes required below ######
# getting the files to crop
cd $proc_dir
ls -1 $data_path/geom_reference/*.full > $proc_dir/geomFiles2crop.txt
ls -1 $data_path/SLC/2*/2*.slc.full > $proc_dir/slcFiles2crop.txt
ls -1 $data_path/baselines/2*/2*.full.vrt > $proc_dir/baselineFiles2crop.txt
# getting the cropping command
set command_baseline = `grep warp $proc_dir/crop_log.txt`
set command = `grep gdal_translate $proc_dir/crop_log.txt`
echo $command
echo $command_baseline
# generating the new geometry files
# create geom directory
cd $proc_dir
if (! -d geom_reference ) then
mkdir geom_reference
endif
cd geom_reference
foreach file(`cat $proc_dir/geomFiles2crop.txt`)
set filename = `basename $file`
# crop the files
if ( -f $filename & $overwrite == 0) then
echo File exist
else
echo $command $file $filename
`echo $command $file $filename`
# generate the xml files for it
echo gdal2isce_xml.py -i $filename
`echo gdal2isce_xml.py -i $filename`
endif
end
# generating the new geometry files
# create SLC directory
cd $proc_dir
if (! -d SLC ) then
mkdir SLC
endif
cd SLC
foreach file(`cat $proc_dir/slcFiles2crop.txt`)
set filename = `basename $file`
set date = `basename $file | cut -c1-8`
echo $date
# make the SLC date dir
if (! -d $date ) then
mkdir $date
endif
cd $date
# crop the files
if ( -f $filename & $overwrite == 0) then
echo File exist
else
echo $command $file $filename
`echo $command $file $filename`
# generate the xml files for it
echo gdal2isce_xml.py -i $filename
`echo gdal2isce_xml.py -i $filename`
endif
cd $proc_dir/SLC
end
# generating the new baseline files
# create the baseline directory
cd $proc_dir
if (! -d baselines ) then
mkdir baselines
endif
cd baselines
foreach file(`cat $proc_dir/baselineFiles2crop.txt`)
set filename = `basename $file`
set date = `basename $file | cut -c1-8`
echo $date
# make the SLC date dir
if (! -d $date ) then
mkdir $date
endif
cd $date
# crop the files
if ( -f $filename & $overwrite == 0) then
echo File exist
else
echo $command_baseline $file $date
`echo $command_baseline $file $date`
# generate the xml files for it
echo gdal2isce_xml.py -i $date
`echo gdal2isce_xml.py -i $date`
endif
cd $proc_dir/baselines
end