Example #1
0
  /**
   * _more_
   *
   * @param g2d _more_
   * @param cenlat _more_
   * @param cenlon _more_
   * @param numx _more_
   * @param numy _more_
   * @return _more_
   */
  GridUtil.Grid2D spatialSubset(
      GridUtil.Grid2D g2d, float cenlat, float cenlon, int numx, int numy) {
    float[][] lats = g2d.getlats();
    float[][] lons = g2d.getlons();
    float[][][] values = g2d.getvalues();
    float[][] slats = new float[numx][numy];
    float[][] slons = new float[numx][numy];
    float[][][] svalues = new float[1][numx][numy];

    int ly = lats[0].length;
    int ly0 = ly / 2;
    int lx = lats.length;
    int lx0 = lx / 2;
    int ii = numx / 2, jj = numy / 2;

    for (int j = 0; j < ly - 1; j++) {
      if (Float.isNaN(lats[lx0][j])) continue;
      if ((lats[lx0][j] > cenlat) && (lats[lx0][j + 1] < cenlat)) {
        jj = j;
      }
    }
    for (int i = 0; i < lx - 1; i++) {
      if (Float.isNaN(lons[i][ly0])) continue;
      if ((lons[i][ly0] < cenlon) && (lons[i + 1][ly0] > cenlon)) {
        ii = i;
      }
    }
    int startx = ii - (numx / 2 - 1);
    int starty = jj - (numy / 2 - 1);
    if (startx < 0) startx = 0;
    if (starty < 0) starty = 0;

    for (int i = 0; i < numx; i++) {
      for (int j = 0; j < numy; j++) {
        slats[i][j] = lats[i + startx][j + starty];
        slons[i][j] = lons[i + startx][j + starty];
        svalues[0][i][j] = values[0][i + startx][j + starty];
      }
    }

    return new GridUtil.Grid2D(slats, slons, svalues);
  }
