Gianpaolo Coro 2014-02-26 00:02:41 +00:00
parent e1a653c1fd
commit 57f150e546
6 changed files with 233 additions and 3 deletions

View File

@ -13,7 +13,9 @@ public class TestChunkization {
// String layertitle = "Objectively Analyzed Climatology in [07-01-01 01:00] (3D) {World Ocean Atlas 09: Sea Water Temperature - annual: dods://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/temperature_annual_1deg_ENVIRONMENT_OCEANS_.nc}"; // String layertitle = "Objectively Analyzed Climatology in [07-01-01 01:00] (3D) {World Ocean Atlas 09: Sea Water Temperature - annual: dods://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/temperature_annual_1deg_ENVIRONMENT_OCEANS_.nc}";
long t0 = System.currentTimeMillis(); long t0 = System.currentTimeMillis();
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile); AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
MatrixExtractor intersector = new MatrixExtractor(null, cfg); AlgorithmConfiguration config = new AlgorithmConfiguration();
config.setConfigPath(cfg);
MatrixExtractor intersector = new MatrixExtractor(config);
// intersector.takeTimeSlice(layertitle, 0, -180, 180, -10, 10, 0, 1, 1); // intersector.takeTimeSlice(layertitle, 0, -180, 180, -10, 10, 0, 1, 1);
// intersector.takeTimeSlice(layertitle, 0, -10, 10, -10, 10, 0,1, 1); // intersector.takeTimeSlice(layertitle, 0, -10, 10, -10, 10, 0,1, 1);
intersector.takeTimeInstantMatrix(layertitle, 0, -180, 180, -90, 90, 0, 0.5, 0.5); intersector.takeTimeInstantMatrix(layertitle, 0, -180, 180, -90, 90, 0, 0.5, 0.5);

View File

@ -14,7 +14,9 @@ public class TestChunkizationLayer {
String layertitle = "FAO AQUATIC SPECIES DISTRIBUTION MAP OF MEGALASPIS CORDYLA"; String layertitle = "FAO AQUATIC SPECIES DISTRIBUTION MAP OF MEGALASPIS CORDYLA";
long t0 = System.currentTimeMillis(); long t0 = System.currentTimeMillis();
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile); AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
MatrixExtractor intersector = new MatrixExtractor(null, cfg); AlgorithmConfiguration config = new AlgorithmConfiguration();
config.setConfigPath(cfg);
MatrixExtractor intersector = new MatrixExtractor(config);
// intersector.takeTimeSlice(layertitle, 0, -10, 10, -10, 10, 0,1, 1); // intersector.takeTimeSlice(layertitle, 0, -10, 10, -10, 10, 0,1, 1);
intersector.takeTimeInstantMatrix(layertitle, 0, -180, 180, -90, 90, 0, 0.5, 0.5); intersector.takeTimeInstantMatrix(layertitle, 0, -180, 180, -90, 90, 0, 0.5, 0.5);
System.out.println("ELAPSED TIME: "+(System.currentTimeMillis()-t0)); System.out.println("ELAPSED TIME: "+(System.currentTimeMillis()-t0));

View File

@ -0,0 +1,29 @@
package org.gcube.dataanalysis.geo.test;
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
import org.gcube.dataanalysis.geo.matrixmodel.MatrixExtractor;
public class TestPointslice {
static String cfg = "./cfg/";
public static void main(String[] args) throws Exception{
String layertitle = "Statistical Mean in [07-01-01 01:00] (3D) {World Ocean Atlas 09: Sea Water Temperature - annual: dods://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/temperature_annual_1deg_ENVIRONMENT_OCEANS_.nc}";
// String layertitle = "Mass Concentration of Chlorophyll in Sea Water in [03-30-13 01:00] (3D) {Mercator Ocean BIOMER1V1R1: Data extracted from dataset http://atoll-mercator.vlandata.cls.fr:44080/thredds/dodsC/global-analysis-bio-001-008-a}";
// String layertitle = "Objectively Analyzed Climatology in [07-01-01 01:00] (3D) {World Ocean Atlas 09: Sea Water Temperature - annual: dods://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/temperature_annual_1deg_ENVIRONMENT_OCEANS_.nc}";
// String layertitle = "be24800d-7583-4efa-b925-e0d8760e0fd3";
long t0 = System.currentTimeMillis();
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
AlgorithmConfiguration config = new AlgorithmConfiguration();
config.setGcubeScope("/gcube");
config.setConfigPath(cfg);
MatrixExtractor intersector = new MatrixExtractor(config);
// intersector.takeTimeSlice(layertitle, 0, -180, 180, -10, 10, 0, 1, 1);
// intersector.takeTimeSlice(layertitle, 0, -10, 10, -10, 10, 0,1, 1);
// intersector.takeTimeInstantMatrix(layertitle, 0, -180, 180, -90, 90, 0, 0.5, 0.5);
double output[][] = intersector.takeTimeInstantMatrix(layertitle, 0, 0,0,0,0, 0, 0.5, 0.5);
System.out.println("ELAPSED TIME: "+(System.currentTimeMillis()-t0));
System.out.println("Output: "+output[0][0]);
}
}

