@@ -24,6 +24,7 @@ |
import static m.oms.ages.V1_0.KEY_SCRIPT_NP300; |
import static m.oms.ages.V1_0.KEY_SCRIPT_NP3000; |
import static m.oms.ages.V1_0.KEY_SCRIPT_NPBDCW; |
+import static m.oms.ages.V1_0.KEY_SCRIPT_NPEAGLE; |
import ngmf.util.cosu.luca.of.NS; |
import ngmf.util.cosu.luca.of.RMSE; |
import ngmf.util.cosu.luca.of.TRMSE; |
@@ -55,6 +56,7 @@ |
@Resource(file = "${csip.dir}/bin/ages/simulation/ages_noPLSFIR300.sim", type = REFERENCE, id = KEY_SCRIPT_NP300) |
@Resource(file = "${csip.dir}/bin/ages/simulation/ages_noPLSFIR3000.sim", type = REFERENCE, id = KEY_SCRIPT_NP3000) |
@Resource(file = "${csip.dir}/bin/ages/simulation/ages_noPLBDCW.sim", type = REFERENCE, id = KEY_SCRIPT_NPBDCW) |
+@Resource(file = "${csip.dir}/bin/ages/simulation/ages_noPLEAGLE.sim", type = REFERENCE, id = KEY_SCRIPT_NPEAGLE) |
public class V1_0 extends ModelDataService { |
|
public static final String KEY_SCRIPT = "ages.sim"; |
@@ -64,6 +66,7 @@ |
public static final String KEY_SCRIPT_NP300 = "ages_noPLSFIR300.sim"; // no payload script |
public static final String KEY_SCRIPT_NP3000 = "ages_noPLSFIR3000.sim"; // no payload script |
public static final String KEY_SCRIPT_NPBDCW = "ages_noPLBDCW.sim"; // no payload script |
+ public static final String KEY_SCRIPT_NPEAGLE = "ages_noPLEAGLE.sim"; // no payload script |
public static final String RUN_INC = "run.inc"; |
|
public static final String PAR_STARTTIME = "startTime"; |
@@ -77,6 +80,9 @@ |
|
static final Map<String, ObjectiveFunction> OF = new HashMap<>(); |
|
+ public String data_folder = ""; |
+ boolean payLoad = false; |
+ |
static { |
OF.put("kge", new KGE()); |
OF.put("ns", new NS()); |
@@ -218,12 +224,14 @@ |
"flagSaveState", |
"flagLoadState", |
"flagWB", |
- "loadStateFilePath" |
+ "loadStateFilePath", |
+ "dataStartTime", |
+ "dataEndTime" |
}; |
|
@Override |
public void doProcess() throws Exception { |
- boolean payLoad = parameter().getBoolean(PAYLOAD, true); |
+ payLoad = parameter().getBoolean(PAYLOAD, false); |
String project = parameter().getString(PROJECT, "SFIR3"); |
String dsl = parameter().getString(KEY_SCRIPT, |
resources().getFile(KEY_SCRIPT).toString()); |
@@ -251,9 +259,15 @@ |
dsl = parameter().getString(KEY_SCRIPT_NPBDCW, |
resources().getFile(KEY_SCRIPT_NPBDCW).toString()); |
} |
+ if (project.equals("EAGLE")) { |
+ dsl = parameter().getString(KEY_SCRIPT_NPEAGLE, |
+ resources().getFile(KEY_SCRIPT_NPEAGLE).toString()); |
+ } |
} |
} |
|
+ data_folder = project; |
+ |
// pass request param to model runtime parameter -> run.inc |
Map<String, String> agesParam = new LinkedHashMap<>(); |
Utils.passReqQuotedParam(agesParam, parameter(), reqParams); |
@@ -305,7 +319,13 @@ |
private double calc_of(ObjectiveFunction of, String obs, |
String sim, String start, String end) throws IOException, ServiceException { |
// e.g. obs_data02_14.csv/obs/orun[1] |
- double[] obsData = Utils.getData(obs, getWorkspaceDir(), start, end); |
+ double[] obsData = null; |
+ if (!payLoad) { |
+ String new_string = "/tmp/csip/bin/ages/data/" + data_folder; |
+ obsData = Utils.getData(obs, new File(new_string), start, end); |
+ } else { |
+ obsData = Utils.getData(obs, getWorkspaceDir(), start, end); |
+ } |
// e.g. output/csip_run/out/Outlet.csv/output/catchmentSimRunoff |
double[] simData = Utils.getData(sim, getWorkspaceDir(), start, end); |
return of.calculate(obsData, simData, parameter().getDouble("missing", -9999d)); |