Package ucar.nc2.units

Examples of ucar.nc2.units.DateType


    if (lastModDate.getType() == null || !lastModDate.getType().equals("modified")) {
      throw new IllegalArgumentException("Date type must be \"modified\" (was \"" + lastModDate.getType() + "\").");
    }

    // Check for existing last modified date and remove if one exists.
    DateType curLastModDateType = this.getLastModifiedDate();
    if (curLastModDateType != null) {
      tm.getDates().remove(curLastModDateType);
    }

    // Set the last modified date with the given DateType.
View Full Code Here


  public void setLastModifiedDate(Date lastModDate) {
    if (lastModDate == null)
      throw new IllegalArgumentException("Last modified date can't be null.");

    // Set the last modified date with the given Date.
    DateType lastModDateType = new DateType(false, lastModDate);
    lastModDateType.setType("modified");
    setLastModifiedDate(lastModDateType);
  }
View Full Code Here

    }

    DateRange tc = ds.getTimeCoverage();
    if (tc != null) {
      buff.append("<h3>TimeCoverage:</h3>\n<ul>\n");
      DateType start = tc.getStart();
      if ((start != null) && !start.isBlank())
        buff.append(" <li><em>  Start: </em> ").append(start.toDateTimeString()).append("\n");
      DateType end = tc.getEnd();
      if ((end != null) && !end.isBlank()) {
        buff.append(" <li><em>  End: </em> ").append(end.toDateTimeString()).append("\n");
      }
      TimeDuration duration = tc.getDuration();
      if ((duration != null) && !duration.isBlank())
        buff.append(" <li><em>  Duration: </em> ").append(StringUtil.quoteHtmlContent(duration.toString())).append("\n");
      TimeDuration resolution = tc.getResolution();
View Full Code Here

    private ThreddsCatalogUtils() {}

    public static DateType datePointToDateType( ThreddsMetadata.DatePoint datePoint )
            throws ParseException
    {
        return new DateType( datePoint.getDate(), datePoint.getDateFormat(), datePoint.getType());
    }
View Full Code Here

    }

    public static DateType datePointBuilderToDateType( ThreddsMetadataBuilder.DatePointBuilder datePoint )
            throws ParseException
    {
        return new DateType( datePoint.getDate(), datePoint.getDateFormat(), datePoint.getType());
    }
View Full Code Here

      Variable time = ds.findVariable("time_offset");
      if (time != null) {
        Variable base = ds.findVariable("base_time");
        int base_time = base.readScalarInt();
        try {
          DateUnit dunit = new DateUnit("seconds since 1970-01-01 00:00");
          String time_units = "seconds since " + dunit.makeStandardDateString(base_time);
          time.addAttribute(new Attribute("units", time_units));
          time.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Time.name()));
        } catch (Exception e) {
          e.printStackTrace();
        }
View Full Code Here

    return " ";
  }

private String isUdunits(String unit) {
    try {
      new DateUnit(unit);
      return "date";
    } catch (Exception e) {
      // ok
    }
View Full Code Here

                uStart = description.lastIndexOf("(");
                if (uStart >= 0 && uEnd > uStart) {
                    String possibleUnitName = description.substring(uStart
                                                  + 1, uEnd);
                    try {
                        SimpleUnit u = SimpleUnit.factoryWithExceptions(
                                           possibleUnitName);
                        unitName = possibleUnitName;
                    } catch (Exception e) {
                        unitName = null;
                    }
View Full Code Here

      return "time";
    } catch (Exception e) {
      // ok
    }

    SimpleUnit su = SimpleUnit.factory(unit);
    if (null == su) return "false";
    return su.getCanonicalString();
  }
View Full Code Here

    } catch (Exception e) {
      // ok
    }

    try {
      new TimeUnit(unit);
      return "time";
    } catch (Exception e) {
      // ok
    }
View Full Code Here

TOP

Related Classes of ucar.nc2.units.DateType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.