예제 #1
0
  /**
   * Test the program
   *
   * @param args the args
   * @throws IOException _more_
   */
  public static void main(String args[]) throws IOException {
    StringBuffer errlog = new StringBuffer();
    String ds_location = null;
    TDSRadarDatasetCollection dsc = null;
    List stns = null;

    ds_location =
        // "http://localhost:8080/thredds/radarServer/nexrad/level3/CCS039/dataset.xml";
        // "http://motherlode.ucar.edu:8081/thredds/radarServer/nexrad/level3/CCS039/dataset.xml";
        "http://thredds.ucar.edu/thredds/radarServer/nexrad/level3/CCS039/dataset.xml";
    dsc = TDSRadarDatasetCollection.factory("test", ds_location, errlog);
    System.out.println(" errs= " + errlog);
    stns = dsc.getStations();
    System.out.println(" nstns= " + stns.size());

    // System.exit(0);
    stns = dsc.getStations();
    System.out.println(" nstns= " + stns.size());

    Station stn = dsc.getRadarStation("DVN"); // (StationImpl)stns.get(12);
    System.out.println("stn = " + stn);

    // List ulist = stn.getRadarStationURIs();
    // assert null != ulist;
    List tl = dsc.getRadarTimeSpan();
    Date ts1 = DateUnit.getStandardOrISO("1998-06-28T01:01:21Z");
    Date ts2 = DateUnit.getStandardOrISO("1998-07-30T19:01:21Z");
    List pd = dsc.getRadarProducts();
    List<Date> tlist = dsc.getRadarStationTimes(stn.getName(), "BREF1", ts1, ts2);
    int sz = tlist.size();
    for (int i = 0; i < 3; i++) {
      Date ts0 = (Date) tlist.get(i);
      RadialDatasetSweep rds = dsc.getRadarDataset(stn.getName(), "BREF1", ts0);
      int tt = 0;
    }

    Date ts0 = (Date) tlist.get(0);
    URI stURL = dsc.getRadarDatasetURI(stn.getName(), "BREF1", ts0);
    assert null != stURL;
    DateSelection dateS = new DateSelection(ts1, ts2);
    dateS.setInterval((double) 3600 * 1000);
    dateS.setRoundTo((double) 3600 * 1000);
    dateS.setPreRange((double) 500 * 1000);
    dateS.setPostRange((double) 500 * 1000);

    for (int i = 0; i < stns.size(); i++) {
      stn = (Station) stns.get(i);
      List<Date> times =
          dsc.getRadarStationTimes(
              stn.getName(),
              "BREF1",
              new Date(System.currentTimeMillis() - 3600 * 1000 * 24 * 100),
              new Date(System.currentTimeMillis()));
      if (times.size() > 0) {
        System.err.println(
            stn
                + " times:"
                + times.size()
                + " "
                + times.get(0)
                + " - "
                + times.get(times.size() - 1));
      } else {
        System.err.println(stn + " no times");
      }
    }

    Date ts = (Date) tlist.get(1);
    java.text.SimpleDateFormat isoDateTimeFormat;
    isoDateTimeFormat = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    isoDateTimeFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
    String st = isoDateTimeFormat.format(ts);
  }
예제 #2
0
  /**
   * _more_
   *
   * @param args _more_
   * @throws IOException _more_
   */
  public static void main(String args[]) throws IOException {
    StringBuffer errlog = new StringBuffer();
    String dqc_location = "http://thredds.ucar.edu/thredds/idd/radarLevel2";
    DqcRadarDatasetCollection ds = factory("test", dqc_location, errlog);
    System.out.println(" errs= " + errlog);

    List stns = ds.getStations();
    System.out.println(" nstns= " + stns.size());

    Station stn = (Station) (stns.get(2));

    // List ulist = stn.getRadarStationURIs();
    // assert null != ulist;
    Date ts1 = DateUnit.getStandardOrISO("2007-06-9T12:12:00");
    Date ts2 = DateUnit.getStandardOrISO("2007-06-9T23:12:00");

    List tlist = ds.getRadarStationTimes(stn.getValue(), ts1, ts2);
    int sz = tlist.size();
    Date ts0 = DateUnit.getStandardOrISO((String) tlist.get(1));
    RadialDatasetSweep rds = ds.getRadarDataset(stn.getValue(), ts0);
    URI stURL = ds.getRadarDatasetURI(stn.getValue(), ts0);
    assert null != stURL;
    assert 0 != sz;
    DateSelection dateS = new DateSelection(ts1, ts2);
    dateS.setInterval((double) 3600 * 1000);
    dateS.setRoundTo((double) 3600 * 1000);
    dateS.setPreRange((double) 500 * 1000);
    dateS.setPostRange((double) 500 * 1000);

    for (int i = 0; i < stns.size(); i++) {
      stn = (Station) stns.get(i);
      List times =
          ds.getRadarStationTimes(
              stn.getValue(),
              new Date(System.currentTimeMillis() - 3600 * 1000 * 24 * 100),
              new Date(System.currentTimeMillis()));
      if (times.size() > 0) {
        System.err.println(
            stn
                + " times:"
                + times.size()
                + " "
                + times.get(0)
                + " - "
                + times.get(times.size() - 1));
      } else {
        System.err.println(stn + " no times");
      }
    }
    System.exit(0);

    List jList = ds.getDataURIs("KABX", dateS);

    assert null != jList;
    List mList = ds.getData("KABX", dateS, null);
    assert null != mList;

    // Date ts0 =
    // DateFromString.getDateUsingCompleteDateFormat((String)tlist.get(1),"yyyy-MM-dd'T'HH:mm:ss");
    Date ts = DateUnit.getStandardOrISO((String) tlist.get(1));
    java.text.SimpleDateFormat isoDateTimeFormat;
    isoDateTimeFormat = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    isoDateTimeFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
    String st = isoDateTimeFormat.format(ts);
  }