Examples of DateRange


Examples of ucar.nc2.units.DateRange

    public static DateRange dateRangeToNcDateRange( ThreddsMetadata.DateRange dateRange )
            throws ParseException
    {
        DateType startDate = new DateType( dateRange.getStartDate(), dateRange.getStartDateFormat(), null );
        DateType endDate = new DateType( dateRange.getEndDate(), dateRange.getEndDateFormat(), null );
        return new DateRange( startDate, endDate, new TimeDuration( dateRange.getDuration()), null );
    }
View Full Code Here

Examples of ucar.nc2.units.DateRange

    public static DateRange dateRangeBuilderToNcDateRange( ThreddsMetadataBuilder.DateRangeBuilder dateRange )
            throws ParseException
    {
        DateType startDate = new DateType( dateRange.getStartDate(), dateRange.getStartDateFormat(), null );
        DateType endDate = new DateType( dateRange.getEndDate(), dateRange.getEndDateFormat(), null );
        return new DateRange( startDate, endDate, new TimeDuration( dateRange.getDuration()), null );
    }
View Full Code Here

Examples of ucar.nc2.units.DateRange

    GridCoordSystem gcsMax = null;
    LatLonRect llbbMax = null;

    LatLonRect llbb = null;
    DateRange dateRange = null;
    long nx = 0, ny = 0;

    for (GridDataset.Gridset gset : gridDs.getGridsets()) {
      GridCoordSystem gcs = gset.getGeoCoordSystem();

      CoordinateAxis1D xaxis = (CoordinateAxis1D) gcs.getXHorizAxis();
      CoordinateAxis1D yaxis = (CoordinateAxis1D) gcs.getYHorizAxis();
      long nx2 = xaxis.getSize();
      long ny2 = yaxis.getSize();
      if ((nx != nx2) || (ny != ny2)) {
        nx = nx2;
        ny = ny2;
        double dx = xaxis.getIncrement();
        double dy = yaxis.getIncrement();
        out.println("  horizontal = " + nx + " by " + ny + " points, resolution " + Format.d(dx, 4) + " " + Format.d(dy, 4)
            + " " + xaxis.getUnitsString());
      }

      ProjectionImpl proj = gcs.getProjection();
      if (proj != null) {
        out.println(", " + proj.getClassName() + " projection;");

        List<Parameter> params = proj.getProjectionParameters();
        for (Parameter p : params)
          out.println("       " + p.getName() + " " + p.getStringValue());

      } else
        out.println();

      LatLonRect llbb2 = gcs.getLatLonBoundingBox();
      if ((llbb == null) || !llbb2.equals(llbb)) {
        llbb = llbb2;

        if (llbbMax == null)
          llbbMax = llbb;
        else
          llbbMax.extend(llbb);

        if (llbb.getWidth() >= 360.0) {
          out.println("  BoundingBox == GLOBAL");

        } else {
          StringBuffer buff = new StringBuffer();
          LatLonPointImpl ll = llbb.getLowerLeftPoint();
          LatLonPointImpl ur = llbb.getUpperRightPoint();
          buff.append(Double.toString(ll.getLongitude()));
          buff.append(" ");
          buff.append(Double.toString(ll.getLatitude()));
          buff.append(" ");
          buff.append(Double.toString(ur.getLongitude()));
          buff.append(" ");
          buff.append(Double.toString(ur.getLatitude()));
          buff.append(" ");
          out.println("  BoundingBox == " + llbb + " width= " + llbb.getWidth() + " " + (llbb.getWidth() >= 360.0 ? "global" : ""));
        }

      }

      CoordinateAxis1DTime taxis = gcs.getTimeAxis1D();

      DateRange dateRange2 = gcs.getDateRange();
      if ((taxis != null) && ((dateRange == null) || !dateRange2.equals(dateRange))) {

        long ntimes = taxis.getSize();
        try {
          TimeUnit tUnit = taxis.getTimeResolution();
          dateRange = new DateRange(dateRange2, "1 hour");
          out.println("  DateRange == " + "start= " + dateRange.getStart() + " end= " + dateRange.getEnd() +
              " duration= " + dateRange.getDuration() + " ntimes = " + ntimes + " data resolution = " + tUnit);
        } catch (Exception e) {
          e.printStackTrace();
        }
View Full Code Here

Examples of ucar.nc2.units.DateRange

        rootElem.addContent( new Element("Keyword", defNS).addContent( k.getText()));
      }
    }

    //temporal
    DateRange tm = ds.getTimeCoverage();
    Element tmElem = new Element("Temporal_Coverage", defNS);
    rootElem.addContent( tmElem);

    tmElem.addContent( new Element("Start_Date", defNS).addContent( tm.getStart().toDateString()));
    tmElem.addContent( new Element("End_Date", defNS).addContent( tm.getEnd().toDateString()));

    //geospatial
    ThreddsMetadata.GeospatialCoverage geo = ds.getGeospatialCoverage();
    Element geoElem = new Element("Spatial_Coverage", defNS);
    rootElem.addContent( geoElem);