Example #2
0
  /**
   * _more_
   *
   * @param satgrid _more_
   * @param cenlat _more_
   * @param cenlon _more_
   * @param posm _more_
   * @param curdate _more_
   * @param cursat _more_
   * @param g_domain _more_
   * @return _more_
   */
  public StormAODTInfo.IRData aodtv72_drive(
      FlatField satgrid,
      float cenlat,
      float cenlon,
      int posm,
      double curdate,
      int cursat,
      String g_domain,
      int satId,
      int satChannel,
      boolean isTemperature) {

    float ftmps, flats, flons, cenlon2;

    int radius, irad, np, ii, jj, length;
    int idomain = 0;

    /*
     * Set miscoptions flags in AODT
     */

    int eyeSize = -99;
    oland_v72 = 0; /* allow AODT operation over land */
    osearch_v72 = false; /* search for maximum curved band position */
    rmwsizeman_v72 = eyeSize; /* eye size parameter */
    odtcurrent_v72IR = new StormAODTInfo.IRData();
    odtcurrent_v72IR.domain = idomain_v72;

    /*
     * Set initial classification flag and value in AODT
     */

    ostartstr_v72 = 0; /* user defined initial classification flag */
    osstr_v72 = 0.0f; /* starting initial classification value */

    /*
     * Set image date/time info in AODT
     */

    int iaodt = aodtv72_setIRimageinfo(curdate, cursat);

    /*
     * Get storm center lat/lon
     */
    if (lauto == true) {
      // aodtv72_runautomode( nauto, fauto, imagefile, &cenlat, &cenlon,
      // &posm );
    }

    /*
     * Set center location in AODT positioning method (1=interpolation,
     * 4=extrapolation, 0=error)
     */
    // posm = 1;
    aodtv72_setlocation(cenlat, cenlon, posm);

    /*
     * Set domain FLAG in AODT
     */

    if (g_domain.equalsIgnoreCase("AUTO")) {
      idomain = 0;
    }
    if (g_domain.equalsIgnoreCase("Atlantic")) {
      idomain = 1;
    }
    if (g_domain.equalsIgnoreCase("Pacific")) {
      idomain = 2;
    }
    if (g_domain.equalsIgnoreCase("Indian")) {
      idomain = 2;
    }

    iaodt = aodtv72_setdomain(idomain);

    /*
     * Retrieve temperatures from image. This to be done in IDV
     */

    GridUtil.Grid2D g2d = null;
    float[][] temps = null;
    float[][][] satimage = null;
    float[][] lons = null;
    float[][] lats = null;
    int numx = 123;
    int numy = 123;

    try {
      g2d = GridUtil.makeGrid2D(satgrid);
      lons = g2d.getlons();
      lats = g2d.getlats();

    } catch (Exception re) {
    }

    /* now spatial subset numx by numy */
    GridUtil.Grid2D g2d1 = spatialSubset(g2d, cenlat, cenlon, numx, numy);

    satimage = g2d1.getvalues();
    float[][] temp0 = satimage[0];
    int imsorc = satId, imtype = satChannel;

    if (isTemperature) temps = temp0;
    else temps = im_gvtota(numx, numy, temp0, imsorc, imtype);

    /*
     * Load the IR image information in AODT init areadata_v72
     */

    aodtv72_loadIRimage(temps, g2d1.getlats(), g2d1.getlons(), numx, numy);

    /*
     * Set eye and cloud temperature values in AODT, return position for IR
     * image data read
     */

    StormAODTInfo.IRData tvIR = aodtv72_seteyecloudtemp(StormAODTInfo.keyerM_v72, areadata_v72);

    odtcurrent_v72IR.warmt = tvIR.warmt;
    odtcurrent_v72IR.warmlatitude = tvIR.warmlatitude;
    odtcurrent_v72IR.warmlongitude = tvIR.warmlongitude;
    odtcurrent_v72IR.eyet = tvIR.eyet;
    odtcurrent_v72IR.cwcloudt = tvIR.cwcloudt;
    odtcurrent_v72IR.cwring = tvIR.cwring;

    /*
     * Determine scene type Set scene type
     */

    float[] oscen = StormAODTSceneType.aodtv72_calcscene(odtcurrent_v72IR, areadata_v72);

    odtcurrent_v72IR.cloudt = oscen[0];
    odtcurrent_v72IR.cloudt2 = oscen[1];
    odtcurrent_v72IR.eyestdv = oscen[2];
    odtcurrent_v72IR.cloudsymave = oscen[3];
    odtcurrent_v72IR.eyefft = (int) oscen[4];
    odtcurrent_v72IR.cloudfft = (int) oscen[5];
    // { alst, Aaveext, Estdveye, Aavesym, eyecnt, rngcnt};
    float[] oscen1 =
        StormAODTSceneType.aodtv72_classify(
            odtcurrent_v72IR, rmwsizeman_v72, areadata_v72, osstr_v72, osearch_v72);

    odtcurrent_v72IR.eyescene = (int) oscen1[0];
    odtcurrent_v72IR.cloudscene = (int) oscen1[1];
    odtcurrent_v72IR.eyesceneold = -1;
    odtcurrent_v72IR.cloudsceneold = -1;
    odtcurrent_v72IR.eyecdosize = oscen1[2];
    odtcurrent_v72IR.ringcb = (int) oscen1[3];
    odtcurrent_v72IR.ringcbval = (int) oscen1[4];
    odtcurrent_v72IR.ringcbvalmax = (int) oscen1[5];
    odtcurrent_v72IR.ringcblatmax = oscen1[6];
    odtcurrent_v72IR.ringcblonmax = oscen1[7];
    odtcurrent_v72IR.rmw = oscen1[8];

    /*
     * Determine intensity
     */

    iaodt = aodtv72_calcintensity(idomain);
    if (iaodt == 71) {
      throw new IllegalStateException("center location is over land");
    }

    /*
     * Print out all diagnostic messages to screen
     */
    return odtcurrent_v72IR;
  }