Commit 9c22b49f authored by Lozac'h Loic's avatar Lozac'h Loic

debug

parent e2a2022e
......@@ -216,7 +216,11 @@ def download_gpm(sarlist, sartype, gpmdir):
print("wget failed %d : %s" % (p.returncode, output))
def process_gpm(sar, sar3dates, gpmdir):
outdir = os.path.join( os.path.dirname(gpmdir),"CumulPluie")
outdir = os.path.join( os.path.dirname(gpmdir),"MaskWetOrDry")
outfile = os.path.join(outdir,"MaskWetOrDry"+args.zone+"_"+sar3dates[0]+".tif")
if os.path.exists(outfile):
print("Already exists : "+outfile)
return
if not os.path.exists(outdir):
os.mkdir(outdir)
......@@ -252,16 +256,11 @@ def process_gpm(sar, sar3dates, gpmdir):
app0.AddImageToParameterInputImageList("il", app[0].GetParameterOutputImage("out"))
app0.AddImageToParameterInputImageList("il", app[1].GetParameterOutputImage("out"))
app0.AddImageToParameterInputImageList("il", app[2].GetParameterOutputImage("out"))
app0.SetParameterString("out", "tempS.tif")
app0.SetParameterString("exp", "im1b1+im2b1+im3b1")
app0.Execute()
app0.SetParameterString("out", outfile)
app0.SetParameterOutputImagePixelType("out", otbApplication.ImagePixelType_uint8)
app0.SetParameterString("exp", "im1b1+im2b1+im3b1>5?2:1")
app0.ExecuteAndWriteOutput()
app1 = otbApplication.Registry.CreateApplication("Smoothing")
app1.SetParameterInputImage("in", app0.GetParameterOutputImage("out"))
app1.SetParameterString("type", "gaussian")
app1.SetParameterString("out", os.path.join(outdir,"CumulPluie_"+args.zone+"_"+sar3dates[0]+".tif"))
app1.SetParameterOutputImagePixelType("out", otbApplication.ImagePixelType_uint16)
app1.ExecuteAndWriteOutput()
def process_gpm_noresampling(sar, sar3dates, gpmdir):
outdir = os.path.join( os.path.dirname(gpmdir),"CumulPluie")
......@@ -305,16 +304,17 @@ def process_gpm_noresampling(sar, sar3dates, gpmdir):
app0.AddImageToParameterInputImageList("il", apps[0].GetParameterOutputImage("out"))
app0.AddImageToParameterInputImageList("il", apps[1].GetParameterOutputImage("out"))
app0.AddImageToParameterInputImageList("il", apps[2].GetParameterOutputImage("out"))
app0.SetParameterString("out", "tempS.tif")
app0.SetParameterString("out", outfile)
app0.SetParameterString("exp", "im1b1+im2b1+im3b1")
app0.Execute()
app0.SetParameterOutputImagePixelType("out", otbApplication.ImagePixelType_uint16)
app0.ExecuteAndWriteOutput()
app1 = otbApplication.Registry.CreateApplication("Smoothing")
app1.SetParameterInputImage("in", app0.GetParameterOutputImage("out"))
app1.SetParameterString("type", "gaussian")
app1.SetParameterString("out", outfile)
app1.SetParameterOutputImagePixelType("out", otbApplication.ImagePixelType_uint16)
app1.ExecuteAndWriteOutput()
# app1 = otbApplication.Registry.CreateApplication("Smoothing")
# app1.SetParameterInputImage("in", app0.GetParameterOutputImage("out"))
# app1.SetParameterString("type", "gaussian")
# app1.SetParameterString("out", outfile)
# app1.SetParameterOutputImagePixelType("out", otbApplication.ImagePixelType_uint16)
# app1.ExecuteAndWriteOutput()
def select_tfmodel_from_gpm(sardate,gpmdir):
cumul = glob.glob(os.path.join( os.path.join( os.path.dirname(gpmdir),"CumulPluie"), "CumulPluie_"+args.zone+"_"+sardate+".tif"))
......@@ -361,7 +361,8 @@ def wet_or_dry_pipeline(args):
sardate = sardatetime.split("T")[0]
sar3dates = get_meteodates_from_sardate(sardate)
process_gpm_noresampling(sar, sar3dates, args.gpmdir)
# process_gpm_noresampling(sar, sar3dates, args.gpmdir)
process_gpm(sar, sar3dates, args.gpmdir)
res=select_tfmodel_from_gpm(sardate, args.gpmdir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment