@@ -9,14 +9,18 @@ |
import static csip.annotations.ResourceType.*; |
import csip.cosu.ObjFunc; |
import java.io.File; |
+import java.util.ArrayList; |
import java.util.LinkedHashMap; |
+import java.util.List; |
import java.util.Map; |
import javax.ws.rs.Path; |
import static m.oms.Resources.LOCATION_MNT_DATA; |
import static m.oms.Resources.flags; |
import static m.oms.Resources.optParams; |
import static m.oms.Resources.outputs; |
+import static m.oms.ages.V1_01cp.dataFolder; |
import oms.utils.Utils; |
+import oms3.io.DataIO; |
|
/** |
* Ages service. |
@@ -52,6 +56,16 @@ |
|
public String data_folder = ""; |
boolean payLoad = false; |
+ boolean obs_ou = false; |
+ |
+ public List<String> obs_files = new ArrayList<>(); |
+ public static File dataFolder = null; |
+ |
+ private static final int FILE = 0; |
+ private static final int TABLE = 1; |
+ private static final int COLUMN = 2; |
+ |
+ boolean obs_out = false; |
|
// required parameter |
String[] reqParams = { |
@@ -132,6 +146,18 @@ |
String[] data = cosu().getData(name); |
ObjFunc of = cosu().getObjFunc(name); |
|
+ obs_ou = true; |
+ |
+// if (obs_out) { |
+ String[] parts = DataIO.parseCsvFilename(data[0]); |
+ if (parts.length != 3) { |
+ throw new IllegalArgumentException("invalid: " + data[0] + " expected:: <file>/<table>/<column>"); |
+ } |
+ if (!obs_files.contains(parts[FILE])) { |
+ obs_files.add(parts[FILE]); |
+ } |
+// } |
+ |
double[] obsData = Utils.getData(data[0], |
dataFolder, cal_start, cal_end); |
// e.g. output/csip_run/out/Outlet.csv/output/catchmentSimRunoff |
@@ -142,4 +168,16 @@ |
cosu().setValue(name, result); |
} |
} |
+ |
+ @Override |
+ protected void postProcess() throws Exception { |
+ if (obs_out) { |
+ // observed file !!!! |
+ for (int i = 0; i < obs_files.size(); i++) { |
+ if (new File(dataFolder, obs_files.get(i)).exists()) { |
+ results().put(new File(dataFolder, obs_files.get(i)), "observed-data-file_" + i); |
+ } |
+ } |
+ } |
+ } |
} |