-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d71ccc7
commit c629cb9
Showing
4 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import glob | ||
import os | ||
import math | ||
ruta="/home/data/insar/alos/Galeras/track152" | ||
f1=glob.glob(ruta+"/ALPSR*") | ||
f=[] | ||
for k in f1: | ||
if not k.endswith(".zip"): | ||
f.append(k) | ||
cont=0 | ||
pos=1 | ||
bs_top = 'perp_baseline_top' # dummy word. you take it from input | ||
bs_bottom ='perp_baseline_bottom' | ||
fecha='sensing_start' | ||
y1=0 | ||
y2=0 | ||
m1=0 | ||
m2=0 | ||
bs_1=0 | ||
bs_2=0 | ||
doit=False | ||
for i in f: | ||
for j in f[pos:]: | ||
d="/home/mario/Desktop/ALOS_insar/track152/"+`cont` | ||
# os.makedirs(d) | ||
if len(glob.glob(d+'/isceProc*')) is not 0: | ||
with open(glob.glob(d+'/isceProc*')[0],'r') as fi: | ||
lines = fi.read().split("\n") | ||
uno=False | ||
for k,line in enumerate(lines): | ||
if bs_top in line: | ||
bs_1=(line.split('>')[1]).split('<')[0] | ||
if bs_bottom in line: | ||
bs_2=(line.split('>')[1]).split('<')[0] | ||
if fecha in line and uno: | ||
y2=(line.split('>')[1]).split('-')[0] | ||
m2=(line.split('>')[1]).split('-')[1] | ||
if fecha in line and not uno: | ||
y1=(line.split('>')[1]).split('-')[0] | ||
m1=(line.split('>')[1]).split('-')[1] | ||
uno=True | ||
tiempo1=float(y1)+float(m1)/12 | ||
tiempo2=float(y2)+float(m2)/12 | ||
tiempo=math.fabs(tiempo2-tiempo1) | ||
if min([math.fabs(float(bs_1)),math.fabs(float(bs_2))])<300 and tiempo<2: | ||
doit=True | ||
else: | ||
doit=False | ||
else: | ||
doit=False | ||
if doit: | ||
d1=d+"/insarApp.xml" | ||
ar=open(d1,"w+") | ||
ar.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<insarApp>\n<component name=\"insar\">\n<property name=\"Sensor Name\">\n<value>ALOS</value>\n</property>\n<property name=\"Unwrap\">\n<value>True</value>\n</property>\n<property name=\"unwrapper name\">\n<value>snaphu_mcf</value>\n</property>\n<property name=\"geocode bounding box\">\n<value>[0,2,-78,-76]</value>\n</property>\n<component name=\"Master\">\n<property name=\"IMAGEFILE\">\n<value>"+i+"/IMG-HH-"+(i.split("/")[7]).split("-")[0]+"-H1.0__A</value>\n</property>\n<property name=\"LEADERFILE\">\n<value>"+i+"/LED-"+(i.split("/")[7]).split("-")[0]+"-H1.0__A</value>\n</property>\n<property name=\"OUTPUT\">\n<value>master.raw</value>\n</property>\n</component>\n<component name=\"Slave\">\n<property name=\"IMAGEFILE\">\n<value>"+j+"/IMG-HH-"+(j.split("/")[7]).split("-")[0]+"-H1.0__A</value>\n</property>\n<property name=\"LEADERFILE\">\n<value>"+j+"/LED-"+(j.split("/")[7]).split("-")[0]+"-H1.0__A</value>\n</property>\n<property name=\"OUTPUT\">\n<value>slave.raw</value>\n</property>\n</component>\n<property name=\"range looks\">10</property>\n<property name=\"azimuth looks\">10</property>\n</component>\n</insarApp>") | ||
ar.close() | ||
else: | ||
print "no se hizo en la carpeta",cont | ||
cont+=1 | ||
pos+=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import glob | ||
import os | ||
ruta="/home/data/insar/alos/Galeras/track152" | ||
f1=glob.glob(ruta+"/ALPSR*") | ||
f=[] | ||
for k in f1: | ||
if not k.endswith(".zip"): | ||
f.append(k) | ||
cont=0 | ||
pos=1 | ||
for i in f: | ||
d="/home/mario/Desktop/ALOS_insar/track152/"+`cont` | ||
os.makedirs(d) | ||
d1=d+"/isceApp.xml" | ||
ar=open(d1,"w+") | ||
ar.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<isceApp>\n<component name=\"isce\">\n<constant name=\"topdir\">/home/data/insar/alos/Galeras/track152</constant>\n<component name=\"stack\">\n<component name=\"Scene1\">\n<constant name=\"dir1\">$topdir$/"+i.split("/")[7]+"</constant>\n<property name=\"id\">alos1</property>\n<property name=\"hh\">$dir1$/IMG-HH-"+(i.split("/")[7]).split("-")[0]+"-H1.0__A</property>\n<property name=\"leaderfile\">$dir1$/LED-"+(i.split("/")[7]).split("-")[0]+"-H1.0__A</property>\n</component>\n</component>\n<property name=\"output directory\">.</property>\n<property name=\"selectScenes\">alos1</property>\n<property name=\"sensor name\">ALOS</property>\n<property name=\"number of patches\">1</property>\n<property name=\"slc offset method\">offsetprf</property> <!--offsetprf, ampcor-->\n<property name=\"do preprocess\">True</property>\n</component>\n</isceApp>") | ||
ar.close() | ||
cont+=1 | ||
pos+=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os | ||
import glob | ||
|
||
''' | ||
Script to make Sentinel interferogram | ||
''' | ||
d="/home/mario/Desktop/Sentinel_insar/A120/sub_1/" | ||
d1="/home/mario/Desktop/Sentinel_insar/A120/sub_2/" | ||
d2="/home/mario/Desktop/Sentinel_insar/A120/sub_3/" | ||
f1=glob.glob(d+"*") | ||
f2=glob.glob(d1+"*") | ||
f3=glob.glob(d3+"*") | ||
f=[] | ||
for k in f1: | ||
f.append(k) | ||
for k in f2: | ||
f.append(k) | ||
for k in f3: | ||
f.append(k) | ||
for k in f: | ||
os.system("cd "+os.path.abspath(k)+"; topsApp.py --steps | tee topsApp.log; cd ..") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import glob | ||
import os | ||
''' | ||
This script creates folders and xml input files for topsApp.py it makes all the posibles | ||
pairs for some Sentinel SAR scenes. | ||
This script should be execute before tops_commands.py | ||
''' | ||
#Sentinel SAR scenes folder | ||
SAR_images="/home/data/insar/sentinel/cerro_negro/" | ||
#Folder where all the inteferograms will be storage | ||
output="/home/mario/Desktop/Sentinel_insar/A120/" | ||
#SAR scenes folders array | ||
f1=glob.glob(SAR_imagenes+"*") | ||
f=[] | ||
for k in f1: | ||
f.append(k) | ||
cont=0 | ||
pos=1 | ||
#The indexes i and j are the two SAR scenes for the interferogram | ||
for i in f: | ||
for j in f[pos:]: | ||
#This part choose which of the two scenes has the first date, and that scene is the master | ||
if int((os.path.basename(i).split('_')[5]).split('T')[0])<int((os.path.basename(j).split('_')[5]).split('T')[0]): | ||
m=i | ||
s=j | ||
else: | ||
m=j | ||
s=i | ||
#pd is the name of the interferogram folder the format is '1st date'_'2nd date' | ||
pd=(os.path.basename(m).split('_')[5]).split('T')[0]+"_"+(os.path.basename(s).split('_')[5]).split('T')[0] | ||
#The script makes all the posible interferograms on the three swaths | ||
for h in range(3): | ||
g=h+1 | ||
d=output+"sub_"+str(g)+"/"+pd | ||
os.makedirs(d) | ||
d1=d+"/topsApp.xml" | ||
ar=open(d1,"w+") | ||
ar.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<topsApp>\n <component name=\"topsinsar\">\n <property name=\"Sensor name\">SENTINEL1A</property>\n <property name=\"do unwrap\">True</property>\n <property name=\"unwrapper name\">snaphu_mcf</property>\n <component name=\"master\">\n <property name=\"orbit directory\">/home/data/ORBITS/sentinel-1/POEORB</property>\n <property name=\"auxiliary data directory\">/home/data/ORBITS/sentinel-1/AUX_CAL</property>\n <property name=\"output directory\">master</property>\n <property name=\"swath number\">"+str(g)+"</property>\n <property name=\"safe\">/home/data/insar/sentinel/cerro_negro/"+os.path.basename(m)+"</property>\n </component>\n <component name=\"slave\">\n <property name=\"orbit directory\">/home/data/ORBITS/sentinel-1/POEORB</property>\n <property name=\"auxiliary data directory\">/home/data/ORBITS/sentinel-1/AUX_CAL</property>\n <property name=\"output directory\">slave</property>\n <property name=\"swath number\">"+str(g)+"</property>\n <property name=\"safe\">/home/data/insar/sentinel/cerro_negro/"+os.path.basename(s)+"</property>\n </component>\n <constant name=\'demdir\'>/home/data/dems/srtmGL1/colombia</constant>\n <property name=\"demfilename\">$demdir$/demLat_S04_N12_Lon_W081_W070.dem.wgs84</property>\n </component>\n</topsApp>") | ||
ar.close() | ||
pos+=1 |