diff --git a/src/main/java/org/gcube/dataanalysis/geo/retrieval/GeoIntersector.java b/src/main/java/org/gcube/dataanalysis/geo/retrieval/GeoIntersector.java index 36bfb8c..927fc03 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/retrieval/GeoIntersector.java +++ b/src/main/java/org/gcube/dataanalysis/geo/retrieval/GeoIntersector.java @@ -230,6 +230,12 @@ public class GeoIntersector { public double[][] takeTimeSlice(String layerTitle, int timeInstant, double x1, double x2, double y1, double y2, double z, double xResolution, double yResolution) throws Exception { AnalysisLogger.getLogger().debug("Bounding box: (" + x1 + "," + x2 + ";" + y1 + "," + y2 + ")"); + boolean faolayer = false; + if (layerTitle.toLowerCase().contains("fao aquatic species distribution map") ) + { + AnalysisLogger.getLogger().debug("FAO DISTRIBUTION LAYER ... TO APPY PATCH!"); + faolayer=true; + } if ((x2 < x1) || (y2 < y1)) { AnalysisLogger.getLogger().debug("ERROR: BAD BOUNDING BOX!!!"); return new double[0][0]; @@ -268,7 +274,14 @@ public class GeoIntersector { //if there is value, then set it, otherwise set NaN //the layer is undefined in that point and a value must be generated //assign a value to the matrix - slice[k][g] = value; + + //WARNING: PATCH FOR FAO LAYERS:. Probability can be equal to 2 for uncertainty (Kolmogorov, forgive them for they know not what they do) + if (faolayer && (value>1)){ + AnalysisLogger.getLogger().debug("APPLYING FAO PATCH!"); + slice[k][g] = 0.5; + } + else + slice[k][g] = value; //increase the x step according to the matrix if (g == xsteps) { g = 0; @@ -277,13 +290,15 @@ public class GeoIntersector { else g++; } + + /* AnalysisLogger.getLogger().debug("Applying nearest Neighbor to all the rows"); //apply nearest neighbor to each row AlgorithmConfiguration config = new AlgorithmConfiguration(); config.setConfigPath(configDir); boolean rapidinit = false; - /* + for (int i=0;i