From fee25d9383e85e496c7e04ec3ff31254f1e70fa6 Mon Sep 17 00:00:00 2001 From: Gianpaolo Coro Date: Tue, 26 Jun 2012 15:32:37 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@55991 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../bioclimate/BioClimateAnalysis.java | 6 ++ .../bioclimate/InterpolateTables.java | 2 +- .../regressions/TestBioClimateAnalysis.java | 57 ++++++++++++++++++- 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/bioclimate/BioClimateAnalysis.java b/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/bioclimate/BioClimateAnalysis.java index 093732d..26d0106 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/bioclimate/BioClimateAnalysis.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/bioclimate/BioClimateAnalysis.java @@ -114,6 +114,10 @@ public class BioClimateAnalysis { } private void produceGraphs(String[] csquareTableNames, String[] hspecTableNames, float threshold) throws Exception { + + csquareTableNames = checkTableNames(csquareTableNames); + hspecTableNames = checkTableNames(hspecTableNames); + producedImages = new HashMap (); int numberOfTrends = highProbabilityCells.length; @@ -186,6 +190,8 @@ public class BioClimateAnalysis { private String[] checkTableNames(String [] tablesNames){ ArrayList newtables = new ArrayList(); + if ((tablesNames==null) || (tablesNames.length==0)) + return tablesNames; for (String table:tablesNames){ int i=1; String originalTable = table; diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/bioclimate/InterpolateTables.java b/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/bioclimate/InterpolateTables.java index f3e9226..d30d61e 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/bioclimate/InterpolateTables.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/bioclimate/InterpolateTables.java @@ -273,7 +273,7 @@ public class InterpolateTables { String databasePassword = "d4science2"; InterpolateTables interp = new InterpolateTables(configPath, persistencePath, databaseUrl, databaseUser, databasePassword); - interp.interpolate("hcaf_d", "hcaf_d_2050", 10, INTERPOLATIONFUNCTIONS.LINEAR, 2012, 2050); + interp.interpolate("hcaf_d", "hcaf_d_2050", 5, INTERPOLATIONFUNCTIONS.LINEAR, 2012, 2050); } diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/test/regressions/TestBioClimateAnalysis.java b/src/main/java/org/gcube/dataanalysis/ecoengine/test/regressions/TestBioClimateAnalysis.java index 5a397b3..867339d 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/test/regressions/TestBioClimateAnalysis.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/test/regressions/TestBioClimateAnalysis.java @@ -4,7 +4,7 @@ import org.gcube.dataanalysis.ecoengine.evaluation.bioclimate.BioClimateAnalysis public class TestBioClimateAnalysis { - + public static void main(String args[]) throws Exception{ String dburl = "jdbc:postgresql://node49.p.d4science.research-infrastructures.eu/aquamaps"; @@ -12,6 +12,61 @@ public class TestBioClimateAnalysis { String dbPassword = "bilico1980"; BioClimateAnalysis bioClimate=new BioClimateAnalysis("./cfg/","./",dburl, dbUser, dbPassword, true); + + final String [] hcafTable = { + "hcaf_d", + "hcaf_d_2015_LINEAR_01338580273835", + "hcaf_d_2018_LINEAR_11338580276548", + "hcaf_d_2021_LINEAR_21338580279237", + "hcaf_d_2024_LINEAR_31338580282780", + "hcaf_d_2027_LINEAR_41338580283400", + "hcaf_d_2030_LINEAR_51338580284030", + "hcaf_d_2033_LINEAR_61338580284663", + "hcaf_d_2036_LINEAR_71338580285205", + "hcaf_d_2039_LINEAR_81338580285958", + "hcaf_d_2042_LINEAR_91338580286545", + "hcaf_d_2050" + }; + + final String [] hcafTableNames = { + "test", + "test", + "test", + "test", + "test", + "test", + "test", + "test", + "test", + "test", + "test", + "test" + }; + + + final String [] hspecTables = { + "hspec2012_06_01_14_28_21_588", + "hspec2012_05_31_17_41_13_631" + }; + + final String [] hspecTableNames = { + "htest", + "htest", + }; + +// bioClimate.hcafEvolutionAnalysis(hcafTable, hcafTableNames); +// bioClimate.globalEvolutionAnalysis(hcafTable, hspecTables, hcafTableNames, hspecTableNames, "probability", "csquare", 0.01f); + bioClimate.globalEvolutionAnalysis(null, hspecTables, null, hspecTableNames, "probability", "csquare", 0.01f); + } + + + public static void main1(String args[]) throws Exception{ + + String dburl = "jdbc:postgresql://node49.p.d4science.research-infrastructures.eu/aquamaps"; + String dbUser = "gcube"; + String dbPassword = "bilico1980"; + + BioClimateAnalysis bioClimate=new BioClimateAnalysis("./cfg/","./",dburl, dbUser, dbPassword, true);