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,42 +188,43 @@ 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");
PrimitiveType p5 = new PrimitiveType(Double.class.getName(),
null, PrimitiveTypes.NUMBER, "LongitudeMaxValue",
"Maximum value of Longitude Range","180");
PrimitiveType p6 = new PrimitiveType(Double.class.getName(),
null, PrimitiveTypes.NUMBER, "LongitudeResolution",
"Longitude resolution (minimum 0.1 - maximum 10)", "1");
PrimitiveType p7 = new PrimitiveType(Double.class.getName(),
null, PrimitiveTypes.NUMBER, "LatitudeMinValue",
"Minimum value of Latitude Range","-85");
PrimitiveType p8 = new PrimitiveType(Double.class.getName(),
null, PrimitiveTypes.NUMBER, "LatitudeMaxValue",
"Maximum value of Latitude Range","85");
PrimitiveType p9 = new PrimitiveType(Double.class.getName(),
null, PrimitiveTypes.NUMBER, "LatitudeResolution",
"Latitude resolution (minimum 0.1 - maximum 10)", "1");
PrimitiveType p10 = new PrimitiveType(Double.class.getName(),
null, PrimitiveTypes.NUMBER, "CorrelationLength",
"Correlation length (arc degrees)", "10.35");
PrimitiveType p11 = new PrimitiveType(Double.class.getName(),
null, PrimitiveTypes.NUMBER, "SignalNoise",
"Signal to noise ratio (non-dimensional)", "1.08");
PrimitiveType p12 = new PrimitiveType(Double.class.getName(),
null, PrimitiveTypes.NUMBER, "DepthLevel",
"Depth level", "0");
inputs.add(p4);
inputs.add(p5);
inputs.add(p6);
@ -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");