Esempio n. 1
0
  /*  Broken:
   *  http://sohowww.nascom.nasa.gov/data/synoptic/gif/000123/nanc_164Mz_fd_2023_1046.gif
   *  http://sohowww.nascom.nasa.gov/data/synoptic/gif/000123/nanc_164Mz_fd_2023_0916.gif
   *  http://sohowww.nascom.nasa.gov/data/synoptic/gif/000123/meud_halph_fd_2023_1356.gif
   *  http://sohowww.nascom.nasa.gov/data/synoptic/gif/000213/nanc_164Mz_fd_2113_0919.gif
   *
   *  Ok:
   *  http://sohowww.nascom.nasa.gov/data/synoptic/gif/000212/pdmo_cogha_fd_20000212_0814.gif
   *  http://sohowww.nascom.nasa.gov/data/synoptic/gif/000212/pdmo_cogha_fd_20000212_0945.gif
   */
  private static void determineAttributes_(Hashtable h, String url) {
    int idxl = url.lastIndexOf('/') + 1;
    int idxr = url.indexOf('_');
    String tmp = null;
    try {
      // Messages.debug(2, "Soho:DeterminAttrib1 idxl=%1 idxr=%2 url=%3", String.valueOf(idxl),
      // String.valueOf(idxr), url);
      tmp = (String) INSTITUTE_CODES_.get(url.substring(idxl, idxr));
      h.put("U_INSTITUTE_CODE", (tmp == null) ? "unknown" : EtcUtil.makeURLish(tmp));
      h.put("INSTITUTE_CODE", tmp);

      idxl = idxr + 1;
      idxr = url.indexOf('_', idxl);
      // Messages.debug(2, "Soho:DeterminAttrib2 idxl=%1 idxr=%2", String.valueOf(idxl),
      // String.valueOf(idxr));
      tmp = (String) TYPE_CODES_.get(url.substring(idxl, idxr));
      h.put("U_TYPE_CODE", (tmp == null) ? "unknown" : EtcUtil.makeURLish(tmp));
      h.put("TYPE_CODE", tmp);

      idxl = idxr + 1;
      idxr = url.indexOf('_', idxl);
      // Messages.debug(2, "Soho:DeterminAttrib3 idxl=%1 idxr=%2", String.valueOf(idxl),
      // String.valueOf(idxr));
      tmp = (String) INFO_CODES_.get(url.substring(idxl, idxr));
      h.put("U_INFO_CODE", (tmp == null) ? "unknown" : EtcUtil.makeURLish(tmp));

      idxl = idxr + 1;
      idxr = url.indexOf('_', idxl);
      // Messages.debug(2, "Soho:DeterminAttrib4 idxl=%1 idxr=%2", String.valueOf(idxl),
      // String.valueOf(idxr));
      tmp = url.substring(idxl, idxr);
      idxl = idxr + 1;
      idxr = url.indexOf('.', idxl);
      // Messages.debug(2, "Soho:DeterminAttrib5 idxl=%1 idxr=%2", String.valueOf(idxl),
      // String.valueOf(idxr));
      tmp += url.substring(idxl, idxr);
      Date d = null;
      if (tmp.length() == 12) {
        // Messages.debug(1, "Soho::determineAttributes before parse");
        d = dateFormatter2_.parse(tmp);
        tmp = RandomDate.format(d);
      } else if (tmp.length() == 8) tmp = "date not parsed";
      h.put("U_DATETIME", EtcUtil.makeURLish(tmp));
      h.put("DATETIME", tmp);

      idxl = url.lastIndexOf(".");
      // Messages.debug(2, "Soho:DeterminAttrib6 idxl=%1", String.valueOf(idxl));
      tmp = (String) FORMAT_CODES_.get(url.substring(idxl + 1));
      // Messages.debug(1, "Soho::determineAttributes formatcode=%1", tmp);
      h.put("U_FORMAT_CODE", (tmp == null) ? "unknown" : EtcUtil.makeURLish(tmp));
      // Messages.debug(3, SOH02_, url);
    } catch (Exception e) {
      Messages.warn(0, SOH01_, url);
      // Messages.debug(1, "Soho::exception during parsing (%1)", e);
      // e.printStackTrace();
      if (h.get("INSTITUTE_CODE") == null) h.put("INSTITUTE_CODE", "unknown");
      if (h.get("U_INSTITUTE_CODE") == null) h.put("U_INSTITUTE_CODE", "unknown");
      if (h.get("TYPE_CODE") == null) h.put("TYPE_CODE", "unknown");
      if (h.get("U_TYPE_CODE") == null) h.put("U_TYPE_CODE", "unknown");
      if (h.get("U_INFO_CODE") == null) h.put("U_INFO_CODE", "unknown");
      if (h.get("DATE_TIME") == null) h.put("DATE_TIME", "unknown");
      if (h.get("U_DATE_TIME") == null) h.put("U_DATE_TIME", "unknown");
      if (h.get("U_FORMAT_CODE") == null) h.put("U_FORMAT_CODE", "unknown");
    }
  }
Esempio n. 2
0
 SohoIterator() {
   h_.put("ARCHIVE", NAME_);
   h_.put("U_ARCHIVE", EtcUtil.makeURLish(NAME_));
 }