Package org.esa.snap.core.datamodel
Class ProductData.UTC
java.lang.Object
org.esa.snap.core.datamodel.ProductData
org.esa.snap.core.datamodel.ProductData.Int
org.esa.snap.core.datamodel.ProductData.UInt
org.esa.snap.core.datamodel.ProductData.UTC
- All Implemented Interfaces:
Cloneable
- Enclosing class:
ProductData
The
ProductData.UTC class is a ProductData.UInt specialisation for UTC date/time
values.
Internally, data is stored in an int[3] array which represents a Modified Julian Day 2000
(MJD) as a days, a seconds and a micro-seconds fraction.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.esa.snap.core.datamodel.ProductData
ProductData.ASCII, ProductData.Byte, ProductData.Double, ProductData.Float, ProductData.Int, ProductData.Long, ProductData.Short, ProductData.UByte, ProductData.UInt, ProductData.UShort, ProductData.UTC -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default pattern used to format date strings.static final TimeZoneThe default UTC time zone used by this class.Fields inherited from class org.esa.snap.core.datamodel.ProductData.Int
_arrayFields inherited from class org.esa.snap.core.datamodel.ProductData
TYPE_ASCII, TYPE_FLOAT32, TYPE_FLOAT64, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, TYPE_UNDEFINED, TYPE_UTC, TYPESTRING_ASCII, TYPESTRING_FLOAT32, TYPESTRING_FLOAT64, TYPESTRING_INT16, TYPESTRING_INT32, TYPESTRING_INT64, TYPESTRING_INT8, TYPESTRING_UINT16, TYPESTRING_UINT32, TYPESTRING_UINT64, TYPESTRING_UINT8, TYPESTRING_UTC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ProductData.UTCCreates a new UTC instance based on the given time and microseconds fraction.static CalendarGets the MJD 2000 calendar on which this UTC date/time is based.static DateFormatCreates the MJD 2000 date format used to parse and format.static DateFormatcreateDateFormat(String pattern) Creates a date format using the given pattern.protected ProductDataRetuns a "deep" copy of this product data.format()Formats this UTC date/time value as a string using the formatDATE_FORMAT_PATTERNand the default MJD 2000 calendar.Gets the MJD 2000 calendar on which this UTC date/time is based.Returns this UTC date/time value as a Date.intReturns the days fraction of the Modified Julian Day (MJD) as a signed integer (the 1st element of the internal data array).Returns this UTC date/time value as a string using the formatDATE_FORMAT_PATTERN.longReturns the micro-seconds fraction of the Modified Julian Day (MJD) as a signed integer (the 3rd element of the internal data array).doublegetMJD()Returns the Modified Julian Day 2000 (MJD2000) represented by this UTC value as double value.longReturns the seconds fraction of the Modified Julian Day (MJD) as a signed integer (the 2nd element of the internal data array).Returns this value's data type String.static ProductData.UTCParses a UTC value given as text in MJD 2000 format.static ProductData.UTCParses a UTC value given as text.static ProductData.UTCparse(String text, DateFormat dateFormat) Parses a UTC value given as text.Methods inherited from class org.esa.snap.core.datamodel.ProductData.UInt
getElemDoubleAt, getElemFloatAt, getElemIntAt, getElemStringAt, getElemUIntAt, setElemsMethods inherited from class org.esa.snap.core.datamodel.ProductData.Int
dispose, getArray, getElemLongAt, getElems, getNumElems, readFrom, setElemDoubleAt, setElemFloatAt, setElemIntAt, setElemLongAt, setElemUIntAt, writeToMethods inherited from class org.esa.snap.core.datamodel.ProductData
createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createUnsignedInstance, createUnsignedInstance, createUnsignedInstance, equalElems, equals, getElemBoolean, getElemBooleanAt, getElemDouble, getElemFloat, getElemInt, getElemLong, getElemSize, getElemSize, getElemUInt, getType, getType, getTypeString, hashCode, isFloatingPointType, isInt, isIntType, isScalar, isSigned, isUIntType, isUnsigned, readFrom, readFrom, readFrom, setElemBoolean, setElemBooleanAt, setElemDouble, setElemFloat, setElemInt, setElemLong, setElemString, setElemStringAt, setElemUInt, toString, writeTo, writeTo, writeTo
-
Field Details
-
UTC_TIME_ZONE
The default UTC time zone used by this class. -
DATE_FORMAT_PATTERN
The default pattern used to format date strings.- See Also:
-
-
Constructor Details
-
UTC
public UTC()Constructs a newUTCvalue. -
UTC
public UTC(int[] elems) Constructs a MJD2000 date instance.- Parameters:
elems- an array containg at least the three elements{days, seconds, microSeconds}
-
UTC
public UTC(int days, int seconds, int microSeconds) Constructs a MJD2000 date instance.- Parameters:
days- the number of days since 2000-01-01 00:00seconds- the seconds fraction of the number of daysmicroSeconds- the microseconds fraction of the number of days
-
UTC
public UTC(double mjd) Constructs a MJD2000 date instance.- Parameters:
mjd- the Modified Julian Day 2000 (MJD2000) as double value- See Also:
-
-
Method Details
-
create
Creates a new UTC instance based on the given time and microseconds fraction.- Parameters:
date- the UTC timemicros- the microseconds fraction- Returns:
- a new UTC instance
-
createCalendar
Gets the MJD 2000 calendar on which this UTC date/time is based. The date is initially set the 1st January 2000, 0:00.- Returns:
- the MJD 2000 calendar
- See Also:
-
createDateFormat
Creates the MJD 2000 date format used to parse and format. The method returnscreateDateFormat(String)withDATE_FORMAT_PATTERN.- Returns:
- a MJD 2000 date/time format
-
createDateFormat
Creates a date format using the given pattern. The date format returned, will use the english locale ('en') and a calendar returned by thecreateCalendar()method.- Parameters:
pattern- the data format pattern- Returns:
- a date format
- See Also:
-
parse
Parses a UTC value given as text in MJD 2000 format. The method returnsparse(String, String)usingDATE_FORMAT_PATTERNas pattern.- Parameters:
text- a UTC value given as text- Returns:
- the UTC value represented by the given text
- Throws:
ParseException- thrown if the text could not be parsed- See Also:
-
parse
Parses a UTC value given as text. The method also considers an optional mircoseconds fraction at the end of the text string. The mircoseconds fraction is a dot '.' followed by a maximum of 6 digits.- Parameters:
text- a UTC value given as textpattern- the date/time pattern- Returns:
- the UTC value represented by the given text
- Throws:
ParseException- thrown if the text could not be parsed- See Also:
-
parse
Parses a UTC value given as text. The method also considers an optional mircoseconds fraction at the end of the text string. The mircoseconds fraction is a dot '.' followed by a maximum of 6 digits.- Parameters:
text- a UTC value given as textdateFormat- the date/time pattern- Returns:
- the UTC value represented by the given text
- Throws:
ParseException- thrown if the text could not be parsed- See Also:
-
format
Formats this UTC date/time value as a string using the formatDATE_FORMAT_PATTERNand the default MJD 2000 calendar.- Returns:
- a formated UTC date/time string
- See Also:
-
getElemString
Returns this UTC date/time value as a string using the formatDATE_FORMAT_PATTERN. Simply callsformat().- Overrides:
getElemStringin classProductData- Returns:
- a text representing this fields value, never
null
-
createDeepClone
Retuns a "deep" copy of this product data.- Overrides:
createDeepClonein classProductData.UInt- Returns:
- a copy of this product data
-
getTypeString
Returns this value's data type String.- Overrides:
getTypeStringin classProductData
-
getAsCalendar
Gets the MJD 2000 calendar on which this UTC date/time is based. The date of the calendar is set to this UTC value.- Returns:
- the MJD 2000 calendar
- See Also:
-
getAsDate
Returns this UTC date/time value as a Date. The method interpretes this UTC value as a MJD 2000 date (Modified Julian Day where the first day is the 01.01.2000).- See Also:
-
getMJD
public double getMJD()Returns the Modified Julian Day 2000 (MJD2000) represented by this UTC value as double value.- Returns:
- this UTC value computed as days
-
getDaysFraction
public int getDaysFraction()Returns the days fraction of the Modified Julian Day (MJD) as a signed integer (the 1st element of the internal data array).- Returns:
- This UTC's days fraction.
- See Also:
-
getSecondsFraction
public long getSecondsFraction()Returns the seconds fraction of the Modified Julian Day (MJD) as a signed integer (the 2nd element of the internal data array).- Returns:
- This UTC's seconds fraction.
- See Also:
-
getMicroSecondsFraction
public long getMicroSecondsFraction()Returns the micro-seconds fraction of the Modified Julian Day (MJD) as a signed integer (the 3rd element of the internal data array).- Returns:
- This UTC's micro-seconds fraction.
- See Also:
-