Package ucar.nc2.units

Examples of ucar.nc2.units.DateRange


    LatLonRect bb = fdp.getBoundingBox();
    if (bb != null)
      rootElem.addContent(writeBoundingBox(bb));

    // add date range
    DateRange dateRange = fdp.getDateRange();
    if (dateRange != null) {
      DateFormatter format = new DateFormatter();
      Element drElem = new Element("TimeSpan"); // from KML
      drElem.addContent(new Element("begin").addContent(dateRange.getStart().toDateTimeStringISO()));
      drElem.addContent(new Element("end").addContent(dateRange.getEnd().toDateTimeStringISO()));
      if (dateRange.getResolution() != null)
        drElem.addContent(new Element("resolution").addContent(dateRange.getResolution().toString()));

      rootElem.addContent(drElem);
    }

    // add accept list
View Full Code Here


    DateFormatter format = new DateFormatter();
    try {
      Date start = format.getISODate(beginS);
      Date end = format.getISODate(endS);
      DateRange dr = new DateRange(start, end);
     
      if (resS != null)
        dr.setResolution(new TimeDuration(resS));

      return dr;

    } catch (Exception e) {
      return null;
View Full Code Here

  public DateRange getDateRange() {
    if (timeDates == null) makeTimes();
    if (isDate) {
      Date[] dates = getTimeDates();
      return new DateRange(dates[0], dates[dates.length - 1]);
    }
    return null;
  }
View Full Code Here

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

      DateRange dateRange = gcs.getDateRange();
      if (dateRange != null) {
        if (dateRangeMax == null)
          dateRangeMax = dateRange;
        else
          dateRangeMax.extend(dateRange);
View Full Code Here

      InvDatasetImpl nested = new InvDatasetImpl(this, name);
      nested.setUrlPath(path + "/" + RUNS + "/" + name);
      nested.setID(id + "/" + RUNS + "/" + name);
      ThreddsMetadata tm = nested.getLocalMetadata();
      tm.addDocumentation("summary", "Data from Run " + name);
      DateRange dr = fmrc.getDateRangeForRun(runDate);
      if (dr != null)
        tm.setTimeCoverage(dr);
      datasets.add(nested);
    }
View Full Code Here

      InvDatasetImpl nested = new InvDatasetImpl(this, name);
      nested.setUrlPath(path + "/" + OFFSET + "/" + name);
      nested.setID(id + "/" + OFFSET + "/" + name);
      ThreddsMetadata tm = nested.getLocalMetadata();
      tm.addDocumentation("summary", "Data from the " + offset + " hour forecasts, across different model runs.");
      DateRange dr = fmrc.getDateRangeForOffset(offset);
      if (dr != null)
        tm.setTimeCoverage(dr);
      datasets.add(nested);
    }
View Full Code Here

      InvDatasetImpl nested = new InvDatasetImpl(this, name);
      nested.setUrlPath(path + "/" + FORECAST + "/" + name);
      nested.setID(id + "/" + FORECAST + "/" + name);
      ThreddsMetadata tm = nested.getLocalMetadata();
      tm.addDocumentation("summary", "Data with the same forecast date, " + name + ", across different model runs.");
      tm.setTimeCoverage( new DateRange(forecastDate, forecastDate));
      datasets.add(nested);
    }

    return datasets;
  }
View Full Code Here

        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

          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

    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

TOP

Related Classes of ucar.nc2.units.DateRange

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.