Ejemplo n.º 1
0
 /**
  * Projects the arrays of longitudes and latitudes to a Cylindrical Equidistant Projection to
  * bring x,y and z into a uniform coordinate system (meters).
  *
  * @param lons
  * @param lats
  * @return
  */
 private Array[] prj2meters(Array lons, Array lats) {
   Array[] out = new Array[2];
   assert Arrays.equals(lats.getShape(), lons.getShape());
   Index ltidx = Index.factory(lats.getShape());
   Index lnidx = Index.factory(lons.getShape());
   Array lats_prj = Array.factory(java.lang.Double.class, lats.getShape());
   Array lons_prj = Array.factory(java.lang.Double.class, lons.getShape());
   for (int i = 0; i < lats.getSize(); i++) {
     for (int j = 0; j < lons.getSize(); j++) {
       float lon_dd = lons.getFloat(lnidx.set(j));
       float lat_dd = lats.getFloat(ltidx.set(i));
       double[] prj = MatrixUtilities.lonlat2ceqd(new double[] {lon_dd, lat_dd});
       lons_prj.setDouble(lnidx.set(j), prj[0]);
       lats_prj.setDouble(ltidx.set(i), prj[1]);
     }
   }
   out[0] = lons_prj;
   out[1] = lats_prj;
   return out;
 }
Ejemplo n.º 2
0
 /**
  * Calculates change in the y direction
  *
  * @param arr - a 3x3 array of numbers
  * @return
  */
 private float dy(Array arr) {
   Index idx = Index.factory(arr.getShape());
   float e = arr.getFloat(idx.set(1, 1));
   if (Float.isNaN(e)) {
     return Float.NaN;
   }
   float a = arr.getFloat(idx.set(0, 0));
   float b = arr.getFloat(idx.set(0, 1));
   float c = arr.getFloat(idx.set(0, 2));
   float g = arr.getFloat(idx.set(2, 0));
   float h = arr.getFloat(idx.set(2, 1));
   float i = arr.getFloat(idx.set(2, 2));
   a = Float.isNaN(a) ? 0 : a;
   b = Float.isNaN(b) ? 0 : b;
   c = Float.isNaN(c) ? 0 : c;
   g = Float.isNaN(g) ? 0 : g;
   h = Float.isNaN(h) ? 0 : h;
   i = Float.isNaN(i) ? 0 : i;
   return ((g + 2 * h + i) - (a + 2 * b + c)) / 8;
 }
Ejemplo n.º 3
0
 /**
  * Calculates change in the x direction
  *
  * @param arr - a 3x3 array of numbers
  * @return
  */
 private float dx(Array arr) {
   Index idx = Index.factory(arr.getShape());
   float e = arr.getFloat(idx.set(1, 1));
   if (Float.isNaN(e)) {
     return Float.NaN;
   }
   float a = arr.getFloat(idx.set(0, 0));
   float c = arr.getFloat(idx.set(0, 2));
   float d = arr.getFloat(idx.set(1, 0));
   float f = arr.getFloat(idx.set(1, 2));
   float g = arr.getFloat(idx.set(2, 0));
   float i = arr.getFloat(idx.set(2, 2));
   a = Float.isNaN(a) ? 0 : a;
   c = Float.isNaN(c) ? 0 : c;
   d = Float.isNaN(d) ? 0 : d;
   f = Float.isNaN(f) ? 0 : f;
   g = Float.isNaN(g) ? 0 : g;
   i = Float.isNaN(i) ? 0 : i;
   return ((c + 2 * f + i) - (a + 2 * d + g)) / 8;
 }