/** * Constructor using a java.util.Date * * @param isPresent if true, this represents the "present time" * @param date the given Date */ public DateType(boolean isPresent, java.util.Date date) { this.isPresent = isPresent; this.date = isPresent ? null : CalendarDate.of(date); }
@Override public String toString() { return "Partition{" + "dcm=" + dcm + ", name='" + name + '\'' + ", directory='" + directory + '\'' + ", filename='" + filename + '\'' + ", partitionDate='" + partitionDate + '\'' + ", lastModified='" + CalendarDate.of(lastModified) + '\'' + '}'; }
/** * return record header time as a CalendarDate * * @return referenceTime */ public final CalendarDate getReferenceTime() { int sec = (second < 0 || second > 59) ? 0 : second; return CalendarDate.of(null, year, month, day, hour, minute, sec); }
/** * reference reference or base time as Dare. * * @return baseTime */ public CalendarDate getReferenceDate() { return CalendarDate.of(null, year, month, day, hour, minute, second); }
@Override public String toString() { return "Partition{ " + name + '\'' + // ", directory='" + directory + '\'' + ", filename='" + filename + '\'' + ", partitionDate='" + partitionDate + '\'' + ", lastModified='" + CalendarDate.of(lastModified) + '\'' + ", fileSize='" + fileSize + '\'' + '}'; }
public static void main(String[] args) { CalendarDate start = CalendarDate.of(1269820799000L); CalendarDate end = CalendarDate.of(1269824399000L); TinvDate tinvDate = new TinvDate(start, end); System.out.printf("tinvDate = %s%n", tinvDate); CalendarDate refDate = CalendarDate.of(1269820800000L); CalendarPeriod timeUnit = CalendarPeriod.of("Hour"); Tinv tinv = tinvDate.convertReferenceDate(refDate, timeUnit); System.out.printf("tinv = %s offset from %s%n", tinv, refDate); }
@Override public CalendarDate getCalendarDate(MFile mfile) { Date d = getDate(mfile); return (d == null) ? null : CalendarDate.of(d); }
/** * Does not handle non-standard Calendars * @deprecated use findTimeIndexFromCalendarDate */ public int findTimeIndexFromDate(java.util.Date d) { return findTimeIndexFromCalendarDate( CalendarDate.of(d)); }
/** * Is this date before the given date. if isPresent, always false. * * @param d test against this date * @return true if this date before the given date */ public boolean before(Date d) { if (isPresent()) return false; return date.isBefore(CalendarDate.of(d)); }
public CalendarDateRange intersect(CalendarDateRange clip) { DateTime cs = clip.getStart().getDateTime(); DateTime s = startDt.isBefore(cs) ? cs : startDt; // later one DateTime ce = clip.getEnd().getDateTime(); DateTime e = endDt.isBefore(ce) ? endDt : ce; // earlier one return CalendarDateRange.of(CalendarDate.of(cal, s), CalendarDate.of(cal, e)); }
/** * Is this date after the given date. if isPresent, always true. * * @param d test against this date * @return true if this date after the given date */ public boolean after(Date d) { if (isPresent()) return true; return date.isAfter(CalendarDate.of(d)); }
public CalendarDateRange extend(CalendarDateRange other) { DateTime cs = other.getStart().getDateTime(); DateTime s = startDt.isBefore(cs) ? startDt : cs; // earlier one DateTime ce = other.getEnd().getDateTime(); DateTime e = endDt.isBefore(ce) ? ce : endDt; // later one return CalendarDateRange.of(CalendarDate.of(cal, s), CalendarDate.of(cal, e)); }
public CalendarDate getDate(String name) { Date d = null; if (useName) d = DateFromString.getDateUsingDemarkatedCount(name, dateFormatMark, '#'); else d = DateFromString.getDateUsingDemarkatedMatch(name, dateFormatMark, '#'); return (d == null) ? null : CalendarDate.of(d); }
public CalendarDateRange intersect(CalendarDateRange clip) { DateTime cs = clip.getStart().getDateTime(); DateTime s = startDt.isBefore(cs) ? cs : startDt; // later one DateTime ce = clip.getEnd().getDateTime(); DateTime e = endDt.isBefore(ce) ? endDt : ce; // earlier one return CalendarDateRange.of(CalendarDate.of(cal, s), CalendarDate.of(cal, e)); }
public CalendarDateRange extend(CalendarDateRange other) { DateTime cs = other.getStart().getDateTime(); DateTime s = startDt.isBefore(cs) ? startDt : cs; // earlier one DateTime ce = other.getEnd().getDateTime(); DateTime e = endDt.isBefore(ce) ? ce : endDt; // later one return CalendarDateRange.of(CalendarDate.of(cal, s), CalendarDate.of(cal, e)); }
/** * Is this date before the given date. if isPresent, always false. * * @param d test against this date * @return true if this date before the given date */ public boolean before(Date d) { if (isPresent()) return false; return date.isBefore(CalendarDate.of(d)); }
private BufrStationDataset(NetcdfDataset ncfile, BufrCdmIndex index) { super(ncfile, FeatureType.STATION); this.index = index; // create the list of data variables munger = new Munge(); obs = (SequenceDS) ncfile.findVariable(BufrIosp2.obsRecord); this.dataVariables = munger.makeDataVariables(index, obs); BufrStationCollection bufrCollection = new BufrStationCollection(ncfile.getLocation()); setPointFeatureCollection(bufrCollection); CalendarDateRange dateRange = CalendarDateRange.of(CalendarDate.of(index.start), CalendarDate.of(index.end)); setDateRange(dateRange); }
@Test public void testBase() throws Exception { Date base = getBase(datestring); CalendarDateUnit cdu = CalendarDateUnit.of(calendar, datestring); Assert.assertEquals("Difference (ms): " + (base.getTime() - cdu.getBaseDate().getTime()), cdu.getBaseDate(), base); Assert.assertEquals("Difference (ms): " + (CalendarDate.of(base).getMillis() - cdu.getBaseCalendarDate().getMillis()), cdu.getBaseCalendarDate(), CalendarDate.of(base)); }
private void addNetcdf3UnknownAtts(boolean noTimeCoverage) { // dummy values, update in finish() if (!noTimeCoverage) { CalendarDate now = CalendarDate.of(new Date()); writer.addGroupAttribute(null, new Attribute(ACDD.TIME_START, CalendarDateFormatter.toDateTimeStringISO(now))); writer.addGroupAttribute(null, new Attribute(ACDD.TIME_END, CalendarDateFormatter.toDateTimeStringISO(now))); } writer.addGroupAttribute(null, new Attribute(ACDD.LAT_MIN, 0.0)); writer.addGroupAttribute(null, new Attribute(ACDD.LAT_MAX, 0.0)); writer.addGroupAttribute(null, new Attribute(ACDD.LON_MIN, 0.0)); writer.addGroupAttribute(null, new Attribute(ACDD.LON_MAX, 0.0)); }
private void addNetcdf3UnknownAtts(boolean noTimeCoverage) { // dummy values, update in finish() if (!noTimeCoverage) { CalendarDate now = CalendarDate.of(new Date()); writer.addGroupAttribute(null, new Attribute(ACDD.TIME_START, CalendarDateFormatter.toDateTimeStringISO(now))); writer.addGroupAttribute(null, new Attribute(ACDD.TIME_END, CalendarDateFormatter.toDateTimeStringISO(now))); } writer.addGroupAttribute(null, new Attribute(ACDD.LAT_MIN, 0.0)); writer.addGroupAttribute(null, new Attribute(ACDD.LAT_MAX, 0.0)); writer.addGroupAttribute(null, new Attribute(ACDD.LON_MIN, 0.0)); writer.addGroupAttribute(null, new Attribute(ACDD.LON_MAX, 0.0)); }