@Immutable
public class CalendarDateUnit
extends java.lang.Object
UNIT since [-]Y[Y[Y[Y]]]-MM-DD[(T| )hh[:mm[:ss[.sss*]]][ [+|-]hh[[:]mm]]] UNIT = "msecs" | "msec" | "seconds" | "second" | "secs" | "sec" | "s" | "minutes" | "minute" | "mins" | "min" | "hours" | "hour" | "hrs" | "hr" | "h" | "days" | "day" | "d""months since base_date by calendar field" "years since base_date by calendar field" bob simon's proposal: "calendar_month since base_date" "calendar_year since base_date" * only integer values are allowed (?) jon blowers comment: In your view would the solution to add "by calendar field" to the existing udunits string be acceptable? It’s backward-compatible with the current interpretation and adds clarification for the cases in which we *do* want to do calendar-field arithmetic (instead of adding fixed intervals). There’s an alternative proposition, in which the new units of calendar_month and calendar_year are added, with the same semantic effect. (However, personally I like the "by calendar field" solution since it allows other fields to vary between calendars, e.g. because of leap-seconds.)
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
udunitPatternString |
static CalendarDateUnit |
unixDateUnit |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
CalendarDate |
getBaseCalendarDate() |
Calendar |
getCalendar() |
CalendarPeriod.Field |
getCalendarField() |
CalendarPeriod |
getCalendarPeriod() |
java.lang.String |
getUdUnit() |
int |
hashCode() |
boolean |
isCalendarField() |
CalendarDate |
makeCalendarDate(double value) |
CalendarDate |
makeCalendarDate(int value) |
double |
makeOffsetFromRefDate(CalendarDate date) |
static CalendarDateUnit |
of(Calendar calt,
CalendarPeriod.Field periodField,
CalendarDate baseDate)
Create a CalendarDateUnit from a calendar, a CalendarPeriod.Field, and a base date
|
static CalendarDateUnit |
of(java.lang.String calendarName,
java.lang.String udunitString)
Create a CalendarDateUnit from a calendar name and a udunit string = "unit since calendarDate"
|
java.lang.String |
toString() |
static CalendarDateUnit |
withCalendar(Calendar calt,
java.lang.String udunitString)
Create a CalendarDateUnit from a calendar and a udunit string = "unit since calendarDate"
|
public static final java.lang.String udunitPatternString
public static final CalendarDateUnit unixDateUnit
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public CalendarDate getBaseCalendarDate()
public Calendar getCalendar()
public CalendarPeriod.Field getCalendarField()
public CalendarPeriod getCalendarPeriod()
public java.lang.String getUdUnit()
public int hashCode()
hashCode
in class java.lang.Object
public boolean isCalendarField()
public CalendarDate makeCalendarDate(double value)
public CalendarDate makeCalendarDate(int value)
public double makeOffsetFromRefDate(CalendarDate date)
public static CalendarDateUnit of(Calendar calt, CalendarPeriod.Field periodField, CalendarDate baseDate)
calt
- use this Calendar, or null for default calendarperiodField
- a CalendarPeriod.Field like Hour or secondbaseDate
- "since baseDate"public static CalendarDateUnit of(java.lang.String calendarName, java.lang.String udunitString)
calendarName
- must match a calendar enum, or one of its aliases, see ucar.nc2.time.Calendar.get()udunitString
- "unit since calendarDate"java.lang.IllegalArgumentException
- if udunitString is not paresablepublic java.lang.String toString()
toString
in class java.lang.Object
public static CalendarDateUnit withCalendar(Calendar calt, java.lang.String udunitString)
calt
- use this Calendar, or null for default calendarudunitString
- "unit since calendarDate"java.lang.IllegalArgumentException
- if udunitString is not paresable