View Full Code Here

Examples of ucar.nc2.units.DateRange

    DateType end = readDate( tElem.getChild("end", defNS));
    TimeDuration duration = readDuration( tElem.getChild("duration", defNS));
    TimeDuration resolution = readDuration( tElem.getChild("resolution", defNS));

    try {
      DateRange tc = new DateRange( start, end, duration, resolution);
      return tc;
    } catch (java.lang.IllegalArgumentException e) {
      factory.appendWarning(" ** warning: TimeCoverage error = "+e.getMessage()+"\n");
      return null;
    }
View Full Code Here

Examples of ucar.nc2.units.DateRange

    // can only be one each of these kinds
    ThreddsMetadata.GeospatialCoverage gc = readGeospatialCoverage( parent.getChild("geospatialCoverage", defNS));
    if (gc != null) tmg.setGeospatialCoverage( gc);

    DateRange tc = readTimeCoverage( parent.getChild("timeCoverage", defNS));
    if (tc != null) tmg.setTimeCoverage( tc);

    Element serviceNameElem = parent.getChild("serviceName", defNS);
    if (serviceNameElem != null) tmg.setServiceName( serviceNameElem.getText());
View Full Code Here

Examples of ucar.nc2.units.DateRange

    ThreddsMetadata.GeospatialCoverage gc = tmg.getGeospatialCoverage();
    if ((gc != null) && !gc.isEmpty())
      elem.addContent( writeGeospatialCoverage( gc));

    DateRange tc = tmg.getTimeCoverage();
    if (tc != null)
      elem.addContent( writeTimeCoverage( tc));

    List<ThreddsMetadata.Variables> varList = tmg.getVariables();
    for ( ThreddsMetadata.Variables v : varList ) {
View Full Code Here

Examples of ucar.nc2.units.DateRange

    ThreddsMetadata.GeospatialCoverage gc = ds.getGeospatialCoverage();
    if (null != gc)
      rootElem.addContent( writeGeospatialCoverage( gc));

    // temporal
    DateRange dateRange = ds.getTimeCoverage();
    if (null != dateRange)
      rootElem.addContent( writeTemporalCoverage(dateRange));
  }
View Full Code Here

Examples of ucar.nc2.units.DateRange

    startTime.delete( 0, matcher.start());

    try
    {
      ( (InvDatasetImpl) dataset ).setTimeCoverage(
              new DateRange( new DateType( startTime.toString(), null, null ), null,
                             new TimeDuration( this.duration ), null ) );
    }
    catch ( Exception e )
    {
      log.warn( "addMetadata(): Start time <" + startTime.toString() + "> or duration <" + this.duration + "> not parsable" +
View Full Code Here

Examples of ucar.nc2.units.DateRange

      if ((tgc != null) && !tgc.isEmpty())
        gc = tgc;
    }

    if (tc == null) {
      DateRange ttc = tmd.getTimeCoverage();
      if (ttc != null) {
        // System.out.println(" tc assigned = "+ttc);
        tc = ttc;
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.