Gianpaolo Coro 2013-06-04 17:04:57 +00:00
parent fbcfa7efe6
commit 900e8ba880
1 changed files with 56 additions and 12 deletions

View File

@ -19,7 +19,10 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import ucar.ma2.Array;
import ucar.ma2.ArrayDouble;
import ucar.ma2.ArrayFloat;
import ucar.ma2.ArrayInt;
import ucar.ma2.ArrayLong;
import ucar.ma2.Range;
import ucar.ma2.StructureData;
import ucar.ma2.StructureMembers.Member;
@ -153,12 +156,42 @@ public class ThreddsDataExplorer {
AnalysisLogger.getLogger().debug("Layer Information Retrieval ELAPSED Time: " + (System.currentTimeMillis() - t01));
int rank = data.getRank();
AnalysisLogger.getLogger().debug("Rank of the layer: " + rank);
ArrayFloat.D3 data3 = null;
ArrayFloat.D2 data2 = null;
if (data.getRank() == 3)
data3 = (ArrayFloat.D3) data;
else
data2 = (ArrayFloat.D2) data;
ArrayFloat.D3 data3Float = null;
ArrayDouble.D3 data3Double = null;
ArrayInt.D3 data3Int = null;
ArrayLong.D3 data3Long = null;
ArrayFloat.D2 data2Float = null;
ArrayDouble.D2 data2Double= null;
ArrayInt.D2 data2Int = null;
ArrayLong.D2 data2Long = null;
if (data.getRank() == 3){
if (data instanceof ArrayFloat.D3)
data3Float = (ArrayFloat.D3) data;
else if (data instanceof ArrayInt.D3)
data3Int = (ArrayInt.D3) data;
else if (data instanceof ArrayDouble.D3)
data3Double = (ArrayDouble.D3) data;
else if (data instanceof ArrayDouble.D3)
data3Double = (ArrayDouble.D3) data;
else if (data instanceof ArrayLong.D3)
data3Long = (ArrayLong.D3) data;
else
throw new Exception("Layer data format not supported");
}
else{
if (data instanceof ArrayFloat.D2)
data2Float = (ArrayFloat.D2) data;
else if (data instanceof ArrayInt.D2)
data2Int = (ArrayInt.D2) data;
else if (data instanceof ArrayDouble.D2)
data2Double = (ArrayDouble.D2) data;
else if (data instanceof ArrayLong.D2)
data2Long = (ArrayLong.D2) data;
else
throw new Exception("Layer data format not supported");
}
double xmin = xAxis.getMinValue();
@ -205,12 +238,23 @@ public class ThreddsDataExplorer {
yint = yD-1;
if (zint>zD-1)
zint = zD-1;
if (data3 != null){
// System.out.println(val+" - "+zint+" "+yint+" "+xint +" --- "+xy[1]+" "+xy[0]);
// System.out.println(val+" - "+zint+" "+yint+" "+xint+" "+x+" "+y);
val = Double.valueOf(data3.get(zint, yint, xint));
}else if (data2 != null)
val = Double.valueOf(data2.get(yint, xint));
if (data3Float != null)
val = Double.valueOf(data3Float.get(zint, yint, xint));
else if (data3Int != null)
val = Double.valueOf(data3Int.get(zint, yint, xint));
else if (data3Double != null)
val = Double.valueOf(data3Double.get(zint, yint, xint));
else if (data3Long != null)
val = Double.valueOf(data3Long.get(zint, yint, xint));
else if (data2Float != null)
val = Double.valueOf(data2Float.get(yint, xint));
else if (data2Int != null)
val = Double.valueOf(data2Int.get(yint, xint));
else if (data2Double != null)
val = Double.valueOf(data2Double.get(yint, xint));
else if (data2Long != null)
val = Double.valueOf(data2Long.get(yint, xint));
values.add(val);
}