git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@74465 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
984e50ff71
commit
8e99d096c2
|
@ -9,9 +9,14 @@ public class TestChunkization {
|
|||
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}";
|
||||
long t0 = System.currentTimeMillis();
|
||||
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
|
||||
GeoIntersector intersector = new GeoIntersector(null, cfg);
|
||||
intersector.takeLastTimeChunk(layertitle, -180, 180, -10, 10, 0, 0.1, 0.1);
|
||||
|
||||
// intersector.takeLastTimeChunk(layertitle, -180, 180, -10, 10, 0, 1, 1);
|
||||
intersector.takeLastTimeChunk(layertitle, -10, 10, -10, 10, 0,1, 1);
|
||||
// intersector.takeLastTimeChunk(layertitle, -180, 180, -90, 90, 0, 1, 1);
|
||||
System.out.println("ELAPSED TIME: "+(System.currentTimeMillis()-t0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
package org.gcube.dataanalysis.geo.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.contentmanagement.graphtools.utils.MathFunctions;
|
||||
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
|
||||
import org.gcube.dataanalysis.ecoengine.utils.Tuple;
|
||||
import org.gcube.dataanalysis.geo.retrieval.GeoIntersector;
|
||||
|
||||
public class TestIntersectionNetCDF {
|
||||
|
||||
static String cfg = "./cfg/";
|
||||
|
||||
public static void main1(String args[] ) throws Exception{
|
||||
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
|
||||
GeoIntersector inters = new GeoIntersector("/gcube/devsec",cfg);
|
||||
|
||||
System.out.println(inters.getFeaturesInTime("temperature (04091217ruc.nc)", 0.1, 0.1));
|
||||
}
|
||||
|
||||
public static void main2(String args[]) throws Exception {
|
||||
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
|
||||
GeoIntersector inters = new GeoIntersector(null,cfg);
|
||||
System.out.println(inters.getFeaturesInTime("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}", -70, 0.1, 3000));
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
|
||||
GeoIntersector inters = new GeoIntersector(null,cfg);
|
||||
|
||||
// List<Tuple<Double>> tuples = (List<Tuple<Double>>)Arrays.asList(
|
||||
// new Tuple<Double>(0.1,0.1),
|
||||
// new Tuple<Double>(10d,0.1),
|
||||
// new Tuple<Double>(100d,0.1),
|
||||
// new Tuple<Double>(180d,0.1),
|
||||
// new Tuple<Double>(270d,0.1)
|
||||
// );
|
||||
List<Tuple<Double>> tuples = new ArrayList<Tuple<Double>>();
|
||||
double start = -180d;
|
||||
double end = 360d;
|
||||
int steps = 30;
|
||||
double step = (end-start)/steps;
|
||||
double y = 0;
|
||||
for (int i=0;i<steps+1;i++){
|
||||
double x = (i*step)+start;
|
||||
if (i==steps)
|
||||
x = end;
|
||||
tuples.add(new Tuple<Double>(x,y));
|
||||
|
||||
}
|
||||
|
||||
List<LinkedHashMap<String, Double>> time = inters.getFeaturesInTime("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}",tuples );
|
||||
int i=0;
|
||||
for (LinkedHashMap<String, Double> timemap : time){
|
||||
for (Double val:timemap.values())
|
||||
{
|
||||
System.out.println(tuples.get(i).getElements().get(0)+"="+MathFunctions.roundDecimal(val,2));
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package org.gcube.dataanalysis.geo.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.contentmanagement.graphtools.utils.MathFunctions;
|
||||
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
|
||||
import org.gcube.dataanalysis.geo.meta.features.FeaturesManager;
|
||||
import org.gcube.dataanalysis.geo.retrieval.GeoIntersector;
|
||||
import org.geotoolkit.metadata.iso.identification.DefaultDataIdentification;
|
||||
import org.opengis.metadata.Metadata;
|
||||
import org.opengis.metadata.identification.Identification;
|
||||
import org.opengis.metadata.identification.Keywords;
|
||||
import org.opengis.util.InternationalString;
|
||||
|
||||
public class TestLayersRetrieval {
|
||||
|
||||
static String cfg = "./cfg/";
|
||||
//TODO: filter WoA names and attach them to the title
|
||||
public static void main(String[] args) throws Exception{
|
||||
long t0 = System.currentTimeMillis();
|
||||
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
|
||||
FeaturesManager featurer = new FeaturesManager();
|
||||
featurer.setScope(null);
|
||||
List<Metadata> metae = featurer.getAllGNInfobyText("thredds", "1");
|
||||
System.out.println("ELAPSED TIME: "+(System.currentTimeMillis()-t0));
|
||||
String d = "#";
|
||||
System.out.println("Parameter Name"+d+"Time Range"+d+"Dimensions"+d+"Unit of Measure"+d+"Resolution (decimal degrees)"+d+"Details");
|
||||
List<String> table = new ArrayList<String>();
|
||||
for (Metadata meta:metae){
|
||||
Identification id = meta.getIdentificationInfo().iterator().next();
|
||||
String title = id.getCitation().getTitle().toString();
|
||||
|
||||
DefaultDataIdentification did = (DefaultDataIdentification) id;
|
||||
double resolution = MathFunctions.roundDecimal(did.getSpatialResolutions().iterator().next().getDistance(),3);
|
||||
Collection<? extends Keywords> keys = id.getDescriptiveKeywords();
|
||||
String unit = "";
|
||||
for (Keywords key:keys){
|
||||
for(InternationalString string:key.getKeywords()) {
|
||||
String ss = string.toString();
|
||||
if (ss.startsWith("unit:"))
|
||||
unit = ss.substring(ss.indexOf(":")+1);
|
||||
}
|
||||
}
|
||||
String[] elements = parseTitle(title);
|
||||
String entry = elements[0]+d+elements[1]+d+elements[2]+d+unit+d+resolution+d+elements[3];
|
||||
if (!table.contains(entry)){
|
||||
table.add(entry);
|
||||
// System.out.println(elements[0]+d+elements[1]+d+elements[2]+d+resolution+d+elements[3]);
|
||||
}
|
||||
}
|
||||
Collections.sort(table);
|
||||
for (String element:table){
|
||||
System.out.println(element);
|
||||
}
|
||||
// System.out.println("ELAPSED TIME: "+(System.currentTimeMillis()-t0));
|
||||
}
|
||||
|
||||
|
||||
public static void main1(String[] args) throws Exception{
|
||||
// String example = "Standard Deviation from 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 example = "Salinity from [12-15-99 01:00] to [12-15-09 01:00] (2D) {Native grid ORCA025.L75 monthly average: Data extracted from dataset http://atoll-mercator.vlandata.cls.fr:44080/thredds/dodsC/global-reanalysis-phys-001-004-b-ref-fr-mjm95-grids}";
|
||||
String example = "Salinity from [12-15-99 01:00] to [12-15-09 01:00] (2D) {Native grid ORCA025.L75 monthly average: Data extracted from dataset http://atoll-mercator.vlandata.cls.fr:44080/thredds/dodsC/global-reanalysis-phys-001-004-b-ref-fr-mjm95-grids}";
|
||||
parseTitle(example);
|
||||
}
|
||||
|
||||
public static String[] parseTitle(String title){
|
||||
String timerange = title.substring(title.indexOf("["),title.lastIndexOf("]")+1);
|
||||
// timerange = timerange.replace("] to [", " ; ");
|
||||
// System.out.println(timerange);
|
||||
String realtitle = title.substring(0,title.indexOf("[")).trim();
|
||||
realtitle = realtitle.substring(0,realtitle.lastIndexOf(" ")).trim();
|
||||
// System.out.println(realtitle);
|
||||
String dimensions = title.substring(title.indexOf("] (")+3);
|
||||
dimensions = dimensions.substring(0,dimensions.indexOf(")")).trim();
|
||||
// System.out.println(dimensions);
|
||||
String notes = title.substring(title.indexOf("{")+1,title.lastIndexOf("}"));
|
||||
String woa = "World Ocean Atlas 09:";
|
||||
String prefixnote = "";
|
||||
if (notes.startsWith(woa)){
|
||||
prefixnote = notes.substring(woa.length()+1);
|
||||
prefixnote = prefixnote.substring(0,prefixnote.indexOf(":")).trim()+": ";
|
||||
}
|
||||
// System.out.println(notes);
|
||||
String[] elements = new String[]{prefixnote+realtitle, timerange, dimensions,notes};
|
||||
return elements;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue