This commit is contained in:
Gianpaolo Coro 2015-11-01 19:59:27 +00:00
parent d38b737479
commit 02bda5fb74
1 changed files with 6 additions and 5 deletions

View File

@ -39,7 +39,7 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
@Override @Override
public String getDescription() { public String getDescription() {
// TODO Auto-generated method stub //->adjusted description with proper citation
return "A connector for the SeaDataNet infrastructure. This algorithms invokes the Data-Interpolating Variational Analysis (DIVA) SeaDataNet service to interpolate spatial data. " + return "A connector for the SeaDataNet infrastructure. This algorithms invokes the Data-Interpolating Variational Analysis (DIVA) SeaDataNet service to interpolate spatial data. " +
"The model uses GEBCO bathymetry data and requires an estimate of the maximum spatial span of the correlation between points and the signal-to-noise ratio, among the other parameters. " + "The model uses GEBCO bathymetry data and requires an estimate of the maximum spatial span of the correlation between points and the signal-to-noise ratio, among the other parameters. " +
"It can interpolate up to 100,000 points randomly taken from the input table. " + "It can interpolate up to 100,000 points randomly taken from the input table. " +
@ -146,7 +146,7 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
AnalysisLogger.getLogger().debug("Sending data to DIVA: Uploading "+ndata+" records"); AnalysisLogger.getLogger().debug("Sending data to DIVA: Uploading "+ndata+" records");
// integration DivaHttpClient // integration DivaHttpClient
// UPLOADFILE for DIVA // UPLOADFILE for DIVA
//->use the HTTPClient Class methods //->*use the HTTPClient Class methods
DivaFilePostResponse response = DivaHTTPClient.uploadFile(fileForDiva); DivaFilePostResponse response = DivaHTTPClient.uploadFile(fileForDiva);
AnalysisLogger.getLogger().debug("DIVA Server Response for the Upload:\n" + response.getSessionid()); AnalysisLogger.getLogger().debug("DIVA Server Response for the Upload:\n" + response.getSessionid());
status = 50; status = 50;
@ -157,6 +157,7 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
//->Record the time of the analysis //->Record the time of the analysis
AnalysisLogger.getLogger().debug("Analysis finished in "+(t1-t0)+" ms"); AnalysisLogger.getLogger().debug("Analysis finished in "+(t1-t0)+" ms");
status = 80; status = 80;
//->the number of observations is now an integer
statResultMap.put("Minimum value estimated by the model", "" + respAnalysis.getVmin()); statResultMap.put("Minimum value estimated by the model", "" + respAnalysis.getVmin());
statResultMap.put("Maximum value estimated by the model", "" + respAnalysis.getVmax()); statResultMap.put("Maximum value estimated by the model", "" + respAnalysis.getVmax());
statResultMap.put("Number of observations used", "" + respAnalysis.getStat_obs_count_used()); statResultMap.put("Number of observations used", "" + respAnalysis.getStat_obs_count_used());
@ -166,18 +167,18 @@ public class SeaDataNetConnector extends StandardLocalExternalAlgorithm {
AnalysisLogger.getLogger().debug("Downloading result file in "+neofile.getAbsolutePath()); AnalysisLogger.getLogger().debug("Downloading result file in "+neofile.getAbsolutePath());
// DOWNLOAD FILE // DOWNLOAD FILE
DivaHTTPClient.downloadFileDiva(respAnalysis.getIdentifier(), neofile.getAbsolutePath()); DivaHTTPClient.downloadFileDiva(respAnalysis.getIdentifier(), neofile.getAbsolutePath());
//->put the output file in the output object //->*put the output file in the output object
outputfile=neofile; outputfile=neofile;
AnalysisLogger.getLogger().debug("Downloading finished"); AnalysisLogger.getLogger().debug("Downloading finished");
} catch (Exception e) { } catch (Exception e) {
//->ONLY in case of errors, delete the output file //->*ONLY in case of errors, delete the output file
if (neofile.exists()){ if (neofile.exists()){
neofile.delete(); neofile.delete();
AnalysisLogger.getLogger().debug("Output file "+neofile.getAbsolutePath()+" deleted!"); AnalysisLogger.getLogger().debug("Output file "+neofile.getAbsolutePath()+" deleted!");
} }
throw e; throw e;
} finally { } finally {
//->in any case, delete the input file because we don't need it anymore //->*in any case, delete the input file because we don't need it anymore
if (fileForDiva.exists()){ if (fileForDiva.exists()){
fileForDiva.delete(); fileForDiva.delete();
AnalysisLogger.getLogger().debug("Input file "+fileForDiva.getAbsolutePath()+" deleted!"); AnalysisLogger.getLogger().debug("Input file "+fileForDiva.getAbsolutePath()+" deleted!");