View File

@ -31,7 +31,7 @@ public class TestRasterTable {
config.setParam("DatabaseURL","jdbc:postgresql://localhost/testdb"); config.setParam("DatabaseURL","jdbc:postgresql://localhost/testdb");
config.setParam("DatabaseDriver","org.postgresql.Driver"); config.setParam("DatabaseDriver","org.postgresql.Driver");
MatrixExtractor intersector = new MatrixExtractor(null, cfg); MatrixExtractor intersector = new MatrixExtractor(config);
int t = 0; int t = 0;
double x1 = -180; double x1 = -180;
double x2 = 180; double x2 = 180;

View File

@ -0,0 +1,95 @@
package org.gcube.dataanalysis.geo.test;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
import org.gcube.dataanalysis.ecoengine.signals.PeriodicityDetector;
import org.gcube.dataanalysis.ecoengine.signals.SignalProcessing;
import org.gcube.dataanalysis.geo.matrixmodel.MatrixExtractor;
public class TestSignal {
static String cfg = "./cfg/";
public static void main(String[] args) throws Exception{
// String layertitle = "Statistical Mean in [07-01-01 01:00] (3D) {World Ocean Atlas 09: Sea Water Temperature - annual: dods://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/temperature_annual_1deg_ENVIRONMENT_OCEANS_.nc}";
// String layertitle = "Mass Concentration of Chlorophyll in Sea Water in [03-30-13 01:00] (3D) {Mercator Ocean BIOMER1V1R1: Data extracted from dataset http://atoll-mercator.vlandata.cls.fr:44080/thredds/dodsC/global-analysis-bio-001-008-a}";
// String layertitle = "Objectively Analyzed Climatology in [07-01-01 01:00] (3D) {World Ocean Atlas 09: Sea Water Temperature - annual: dods://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/temperature_annual_1deg_ENVIRONMENT_OCEANS_.nc}";
//temperature anomaly: long signal
//String layertitle = "be24800d-7583-4efa-b925-e0d8760e0fd3";
//temperature short periodic signal
// String layertitle = "dffa504b-dbc8-4553-896e-002549f8f5d3";
//ASC
String layertitle = "2c2304d1-681a-4f3a-8409-e8cdb5ed447f";
//WFS
// String layertitle = "0aac424b-5f5b-4fa6-97d6-4b4deee62b97";
//Chlorophyll
// String layertitle = "c565e32c-c5b3-4964-b44f-06dc620563e9";
long t0 = System.currentTimeMillis();
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
AlgorithmConfiguration config = new AlgorithmConfiguration();
config.setGcubeScope("/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab");
config.setConfigPath(cfg);
MatrixExtractor intersector = new MatrixExtractor(config);
// intersector.takeTimeSlice(layertitle, 0, -180, 180, -10, 10, 0, 1, 1);
// intersector.takeTimeSlice(layertitle, 0, -10, 10, -10, 10, 0,1, 1);
// intersector.takeTimeInstantMatrix(layertitle, 0, -180, 180, -90, 90, 0, 0.5, 0.5);
double signal[] = intersector.takeSignalInTime(layertitle, 7.5d, 42.5d,0d,0.5);
SignalProcessing.displaySignalWithGenericTime(signal, 0, 1, "signal");
System.out.println("ELAPSED TIME: "+(System.currentTimeMillis()-t0));
System.out.println("Signal: "+signal.length);
BufferedWriter bw = new BufferedWriter(new FileWriter(new File("signal.txt")));
for (double si: signal){
bw.write(si+",");
}
bw.close();
}
public static void main1(String[] args) throws Exception{
takeSignal();
}
public static void takeSignal() throws Exception{
BufferedReader br = new BufferedReader(new FileReader(new File("signal.txt")));
String line = br.readLine();
double[] signal = null;
while (line!=null){
String [] el = line.split(",");
signal=new double[el.length];
int i=0;
for (String e:el){
signal[i]=Double.parseDouble(e);
i++;
}
line = null;
}
br.close();
// SignalProcessing.displaySignalWithGenericTime(signal, 0, 1, "signal");
PeriodicityDetector pd = new PeriodicityDetector();
// signal = pd.produceNoisySignal(2000, 1, 0.1f, 0f);
//float freq=1;//signal.length;
// double F = pd.detectFrequency(signal, (int)freq, 0, freq, 1f,true);
double F = pd.detectFrequency(signal,true);
System.out.println("Detected Frequency:"+F+" indecision ["+pd.lowermeanF+" , "+pd.uppermeanF+"]");
System.out.println("Detected Period:"+pd.meanPeriod+" indecision ["+pd.lowermeanPeriod+" , "+pd.uppermeanPeriod+"]");
}
}

View File

@ -0,0 +1,102 @@
package org.gcube.dataanalysis.geo.test;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
import org.gcube.dataanalysis.ecoengine.signals.PeriodicityDetector;
import org.gcube.dataanalysis.ecoengine.signals.SignalProcessing;
import org.gcube.dataanalysis.geo.connectors.table.TableMatrixRepresentation;
import org.gcube.dataanalysis.geo.matrixmodel.MatrixExtractor;
public class TestSignalTable {
static String cfg = "./cfg/";
public static void main(String[] args) throws Exception{
AlgorithmConfiguration config = new AlgorithmConfiguration();
config.setConfigPath("./cfg/");
config.setPersistencePath("./");
config.setParam("DatabaseUserName", "utente");
config.setParam("DatabasePassword", "d4science");
config.setParam("DatabaseURL", "jdbc:postgresql://statistical-manager.d.d4science.research-infrastructures.eu/testdb");
config.setParam("DatabaseDriver", "org.postgresql.Driver");
// vessels
config.setParam(TableMatrixRepresentation.tableNameParameter, "generic_id037d302d_2ba0_4e43_b6e4_1a797bb91728");
config.setParam(TableMatrixRepresentation.xDimensionColumnParameter, "x");
config.setParam(TableMatrixRepresentation.yDimensionColumnParameter, "y");
// config.setParam(zDimensionColumnParameter,"");
config.setParam(TableMatrixRepresentation.timeDimensionColumnParameter, "datetime");
config.setParam(TableMatrixRepresentation.valueDimensionColumnParameter, "speed");
AnalysisLogger.setLogger(config.getConfigPath() + AlgorithmConfiguration.defaultLoggerFile);
config.setGcubeScope("/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab");
config.setConfigPath(cfg);
MatrixExtractor intersector = new MatrixExtractor(config);
long t0 = System.currentTimeMillis();
double signal[] = intersector.takeSignalInTime("table", -47.14, 44.52, 0d, 0.5);
// double signal[] = intersector.takeMatrixesInTime("table", -47.14, -47.14, 44.52, 44.52, 0d, 0.5, 0.5);
SignalProcessing.displaySignalWithGenericTime(signal, 0, 1, "signal");
System.out.println("ELAPSED TIME: "+(System.currentTimeMillis()-t0));
System.out.println("Signal: "+signal.length);
BufferedWriter bw = new BufferedWriter(new FileWriter(new File("signal.txt")));
for (double si: signal){
bw.write(si+",");
}
bw.close();
PeriodicityDetector pd = new PeriodicityDetector();
double F = pd.detectFrequency(signal,true);
System.out.println("Detected Frequency:"+F+" indecision ["+pd.lowermeanF+" , "+pd.uppermeanF+"]");
System.out.println("Detected Period:"+pd.meanPeriod+" indecision ["+pd.lowermeanPeriod+" , "+pd.uppermeanPeriod+"]");
}
public static void main1(String[] args) throws Exception{
takeSignal();
}
public static void takeSignal() throws Exception{
BufferedReader br = new BufferedReader(new FileReader(new File("signal.txt")));
String line = br.readLine();
double[] signal = null;
while (line!=null){
String [] el = line.split(",");
signal=new double[el.length];
int i=0;
for (String e:el){
signal[i]=Double.parseDouble(e);
i++;
}
line = null;
}
br.close();
// SignalProcessing.displaySignalWithGenericTime(signal, 0, 1, "signal");
PeriodicityDetector pd = new PeriodicityDetector();
// signal = pd.produceNoisySignal(2000, 1, 0.1f, 0f);
//float freq=1;//signal.length;
// double F = pd.detectFrequency(signal, (int)freq, 0, freq, 1f,true);
double F = pd.detectFrequency(signal,true);
System.out.println("Detected Frequency:"+F+" indecision ["+pd.lowermeanF+" , "+pd.uppermeanF+"]");
System.out.println("Detected Period:"+pd.meanPeriod+" indecision ["+pd.lowermeanPeriod+" , "+pd.uppermeanPeriod+"]");
}
}