This commit is contained in:
Gianpaolo Coro 2015-11-01 11:47:53 +00:00
parent a123015d16
commit 874dee3b71
2 changed files with 46 additions and 13 deletions

View File

@ -112,17 +112,37 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
DivaFilePostResponse response=neo.uploadFile(fileForDiva);
AnalysisLogger.getLogger().debug("Server Response: "+response.getSessionid());
try{
//ANALYSIS
Double correlationVal = Double.parseDouble(config.getParam("CorrelationLength"));
Double signalNoiseVal = Double.parseDouble(config.getParam("SignalNoise"));
Double longMinVal = Double.parseDouble(config.getParam("LongitudeMinValue"));
if(longMinVal<-180)
throw new Exception("Longitudine minumum value is less than -180.");
Double longMaxVal = Double.parseDouble(config.getParam("LongitudeMaxValue"));
if(longMaxVal>180)
throw new Exception("Longitudine maximum value is more than 180.");
Double longResolutionVal = Double.parseDouble(config.getParam("LongitudeResolution"));
Double latMinVal = Double.parseDouble(config.getParam("LatitudeMinValue"));
if(latMinVal<-90)
throw new Exception("Latitude minumum value is less than -90.");
Double latMaxVal = Double.parseDouble(config.getParam("LatitudeMaxValue"));
if(latMaxVal>90)
throw new Exception("Latitude maximum value is more than 90.");
Double latResolutionVal = Double.parseDouble(config.getParam("LatitudeResolution"));
Double depthLevelVal = Double.parseDouble(config.getParam("DepthLevel"));
if((depthLevelVal<-10)||(depthLevelVal>10))
throw new Exception("Depth Level is out of range [-10,10]");
DivaAnalysisGetResponse respAnalysis = neo.getAnalysis(response.getSessionid(),
correlationVal, signalNoiseVal, longMinVal, longMaxVal, longResolutionVal,
@ -133,9 +153,18 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
statResultMap.put("Number of observations used", ""+respAnalysis.getStat_obs_count_used());
statResultMap.put("Posterior probability of the model", ""+respAnalysis.getStat_posteriori_stn());
//DOWNLOAD FILE
neo.downloadFileDiva(neo.WEB_HTTP+neo.DOWN_FILE_NC+respAnalysis.getIdentifier(),
neofile.getAbsolutePath());
}
catch(Exception e){
throw e;
}
finally{
neofile.delete();
AnalysisLogger.getLogger().debug("file deleted");;
}
}
@ -159,6 +188,7 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
inputs.add(p3);
PrimitiveType p4 = new PrimitiveType(Double.class.getName(),
null, PrimitiveTypes.NUMBER, "LongitudeMinValue",
"Minimum value of Longitude Range","-180");
@ -206,6 +236,9 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
inputs.add(p12);
DatabaseType.addDefaultDBPars(inputs);

View File

@ -48,12 +48,12 @@ public class TestSeaDataNetConnector {
config.setParam("Latitude", "centerlat");
config.setParam("Quantity", "landdist");
config.setParam("LongitudeMinValue", "-180");
config.setParam("LongitudeMinValue", "-200");
config.setParam("LongitudeMaxValue", "180");
config.setParam("LongitudeResolution", "3");
config.setParam("LatitudeMinValue", "-70");
config.setParam("LatitudeMaxValue", "70");
config.setParam("LatitudeMinValue", "-90");
config.setParam("LatitudeMaxValue", "90");
config.setParam("LatitudeResolution", "3");
config.setParam("CorrelationLength", "10");