Esempio n. 1
0
  /**
   * Get a set of sounding obs based on the choice
   *
   * @param dataChoice DataChoice for data
   * @param subset subselection criteria
   * @return corresponding sounding observations
   * @throws RemoteException Java RMI problem
   * @throws VisADException VisAD problem
   */
  private Data getSoundingObs(DataChoice dataChoice, DataSelection subset)
      throws VisADException, RemoteException {
    Vector v = new Vector();
    List choices =
        (dataChoice instanceof CompositeDataChoice)
            ? ((CompositeDataChoice) dataChoice).getDataChoices()
            : Arrays.asList(new DataChoice[] {dataChoice});

    Object t = subset.getProperty(DataSelection.PROP_USESTIMEDRIVER);
    if ((t instanceof Boolean) && (useDriverTime == false)) {
      useDriverTime = ((Boolean) t).booleanValue();
    }

    if (useDriverTime) {
      // getAllTimesForTimeDriver(dataChoice, subset,
      //                         subset.getTimeDriverTimes());
      if (initTimes == null) {
        initTimes = subset.getTimeDriverTimes();
      }

      if (initTimes != null) { // reset the time for data choice if useDriverTime
        List<SoundingOb> soundingObs = getTimeMatchingSoundingObs(initTimes);
        choices = getTimeMatchingDataChoices(soundingObs);
      }
    }

    for (Iterator iter = choices.iterator(); iter.hasNext(); ) {
      DataChoice dc = (DataChoice) iter.next();
      Data ob = makeSoundingOb(dc, subset);
      if (ob != null) {
        v.add(ob);
      }
    }
    return (v.isEmpty()) ? null : new Tuple((Data[]) v.toArray(new Data[v.size()]), false);
  }