This commit is contained in:
Gianpaolo Coro 2015-11-01 19:44:36 +00:00
parent b3103d155f
commit 7cb9b55c8f
3 changed files with 15 additions and 11 deletions

View File

@ -5,12 +5,12 @@ public class DivaAnalysisGetResponse {
String identifier;
Double vmin;
Double vmax;
Double stat_obs_count_used;
Integer stat_obs_count_used;
Double stat_posteriori_stn;
public DivaAnalysisGetResponse(String identifier, Double vmin,
Double vmax,
Double stat_obs_count_used,
Integer stat_obs_count_used,
Double stat_posteriori_stn){
super();
@ -48,11 +48,11 @@ public class DivaAnalysisGetResponse {
this.vmax = vmax;
}
public Double getStat_obs_count_used() {
public Integer getStat_obs_count_used() {
return stat_obs_count_used;
}
public void setStat_obs_count_used(Double stat_obs_count_used) {
public void setStat_obs_count_used(Integer stat_obs_count_used) {
this.stat_obs_count_used = stat_obs_count_used;
}

View File

@ -166,7 +166,7 @@ public class DivaHTTPClient {
String identifier = idNode.getAttributes().item(0).getNodeValue();
Double vmin = Double.parseDouble(doc.getElementsByTagName("stat").item(0).getTextContent());
Double vmax = Double.parseDouble(doc.getElementsByTagName("stat").item(1).getTextContent());
Double stat_obs_count_used = Double.parseDouble(doc.getElementsByTagName("stat").item(2).getTextContent());
Integer stat_obs_count_used = Integer.parseInt(doc.getElementsByTagName("stat").item(2).getTextContent());
Double stat_posteriori_stn = Double.parseDouble(doc.getElementsByTagName("stat").item(3).getTextContent());
responseStream.close();

View File

@ -127,7 +127,8 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
String query = "select "
+ config.getParam("Longitude") + "," + config.getParam("Latitude") + "," + config.getParam("Quantity") + " From " + getInputParameter("InputTable") +
" ORDER BY RANDOM() limit 100000";
status = 10;
AnalysisLogger.getLogger().debug("Query for extracting data from the DB: " + query);
List<Object> dataList = DatabaseFactory.executeSQLQuery(query, dbconnection);
int ndata = dataList.size();
@ -145,22 +146,24 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
// UPLOADFILE for DIVA
DivaFilePostResponse response = DivaHTTPClient.uploadFile(fileForDiva);
AnalysisLogger.getLogger().debug("DIVA Server Response for the Upload:\n" + response.getSessionid());
status = 50;
AnalysisLogger.getLogger().debug("Requesting analysis to DIVA...");
long t0 = System.currentTimeMillis();
DivaAnalysisGetResponse respAnalysis = DivaHTTPClient.getAnalysis(response.getSessionid(), correlationVal, signalNoiseVal, longMinVal, longMaxVal, longResolutionVal, latMinVal, latMaxVal, latResolutionVal, depthLevelVal);
long t1 = System.currentTimeMillis();
AnalysisLogger.getLogger().debug("Analysis finished in "+(t1-t0)+" ms");
statResultMap.put("Minimum value of the analysis", "" + respAnalysis.getVmin());
statResultMap.put("Maximum value of the analysis", "" + respAnalysis.getVmax());
status = 80;
statResultMap.put("Minimum value estimated by the model", "" + respAnalysis.getVmin());
statResultMap.put("Maximum value estimated by the model", "" + respAnalysis.getVmax());
statResultMap.put("Number of observations used", "" + respAnalysis.getStat_obs_count_used());
statResultMap.put("Posterior probability of the model", "" + respAnalysis.getStat_posteriori_stn());
statResultMap.put("A posteriori estimate of signal-to-noise ratio", "" + respAnalysis.getStat_posteriori_stn());
AnalysisLogger.getLogger().debug("Map of results to be returned: "+statResultMap);
AnalysisLogger.getLogger().debug("Downloading result file in "+neofile.getAbsolutePath());
// DOWNLOAD FILE
DivaHTTPClient.downloadFileDiva(respAnalysis.getIdentifier(), neofile.getAbsolutePath());
//put the output file in the output object
outputfile=neofile;
AnalysisLogger.getLogger().debug("Downloading finished");
} catch (Exception e) {
if (neofile.exists()){
@ -173,6 +176,7 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
fileForDiva.delete();
AnalysisLogger.getLogger().debug("Input file "+fileForDiva.getAbsolutePath()+" deleted!");
}
AnalysisLogger.getLogger().debug("DIVA process finished");
}
}