Beispiel #1
0
  /**
   * _more_
   *
   * @param dTimes _more_
   * @return _more_
   */
  protected List<SoundingOb> getTimeMatchingSoundingObs(List<DateTime> dTimes) {
    List soundingObs = getRDS().getSoundingObs();
    List newSoundingObs = new ArrayList<SoundingOb>();
    SoundingAdapter adapter = getRDS().adapter;

    for (Iterator iter = soundingObs.iterator(); iter.hasNext(); ) {
      SoundingOb ob = (SoundingOb) iter.next();

      for (Iterator itr = dTimes.iterator(); itr.hasNext(); ) {
        // Date       d      = (Date) itr.next();
        DateTime obTime = (DateTime) itr.next();
        SoundingOb ob1 = null;
        try {
          // obTime = new DateTime(d);
          ob1 = new SoundingOb(ob.getStation(), obTime);
          newSoundingObs.add(ob1);
        } catch (Exception e) {
        }
      }
    }

    raobDataSet = new RaobDataSet(adapter, newSoundingObs);

    return newSoundingObs;
  }
Beispiel #2
0
  /**
   * _more_
   *
   * @param soundingObs _more_
   * @return _more_
   */
  protected List<DataChoice> getTimeMatchingDataChoices(List<SoundingOb> soundingObs) {
    List<DataChoice> newChoices = new ArrayList<DataChoice>();
    List categories = new ArrayList();

    DataCategory cat = new DataCategory(DataCategory.CATEGORY_RAOBSOUNDING);
    cat.setForDisplay(false);
    categories.add(cat);

    List compCategories = new ArrayList();
    DataCategory compCat = new DataCategory("None");
    compCat.setForDisplay(false);
    compCategories.add(compCat);

    Hashtable props = Misc.newHashtable(DataChoice.PROP_ICON, "/auxdata/ui/icons/Balloon.gif");

    for (Iterator iter = soundingObs.iterator(); iter.hasNext(); ) {
      SoundingOb ob = (SoundingOb) iter.next();
      String name = ob.getLabel();
      DateTime obTime = ob.getTimestamp();
      DataSelection timeSelect = null;
      if (obTime != null) {
        ArrayList times = new ArrayList(1);
        times.add(obTime);
        timeSelect = new DataSelection(times);
      }

      DataChoice choice =
          new DirectDataChoice(this, ob, getName(), name, categories, timeSelect, props);
      newChoices.add(choice);
    }

    return newChoices;
  }
Beispiel #3
0
  /**
   * Adds the {@link ucar.unidata.data.DataChoice}s of the current input data via {@link
   * #addDataChoice(DataChoice)}.
   */
  protected void doMakeDataChoices() {
    int i = 0;
    List soundingObs = getRDS().getSoundingObs();
    List categories = new ArrayList();

    DataCategory cat = new DataCategory(DataCategory.CATEGORY_RAOBSOUNDING);
    cat.setForDisplay(false);
    categories.add(cat);

    List compCategories = new ArrayList();
    DataCategory compCat = new DataCategory("None");
    compCat.setForDisplay(false);
    compCategories.add(compCat);

    CompositeDataChoice composite =
        new CompositeDataChoice(this, soundingObs, getName(), "RAOB Data", categories);
    Hashtable props = Misc.newHashtable(DataChoice.PROP_ICON, "/auxdata/ui/icons/Balloon.gif");

    for (Iterator iter = soundingObs.iterator(); iter.hasNext(); ) {
      SoundingOb ob = (SoundingOb) iter.next();
      String name = ob.getLabel();
      DateTime obTime = ob.getTimestamp();
      DataSelection timeSelect = null;
      if (obTime != null) {
        ArrayList times = new ArrayList(1);
        times.add(obTime);
        timeSelect = new DataSelection(times);
      }
      DataChoice choice =
          new DirectDataChoice(this, ob, composite.getName(), name, categories, timeSelect, props);
      composite.addDataChoice(choice);
    }
    addDataChoice(composite);
  }
