-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
85 lines (68 loc) · 2.57 KB
/
Program.cs
File metadata and controls
85 lines (68 loc) · 2.57 KB
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
using WasdiLib;
using WasdiLib.Models;
namespace TutorialSeeSharpApp
{
internal class Program : IWasdiRunnable
{
static void Main(string[] args)
{
Wasdi wasdi = new();
wasdi.Init();
wasdi.SetVerbose(true);
Program program = new Program();
program.Run(wasdi);
UpdateStatus(wasdi);
}
public void Run(Wasdi wasdi)
{
RunExecuteWorkflow(wasdi);
RunExecuteProcessor(wasdi);
}
private static void RunExecuteWorkflow(Wasdi wasdi)
{
string sStartDate = wasdi.GetParam("DATEFROM");
string sEndDate = wasdi.GetParam("DATETO");
string sBbox = wasdi.GetParam("BBOX");
string sWorkflow = wasdi.GetParam("WORKFLOW");
double dLatN = 44.0;
double dLonW = 35.0;
double dLatS = 45.0;
double dLonE = 36.0;
if (sBbox != null)
{
String[] asLatLons = sBbox.Split(',');
dLatN = Double.Parse(asLatLons[0]);
dLonW = Double.Parse(asLatLons[1]);
dLatS = Double.Parse(asLatLons[2]);
dLonE = Double.Parse(asLatLons[3]);
}
wasdi.WasdiLog("Start searching images");
List<QueryResult> aoResults = wasdi.SearchEOImages("S1", sStartDate, sEndDate, dLatN, dLonW, dLatS, dLonE, "GRD", null, null, null);
wasdi.WasdiLog("Found " + aoResults.Count + " Images");
if (aoResults.Count > 0)
{
wasdi.ImportProduct(aoResults[0]);
List<string> asInputs = new List<string>();
asInputs.Add(aoResults[0].Title + ".zip");
List<string> asOutputs = new List<string>();
asOutputs.Add("preprocessed.tif");
wasdi.ExecuteWorkflow(asInputs, asOutputs, sWorkflow);
}
wasdi.WasdiLog("FINISHED");
}
private static void RunExecuteProcessor(Wasdi wasdi)
{
// call another app: HelloWasdiWorld
Dictionary<string, object> dictionary = new Dictionary<string, object>()
{ { "name", wasdi.GetUser() } };
wasdi.ExecuteProcessor("HelloWasdiWorld", dictionary);
}
private static void UpdateStatus(Wasdi wasdi)
{
wasdi.WasdiLog("UpdateStatus:");
string sStatus = "DONE";
int iPerc = 100;
wasdi.UpdateStatus(sStatus, iPerc);
}
}
}