congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
CalendarDateUnit.makeCalendarDate
Code IndexAdd Tabnine to your IDE (free)

How to use
makeCalendarDate
method
in
ucar.nc2.time.CalendarDateUnit

Best Java code snippets using ucar.nc2.time.CalendarDateUnit.makeCalendarDate (Showing top 20 results out of 315)

origin: Unidata/thredds

@Nonnull
@Override
public CalendarDate getTime() {
 return timeUnit.makeCalendarDate(time);
}
origin: Unidata/thredds

@Nonnull
@Override
public CalendarDate getTime() {
 return timeUnit.makeCalendarDate(time);
}
origin: Unidata/thredds

@Nonnull
@Override
public CalendarDate getTime() {
 return timeUnit.makeCalendarDate(time);
}
origin: Unidata/thredds

@Nonnull
@Override
public CalendarDate getObservationTimeAsCalendarDate() {
 return timeUnit.makeCalendarDate(getObservationTime());
}
origin: Unidata/thredds

@Nonnull
@Override
public CalendarDate getNominalTimeAsCalendarDate() {
 return timeUnit.makeCalendarDate(getNominalTime());
}
origin: Unidata/thredds

@Override
public CalendarDateRange makeCalendarDateRange(ucar.nc2.time.Calendar cal) {
 CalendarDateUnit cdu = CalendarDateUnit.withCalendar(cal, periodName + " since " + refDate.toString());
 CalendarDate start = cdu.makeCalendarDate(timeUnit.getValue() * offsetSorted.get(0));
 CalendarDate end = cdu.makeCalendarDate(timeUnit.getValue() * offsetSorted.get(getSize() - 1));
 return CalendarDateRange.of(start, end);
}
origin: Unidata/thredds

double getValueInHours(Calendar cal, DateUnit unit, double value) {
   //CalendarDate d = unit.makeCalendarDate(value);
   //double secs =  unit.getTimeUnit().getValueInSeconds(value);	    	    	    
   //CalendarDate d = CalendarDate.of(cal, unit.getDateOrigin().getTime() + (long)(1000*secs));
   
   CalendarDateUnit dateUnit = CalendarDateUnit.withCalendar(cal, unit.getUnitsString() ); // this will throw exception on failure
   CalendarDate d = dateUnit.makeCalendarDate(value);
   return FmrcInv.getOffsetInHours(runDate, d);
  }  
 
origin: edu.ucar/cdm

double getValueInHours(Calendar cal, DateUnit unit, double value) {
   //CalendarDate d = unit.makeCalendarDate(value);
   //double secs =  unit.getTimeUnit().getValueInSeconds(value);	    	    	    
   //CalendarDate d = CalendarDate.of(cal, unit.getDateOrigin().getTime() + (long)(1000*secs));
   
   CalendarDateUnit dateUnit = CalendarDateUnit.withCalendar(cal, unit.getUnitsString() ); // this will throw exception on failure
   CalendarDate d = dateUnit.makeCalendarDate(value);
   return FmrcInv.getOffsetInHours(runDate, d);
  }  
 
origin: Unidata/thredds

/**
 * Make calendar date range, using the first and last ending bounds
 * @param cal  optional calendar, may be null
 * @return  calendar date range
 */
@Override
public CalendarDateRange makeCalendarDateRange(ucar.nc2.time.Calendar cal) {
 CalendarDateUnit cdu = CalendarDateUnit.of(cal, timeUnit.getField(), refDate);
 CalendarDate start = cdu.makeCalendarDate( timeUnit.getValue() * timeIntervals.get(0).getBounds2());
 CalendarDate end = cdu.makeCalendarDate(timeUnit.getValue() * timeIntervals.get(getSize()-1).getBounds2());
 return CalendarDateRange.of(start, end);
}
origin: Unidata/thredds

@Test
public void test360bug() {
 CalendarDateUnit unit = CalendarDateUnit.withCalendar(Calendar.uniform30day, "days since 2289-12-1");
 CalendarDate cd1 = unit.makeCalendarDate(25200.0);  // 70 years =  2359-12-1
 CalendarDate cd2 = unit.makeCalendarDate(46800.0);  // 130 =       2419-12-1
 System.out.printf("%s%n", unit);
 System.out.printf("%s%n", cd1);
 System.out.printf("%s%n", cd2);
 assert cd1.toString().equals("2359-12-01T00:00:00Z");
 assert cd2.toString().equals("2419-12-01T00:00:00Z");
}
origin: edu.ucar/cdm

protected void setStartDate() {
 String datetime = ds.findAttValueIgnoreCase(null, "time_coverage_start", null);
 if (datetime != null) {
  startDate = CalendarDate.parseISOformat(null, datetime).toDate();
 } else {
  startDate = calDateUnits.makeCalendarDate(time[0]).toDate();
 }
}
origin: edu.ucar/cdm

protected void setEndDate() {
 String datetime = ds.findAttValueIgnoreCase(null, "time_coverage_end", null);
 if (datetime != null) {
  endDate = CalendarDate.parseISOformat(null, datetime).toDate();
 } else {
  endDate = calDateUnits.makeCalendarDate(time[time.length - 1]).toDate();
 }
}
origin: Unidata/thredds

