Examples of DateRange


Examples of ucar.nc2.units.DateRange

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

     //temporal
    DateRange tm = ds.getTimeCoverage();
    if (tm != null) {
      DateType end = tm.getEnd();
      if (end.isPresent()) {
        TimeDuration duration = tm.getDuration();
        double ndays = -duration.getValueInSeconds()/3600/24;
        String reletiveTime = "RELATIVE_START_DATE: "+((int)ndays);
        rootElem.addContent( new Element("Keyword", defNS).addContent(reletiveTime));
      }
    }

    // LOOK KLUDGE - these need to be added to the catalog !!  see http://gcmd.nasa.gov/Resources/valids/sources.html
    Element platform = new Element("Source_Name", defNS);
    rootElem.addContent(platform);
    platform.addContent( new Element("Short_Name", defNS).addContent("MODELS"));

    if (tm != null) {
      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("Stop_Date",
                        defNS).addContent(tm.getEnd().toDateString()));
    }

    //geospatial
    ThreddsMetadata.GeospatialCoverage geo = ds.getGeospatialCoverage();
    if (geo != null) {
View Full Code Here

Examples of ucar.nc2.units.DateRange

          throws WcsException
  {
    if ( time == null || time.equals( ""))
      return null;

    DateRange dateRange;

    try
    {
      if ( time.indexOf( ",") != -1 )
      {
        log.error( "parseTime(): Unsupported time parameter (list) <" + time + ">.");
        throw new WcsException( WcsException.Code.InvalidParameterValue, "TIME",
                                "Not currently supporting time list." );
        //String[] timeList = time.split( "," );
        //dateRange = new DateRange( date, date, null, null );
      }
      else if ( time.indexOf( "/") != -1 )
      {
        String[] timeRange = time.split( "/" );
        if ( timeRange.length != 2)
        {
          log.error( "parseTime(): Unsupported time parameter (time range with resolution) <" + time + ">.");
          throw new WcsException( WcsException.Code.InvalidParameterValue, "TIME", "Not currently supporting time range with resolution.");
        }
        dateRange = new DateRange( new DateType( timeRange[0], null, null ),
                                   new DateType( timeRange[1], null, null ), null, null );
      }
      else
      {
        DateType date = new DateType( time, null, null );
        dateRange = new DateRange( date, date, null, null );
        this.isSingleTimeRequest = true;
      }
    }
    catch ( ParseException e )
    {
View Full Code Here

Examples of ucar.nc2.units.DateRange

    if (collection != null) {
      if (collection.getBoundingBox() == null)
        collection.setBoundingBox(bb);
      if (collection.getDateRange() == null) {
        DateRange dr = getDateRange();
        if (dr != null)
          collection.setDateRange(dr);
      }
      if (collection.size() <= 0) {
        if (count < 0) count = 0;
View Full Code Here

Examples of ucar.nc2.units.DateRange

  }

  public DateRange getDateRange() {
    if (!calcBounds) return null;
    if (timeUnit == null) return null;
    return new DateRange(timeUnit.makeDate(minTime), timeUnit.makeDate(maxTime));
  }
View Full Code Here

Examples of ucar.nc2.units.DateRange

  public void calcBounds() throws java.io.IOException {
    if ((boundingBox != null) && (dateRange != null)) return;

    LatLonRect bb = null;
    DateRange dates = null;
    for (FeatureCollection fc : collectionList) {

      if (fc instanceof PointFeatureCollection) {
        PointFeatureCollection pfc = (PointFeatureCollection) fc;
        pfc.calcBounds();
        if (bb == null)
          bb = pfc.getBoundingBox();
        else
          bb.extend(pfc.getBoundingBox());
        if (dates == null)
          dates = pfc.getDateRange();
        else
          dates.extend(pfc.getDateRange());

      else if (fc instanceof StationTimeSeriesFeatureCollection) {

        StationTimeSeriesFeatureCollection sc = (StationTimeSeriesFeatureCollection) fc;
        if (bb == null)
           bb = sc.getBoundingBox();
         else
           bb.extend(sc.getBoundingBox());

        PointFeatureCollection pfc = sc.flatten(null, null);
        pfc.calcBounds();
        if (dates == null)
          dates = pfc.getDateRange();
        else
          dates.extend(pfc.getDateRange());
      }

    }

    if (boundingBox == null) boundingBox = bb;
View Full Code Here

Examples of ucar.nc2.units.DateRange

    Date start = format.isoDateTimeFormat("2005-12-06T18:00:00Z");
    Date end = format.isoDateTimeFormat("2005-12-07T18:00:00Z");

    writer.makeFile(fileOut, gds, gridList,
            new LatLonRect(new LatLonPointImpl(37, -109), 400, 7),
            new DateRange(start, end),
            true,
            1, 1, 1);

  }
View Full Code Here

Examples of ucar.nc2.units.DateRange

    Date start = format.isoDateTimeFormat("2003-06-01T03:00:00Z");
    Date end = format.isoDateTimeFormat("2004-01-01T00:00:00Z");

    writer.makeFile(fileOut, gds, gridList, null,
            // new LatLonRect(new LatLonPointImpl(30, -109), 10, 50),
            new DateRange(start, end),
            true,
            1, 1, 1);

  }
View Full Code Here

Examples of ucar.nc2.units.DateRange

          // into flattened representation
          PointFeatureCollection pfc = stsfc.flatten(
                  new LatLonRect(
                          new LatLonPointImpl(-90, -180),
                          new LatLonPointImpl(90, 180)),
                  new DateRange(
                          df.parse("1900-01-01"),
                          df.parse("2100-01-01")));
          PointFeatureIterator pfi = pfc.getPointFeatureIterator(-1);
          try {
            while (pfi.hasNext()) {
View Full Code Here

Examples of ucar.nc2.units.DateRange

      return new GridDataset(ncd);

    } else {
      List<VariableSimpleIF> dataVars = FeatureDatasetPointXML.getDataVariables(doc);
      LatLonRect bb = FeatureDatasetPointXML.getSpatialExtent(doc);
      DateRange dr = FeatureDatasetPointXML.getTimeSpan(doc);

      return new PointDatasetRemote(ft, uri, dataVars, bb, dr);
    }
  }
View Full Code Here

Examples of ucar.nc2.units.DateRange

    }

  }

  static public DateRange extractDateRange(GridDataset gridDataset) {
    DateRange maxDateRange = null;

    for (GridDataset.Gridset gridset : gridDataset.getGridsets()) {
      GridCoordSystem gsys = gridset.getGeoCoordSystem();
      DateRange dateRange;

      CoordinateAxis1DTime time1D = gsys.getTimeAxis1D();
      if (time1D != null) {
        dateRange = time1D.getDateRange();
      } else {
        CoordinateAxis time = gsys.getTimeAxis();
        if (time == null)
          continue;
       
        try {
          DateUnit du = new DateUnit( time.getUnitsString());
          Date minDate = du.makeDate(time.getMinValue());
          Date maxDate = du.makeDate(time.getMaxValue());
          dateRange = new DateRange( minDate, maxDate);
        } catch (Exception e) {
          logger.warn("Illegal Date Unit "+time.getUnitsString());
          continue;
        }
      }
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.