patch for FAO layers

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@76767 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Gianpaolo Coro 2013-06-04 17:04:47 +00:00
parent a5be56b9bd
commit fbcfa7efe6
1 changed files with 17 additions and 2 deletions

View File

@ -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<slice.length;i++){
// AnalysisLogger.getLogger().debug("Checking for unfilled values");
boolean tofill = false;