protected void setEndDate() {
 String datetime = ds.findAttValueIgnoreCase(null, "time_coverage_end", null);
 if (datetime != null) {
  endDate = CalendarDate.parseISOformat(null, datetime).toDate();
 } else {
  endDate = calDateUnits.makeCalendarDate(time[time.length - 1]).toDate();
 }
}
origin: Unidata/thredds

protected void setStartDate() {
 String datetime = ds.findAttValueIgnoreCase(null, "time_coverage_start", null);
 if (datetime != null) {
  startDate = CalendarDate.parseISOformat(null, datetime).toDate();
 } else {
  startDate = calDateUnits.makeCalendarDate(time[0]).toDate();
 }
}
origin: Unidata/thredds

public void testBig() {
 CalendarDateUnit cdu = CalendarDateUnit.of(null, "years since 1970-01-01");
 long val = 50*1000*1000;
 CalendarDate cd = cdu.makeCalendarDate(val);
 System.out.printf("%d %s == %s%n", val, cdu, CalendarDateFormatter.toDateTimeStringISO(cd));
 cdu = CalendarDateUnit.of(null, "calendar years since 1970-01-01");
 cd = cdu.makeCalendarDate(val);
 System.out.printf("%n%d %s == %s%n", val, cdu, CalendarDateFormatter.toDateTimeStringISO(cd));
}
origin: Unidata/thredds

private void testCoords(String unitP, boolean test) {
 String unit = unitP + " since 2008-02-29";
 CalendarDateUnit cdu = CalendarDateUnit.of(null, unit);
 for (int i=0; i<13; i++) {
  CalendarDate cd = cdu.makeCalendarDate(i);
  System.out.printf("%d %s == %s%n", i, cdu, CalendarDateFormatter.toDateTimeStringISO(cd));
  if (test) testDate(i + " "+ unit);
 }
 System.out.printf("%n");
}
origin: Unidata/thredds

@Test
public void testNemoDate() {
 for (Calendar cal : Calendar.values()) {
  CalendarDateUnit unit = CalendarDateUnit.withCalendar(cal, "days since -4713-01-01T00:00:00Z");
  CalendarDate cd1 = unit.makeCalendarDate(2434567);
  System.out.printf("%s with Calendar %s%n", cd1, cal);
 }
}
origin: Unidata/thredds

public CalendarDate[] getForecastInterval(Grib1SectionProductDefinition pds, Grib1ParamTime ptime) {
 CalendarPeriod period = GribUtils.getCalendarPeriod(pds.getTimeUnit());
 CalendarDateUnit unit = CalendarDateUnit.of(null, period.getField(), pds.getReferenceDate());
 int[] intv = ptime.getInterval();
 return new CalendarDate[]{
     unit.makeCalendarDate(period.getValue() * intv[0]),
     unit.makeCalendarDate(period.getValue() * intv[1])};
}
origin: Unidata/thredds

public CalendarDate getForecastDate(Grib1SectionProductDefinition pds, Grib1ParamTime ptime) {
 CalendarPeriod period = GribUtils.getCalendarPeriod(pds.getTimeUnit());
 CalendarDateUnit unit = CalendarDateUnit.of(null, period.getField(), pds.getReferenceDate());
 int timeCoord = ptime.getForecastTime();
 return unit.makeCalendarDate(period.getValue() * timeCoord);
}
origin: Unidata/thredds

static private void checkPointFeature(PointFeature pobs, CalendarDateUnit timeUnit) throws java.io.IOException {
 Assert.assertNotNull("PointFeature location", pobs.getLocation());
 Assert.assertNotNull("PointFeature time", pobs.getNominalTimeAsCalendarDate());
 Assert.assertNotNull("PointFeature dataAll", pobs.getDataAll());
 Assert.assertNotNull("PointFeature featureData", pobs.getFeatureData());
 Assert.assertEquals("PointFeature makeCalendarDate", timeUnit.makeCalendarDate(pobs.getObservationTime()), pobs.getObservationTimeAsCalendarDate());
 assert timeUnit.makeCalendarDate(pobs.getObservationTime()).equals(pobs.getObservationTimeAsCalendarDate());
 checkData( pobs.getDataAll());
}
ucar.nc2.timeCalendarDateUnitmakeCalendarDate

Popular methods of CalendarDateUnit

  • of
    Create a CalendarDateUnit from a calendar, a CalendarPeriod.Field, and a base date
  • withCalendar
    Create a CalendarDateUnit from a calendar and a udunit string = "unit since calendarDate"
  • getBaseCalendarDate
  • <init>
  • getCalendar
  • getCalendarField
  • getCalendarPeriod
  • getUdUnit
  • getBaseDate
  • makeOffsetFromRefDate
  • toString
  • toString

Popular in Java

  • Reactive rest calls using spring rest template
  • setScale (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getApplicationContext (Context)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Path (java.nio.file)
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now