From 1c987391240b130f803c4ef38302947336c340cf Mon Sep 17 00:00:00 2001 From: Gianpaolo Coro Date: Tue, 4 Jun 2013 08:42:02 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@76712 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../geo/utils/ThreddsDataExplorer.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/gcube/dataanalysis/geo/utils/ThreddsDataExplorer.java b/src/main/java/org/gcube/dataanalysis/geo/utils/ThreddsDataExplorer.java index 42cec26..0300b28 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/utils/ThreddsDataExplorer.java +++ b/src/main/java/org/gcube/dataanalysis/geo/utils/ThreddsDataExplorer.java @@ -20,9 +20,6 @@ import org.xml.sax.InputSource; import ucar.ma2.Array; import ucar.ma2.ArrayFloat; -import ucar.ma2.Index; -import ucar.ma2.Index2D; -import ucar.ma2.Index3D; import ucar.ma2.Range; import ucar.ma2.StructureData; import ucar.ma2.StructureMembers.Member; @@ -120,8 +117,11 @@ public class ThreddsDataExplorer { CoordinateAxis zAxis = gdt.getCoordinateSystem().getVerticalAxis(); CoordinateAxis xAxis = gdt.getCoordinateSystem().getXHorizAxis(); CoordinateAxis yAxis = gdt.getCoordinateSystem().getYHorizAxis(); - - double resolutionZ = Math.abs((double) (zAxis.getMaxValue() - zAxis.getMinValue()) / (double) zAxis.getShape()[0]); + double resolutionZ = 0; + try{ + resolutionZ = Math.abs((double) (zAxis.getMaxValue() - zAxis.getMinValue()) / (double) zAxis.getShape()[0]); + AnalysisLogger.getLogger().debug("Zmin:"+ zAxis.getMinValue()+" Zmax:"+zAxis.getMaxValue()); + }catch(Exception e){}; double resolutionX = Math.abs((double) (xAxis.getMaxValue() - xAxis.getMinValue()) / (double) xAxis.getShape()[0]); double resolutionY = Math.abs((double) (yAxis.getMaxValue() - yAxis.getMinValue()) / (double) yAxis.getShape()[0]); @@ -142,6 +142,12 @@ public class ThreddsDataExplorer { xD=shapeD[2]; } + else if (shapeD.length>1) + { + yD=shapeD[0]; + xD=shapeD[1]; + } + AnalysisLogger.getLogger().debug("Shape: Z:"+zD+" X:"+ xD+" Y:"+yD); AnalysisLogger.getLogger().debug("Layer Information Retrieval ELAPSED Time: " + (System.currentTimeMillis() - t01)); @@ -153,7 +159,7 @@ public class ThreddsDataExplorer { data3 = (ArrayFloat.D3) data; else data2 = (ArrayFloat.D2) data; - AnalysisLogger.getLogger().debug("Z dimension: "+zD+" Zmin:"+ zAxis.getMinValue()+" Zmax:"+zAxis.getMaxValue()); + double xmin = xAxis.getMinValue(); double xmax = xAxis.getMaxValue(); @@ -205,6 +211,7 @@ public class ThreddsDataExplorer { val = Double.valueOf(data3.get(zint, yint, xint)); }else if (data2 != null) val = Double.valueOf(data2.get(yint, xint)); + values.add(val); } break;