From 0ec883c9204ed70a658b118a29175699eeff2689 Mon Sep 17 00:00:00 2001 From: Gianpaolo Coro Date: Wed, 7 Jan 2015 11:59:26 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@102187 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../geo/insertion/ThreddsFetcher.java | 2 +- .../geo/test/infra/RetrieveOGCLinks.java | 87 +++++++++++++++++++ .../geo/test/maps/TestMapsComparison.java | 8 +- .../maps/TestMapsComparisonArchiteuthis.java | 39 +++++++++ .../TestXYExtractionConnectors.java | 4 +- 5 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 src/main/java/org/gcube/dataanalysis/geo/test/infra/RetrieveOGCLinks.java create mode 100644 src/main/java/org/gcube/dataanalysis/geo/test/maps/TestMapsComparisonArchiteuthis.java diff --git a/src/main/java/org/gcube/dataanalysis/geo/insertion/ThreddsFetcher.java b/src/main/java/org/gcube/dataanalysis/geo/insertion/ThreddsFetcher.java index b9dadcc..b3b8118 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/insertion/ThreddsFetcher.java +++ b/src/main/java/org/gcube/dataanalysis/geo/insertion/ThreddsFetcher.java @@ -35,7 +35,7 @@ public class ThreddsFetcher { for (String filename : filesURL) { if (!filename.endsWith(".nc")) continue; -// if (!filename.equalsIgnoreCase("geo_filt_070620-070725-sim_HDR_4rlks_CLIMATOLOGY_METEOROLOGY_ATMOSPHERE_.nc")) +// if (!filename.equalsIgnoreCase("bathymetrycf2_CLIMATOLOGY_METEOROLOGY_ATMOSPHERE_.nc")) // continue; String url = OGCFormatter.getOpenDapURL(threddsCatalogURL, filename); diff --git a/src/main/java/org/gcube/dataanalysis/geo/test/infra/RetrieveOGCLinks.java b/src/main/java/org/gcube/dataanalysis/geo/test/infra/RetrieveOGCLinks.java new file mode 100644 index 0000000..21e9581 --- /dev/null +++ b/src/main/java/org/gcube/dataanalysis/geo/test/infra/RetrieveOGCLinks.java @@ -0,0 +1,87 @@ +package org.gcube.dataanalysis.geo.test.infra; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.util.List; + +import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger; +import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration; +import org.gcube.dataanalysis.geo.infrastructure.GeoNetworkInspector; +import org.gcube.dataanalysis.geo.matrixmodel.MatrixExtractor; +import org.opengis.metadata.Metadata; + +public class RetrieveOGCLinks { + + static String scope = "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab"; + + public static void main(String[] args) throws Exception{ + AlgorithmConfiguration config = new AlgorithmConfiguration(); + AnalysisLogger.setLogger("./cfg/ALog.properties"); + config.setConfigPath("./cfg/"); + config.setPersistencePath("./"); + config.setParam("DatabaseUserName", "gcube"); + config.setParam("DatabasePassword", "d4science2"); + config.setParam("DatabaseURL", "jdbc:postgresql://localhost/testdb"); + config.setParam("DatabaseDriver", "org.postgresql.Driver"); + config.setGcubeScope("/gcube/devsec/devVRE"); + + MatrixExtractor extractor = new MatrixExtractor(config); + extractor.getConnector("http://geoserver.d4science-ii.research-infrastructures.eu/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=lluidiamaculata20121218223748535cet&format=json&maxfeatures=1", 0.5); + + } + + public static void main1(String[] args) throws Exception{ + AnalysisLogger.setLogger("./cfg/ALog.properties"); + GeoNetworkInspector gnInspector = new GeoNetworkInspector(); + gnInspector.setScope(scope); + BufferedReader br = new BufferedReader(new FileReader(new File("AquamapsSpecies.txt"))); + String line = br.readLine(); + BufferedWriter bw = new BufferedWriter(new FileWriter(new File("AquamapsSpeciesLinks.csv"))); + + System.out.println("speciesname,WMS,WFS,algorithm,abstract"); + bw.write("speciesname,WMS,WFS,algorithm,abstract\n"); + while (line!=null){ + String speciesname = line; + + List metadts = gnInspector.getAllGNInfobyTitle(speciesname, "1"); + + for (Metadata meta:metadts){ + String abstractS = ""+meta.getIdentificationInfo().iterator().next().getAbstract(); + String WFS = gnInspector.getWFSLink(meta); + String WMS = gnInspector.getWFSLink(meta); + String algoritm = "OTHER"; + + if (abstractS.contains("AquaMaps NativeRange2050 algorithm")){ + algoritm = "NATIVE 2050"; + } + else if (abstractS.contains("AquaMaps SuitableRange algorithm")){ + algoritm = "SUITABLE"; + } + else if (abstractS.contains("AquaMaps SuitableRange2050 algorithm")){ + algoritm = "SUITABLE 2050"; + } + else if (abstractS.contains("AquaMaps NativeRange algorithm")){ + algoritm = "NATIVE"; + } + + String outstring = speciesname+",\""+WMS+"\",\""+WFS+"\","+algoritm+",\""+abstractS.replace("\"", "")+"\""; +// System.out.println(abstractS); + System.out.println(outstring); + bw.write(outstring+"\n"); + //System.out.println("WFS = "+gnInspector.getWFSLink(meta)); + //System.out.println("ABSTRACT = "+meta.getIdentificationInfo().iterator().next().getAbstract()); + + } + + line = br.readLine(); + } + + bw.close(); + br.close(); + } + + +} diff --git a/src/main/java/org/gcube/dataanalysis/geo/test/maps/TestMapsComparison.java b/src/main/java/org/gcube/dataanalysis/geo/test/maps/TestMapsComparison.java index 03f85fc..58e9550 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/test/maps/TestMapsComparison.java +++ b/src/main/java/org/gcube/dataanalysis/geo/test/maps/TestMapsComparison.java @@ -32,9 +32,13 @@ public class TestMapsComparison { //String layertitle = "Sarda orientalis"; //String layertitle2 = "FAO aquatic species distribution map of Sarda chiliensis"; - String layertitle2 = "4e5c1bbf-f5ce-4b66-a67c-14d7d9920aa0"; - String layertitle = "38b2eb74-1c07-4569-8a81-36ac2f973146"; +// String layertitle2 = "4e5c1bbf-f5ce-4b66-a67c-14d7d9920aa0"; +// String layertitle = "38b2eb74-1c07-4569-8a81-36ac2f973146"; + + String layertitle = "http://geoserver.d4science-ii.research-infrastructures.eu/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=lluidiamaculata20121218223748535cet&format=json&maxfeatures=1"; + String layertitle2 = "http://geoserver.d4science-ii.research-infrastructures.eu/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=lluidiamaculata20121218223748535cet&format=json&maxfeatures=1"; + AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile); AlgorithmConfiguration config = new AlgorithmConfiguration(); config.setConfigPath(cfg); diff --git a/src/main/java/org/gcube/dataanalysis/geo/test/maps/TestMapsComparisonArchiteuthis.java b/src/main/java/org/gcube/dataanalysis/geo/test/maps/TestMapsComparisonArchiteuthis.java new file mode 100644 index 0000000..88ff7d7 --- /dev/null +++ b/src/main/java/org/gcube/dataanalysis/geo/test/maps/TestMapsComparisonArchiteuthis.java @@ -0,0 +1,39 @@ +package org.gcube.dataanalysis.geo.test.maps; + +import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger; +import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration; +import org.gcube.dataanalysis.geo.algorithms.MapsComparator; +import org.gcube.dataanalysis.geo.matrixmodel.MatrixExtractor; +import org.gcube.dataanalysis.geo.matrixmodel.RasterTable; + +public class TestMapsComparisonArchiteuthis { + + static String cfg = "./cfg/"; + public static void main(String[] args) throws Exception{ + String layertitle = "96575f38-583c-4b6c-926f-e804156c7baa"; + String layertitle2 = "f9a831c0-143f-4792-a5d9-896d72db73f6"; + + AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile); + 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.org/testdb"); + config.setParam("DatabaseDriver","org.postgresql.Driver"); + config.setParam("Layer_1",layertitle); + config.setParam("Layer_2",layertitle2); + config.setParam("ValuesComparisonThreshold","0.5"); + config.setParam("KThreshold","0.5"); + + config.setParam("Z","0"); + config.setGcubeScope("/gcube/devsec/devVRE"); + + + MapsComparator mc = new MapsComparator(); + mc.setConfiguration(config); + mc.init(); + mc.compute(); + mc.getOutput(); + } +} diff --git a/src/main/java/org/gcube/dataanalysis/geo/test/projections/TestXYExtractionConnectors.java b/src/main/java/org/gcube/dataanalysis/geo/test/projections/TestXYExtractionConnectors.java index 9ebfa1f..0c9dfef 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/test/projections/TestXYExtractionConnectors.java +++ b/src/main/java/org/gcube/dataanalysis/geo/test/projections/TestXYExtractionConnectors.java @@ -55,7 +55,9 @@ public class TestXYExtractionConnectors { static String[] urlToTest_ = { "https://dl.dropboxusercontent.com/u/12809149/layer1.asc", "http://thredds.research-infrastructures.eu/thredds/fileServer/public/netcdf/ph.asc", "http://thredds.research-infrastructures.eu/thredds/fileServer/public/netcdf/calcite.asc", "https://dl.dropboxusercontent.com/u/12809149/wind1.tif", - "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/WOA2005TemperatureAnnual_CLIMATOLOGY_METEOROLOGY_ATMOSPHERE_.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/salinity_annual_1deg_ENVIRONMENT_OCEANS_.nc", "http://thredds.d4science.org/thredds/fileServer/public/netcdf/global-reanalysis-phys-001-004-b-ref-fr-mjm95-icemod_ENVIRONMENT_OCEANS_CLIMATOLOGY_METEOROLOGY_ATMOSPHERE_1366211441189.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/CERSAT-GLO-CLIM_WIND_L4-OBS_FULL_TIME_SERIE_CLIMATOLOGY_METEOROLOGY_ATMOSPHERE_1366217956317.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/phosphate_seasonal_5deg_ENVIRONMENT_BIOTA_.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/global-analysis-bio-001-008-_a_BIOTA_ENVIRONMENT_1366217546908.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/dissolved_oxygen_annual_1deg_ENVIRONMENT_BIOTA_.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/global-reanalysis-phys-001-004-b-ref-fr-mjm95-gridv_OCEANS_CLIMATOLOGY_METEOROLOGY_ATMOSPHERE_1366211498692.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/nitrate_seasonal_5deg_ENVIRONMENT_BIOTA_.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/global-analysis-bio-001-008-a_BIOTA_ENVIRONMENT_1366217608283.nc", "http://thredds.research-infrastructures.eu/thredds/fileServer/public/netcdf/cloudmean.asc", "http://geoserver-dev.d4science-ii.research-infrastructures.eu/geoserver/wcs/wcs?service=wcs&version=1.0.0&request=GetCoverage&coverage=aquamaps:WorldClimBio2&CRS=EPSG:4326&bbox=-180,0,180,90&width=1&height=1&format=geotiff&RESPONSE_CRS=EPSG:4326", "http://geoserver2.d4science.research-infrastructures.eu/geoserver" + "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/WOA2005TemperatureAnnual_CLIMATOLOGY_METEOROLOGY_ATMOSPHERE_.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/salinity_annual_1deg_ENVIRONMENT_OCEANS_.nc", "http://thredds.d4science.org/thredds/fileServer/public/netcdf/global-reanalysis-phys-001-004-b-ref-fr-mjm95-icemod_ENVIRONMENT_OCEANS_CLIMATOLOGY_METEOROLOGY_ATMOSPHERE_1366211441189.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/CERSAT-GLO-CLIM_WIND_L4-OBS_FULL_TIME_SERIE_CLIMATOLOGY_METEOROLOGY_ATMOSPHERE_1366217956317.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/phosphate_seasonal_5deg_ENVIRONMENT_BIOTA_.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/global-analysis-bio-001-008-_a_BIOTA_ENVIRONMENT_1366217546908.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/dissolved_oxygen_annual_1deg_ENVIRONMENT_BIOTA_.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/global-reanalysis-phys-001-004-b-ref-fr-mjm95-gridv_OCEANS_CLIMATOLOGY_METEOROLOGY_ATMOSPHERE_1366211498692.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/nitrate_seasonal_5deg_ENVIRONMENT_BIOTA_.nc", "http://thredds.research-infrastructures.eu/thredds/dodsC/public/netcdf/global-analysis-bio-001-008-a_BIOTA_ENVIRONMENT_1366217608283.nc", "http://thredds.research-infrastructures.eu/thredds/fileServer/public/netcdf/cloudmean.asc", + "http://geoserver-dev.d4science-ii.research-infrastructures.eu/geoserver/wcs/wcs?service=wcs&version=1.0.0&request=GetCoverage&coverage=aquamaps:WorldClimBio2&CRS=EPSG:4326&bbox=-180,0,180,90&width=1&height=1&format=geotiff&RESPONSE_CRS=EPSG:4326", + "http://geoserver2.d4science.research-infrastructures.eu/geoserver" };