Beispiel #4
0
 /**
  * Override the init method for when this data source is unpersisted. We simply check the
  * imageList to see if this object came from a legacy bundle.
  */
 public void initAfterUnpersistence() {
   super.initAfterUnpersistence();
   List tmp = getTmpPaths();
   if (tmp != null) {
     List obs = getRDS().getSoundingObs();
     AddeSoundingAdapter asa = (AddeSoundingAdapter) getRDS().getSoundingAdapter();
     for (int i = 0; i < tmp.size(); i += 2) {
       SoundingOb ob = (SoundingOb) obs.get(i / 2);
       ob.setMandatoryFile(tmp.get(i).toString());
       ob.setMandatoryFile(tmp.get(i + 1).toString());
     }
   }
 }
Beispiel #5
0
 /**
  * Get the list of urls from the remote server
  *
  * @return List of urls
  */
 public List getDataPaths() {
   List paths = new ArrayList();
   AddeSoundingAdapter asa = (AddeSoundingAdapter) getRDS().getSoundingAdapter();
   List obs = getRDS().getSoundingObs();
   for (int i = 0; i < obs.size(); i++) {
     SoundingOb ob = (SoundingOb) obs.get(i);
     if (ob.getMandatoryFile() != null) {
       // file based
       paths.add(ob.getMandatoryFile());
       paths.add(ob.getSigFile());
     } else {
       paths.add(asa.getMandatoryURL(ob));
       paths.add(asa.getSigURL(ob));
     }
   }
   return paths;
 }
Beispiel #6
0
 /**
  * Gets the SoundingOb associated with this DataChoice. The VisAD {@link visad.MathType} of the
  * return value is the {@link visad.Tuple} ({@link visad.DateTime}, {@link
  * visad.georef.EarthLocationTuple}, {@link ucar.visad.functiontypes.InSituAirTemperatureProfile},
  * {@link ucar.visad.functiontypes.DewPointProfile}).
  *
  * @param dc DataChoice for data
  * @param dataSelection subselection criteria
  * @return The sounding observation.
  * @throws RemoteException Java RMI problem
  * @throws VisADException VisAD problem
  */
 private Data makeSoundingOb(DataChoice dc, DataSelection dataSelection)
     throws VisADException, RemoteException {
   SoundingOb so = getRDS().initSoundingOb((SoundingOb) dc.getId());
   if (so == null) {
     return null;
   }
   RAOB raob = so.getRAOB();
   SoundingStation ss = (SoundingStation) so.getStation();
   // sanity check
   FlatField t = raob.getTemperatureProfile();
   if (t.getDomainSet().getLength() == 1) {
     return null;
   }
   return new Tuple(
       new Data[] {
         so.getTimestamp(),
         ((SoundingStation) so.getStation()).getNamedLocation(),
         raob.getTemperatureProfile(),
         raob.getDewPointProfile(),
         raob.getWindProfile()
       });
 }
Beispiel #7
0
 /**
  * _Save the remote data to local disk
  *
  * @param prefix Where to write the files to
  * @param loadId For the JobManager dialog
  * @param changeLinks Should we change the internal data references
  * @return List of files we wrote
  * @throws Exception On badness
  */
 protected List saveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks)
     throws Exception {
   List urls = new ArrayList();
   List obs = getRDS().getSoundingObs();
   AddeSoundingAdapter asa = (AddeSoundingAdapter) getRDS().getSoundingAdapter();
   for (int i = 0; i < obs.size(); i++) {
     SoundingOb ob = (SoundingOb) obs.get(i);
     urls.add(asa.getMandatoryURL(ob) + "&rawstream=true");
     urls.add(asa.getSigURL(ob) + "&rawstream=true");
   }
   List newFiles = IOUtil.writeTo(urls, prefix, "raob", loadId);
   if (newFiles == null) {
     return null;
   }
   if (changeLinks) {
     for (int i = 0; i < newFiles.size(); i += 2) {
       SoundingOb ob = (SoundingOb) obs.get(i / 2);
       ob.setMandatoryFile(newFiles.get(i).toString());
       ob.setSigFile(newFiles.get(i + 1).toString());
     }
   }
   return newFiles;
 }