org.das2.datum.Units
Class for indicating physical units, and other random units.
dimensionless
radians
degrees
deg
degrees2
rgbColor
celciusDegrees
fahrenheitDegrees
years
days
hours
minutes
seconds
seconds2
milliseconds
milliseconds2
microseconds
microseconds2
microseconds3
nanoseconds
ns
picoseconds
bytesPerSecond
kiloBytesPerSecond
bytes
kiloBytes
hertz
kiloHertz
megaHertz
gigaHertz
eV
ev
keV
MeV
pcm3
1 / cm3
kelvin
cm_2s_1keV_1
cm_2s_1MeV_1
v2pm2Hz
Volts 2 m-2 Hz-1
wpm2
Watts / m2
meters
millimeters
centimeters
kiloMeters
inches
typographicPoints
nT
cmps
mps
centigrade
begin of LocationUnits. These must be defined after the physical units to support Basis.
fahrenheitScale
dollars
currencies for demonstration purposes.
euros
yen
rupee
us2000
Microseconds since midnight Jan 1, 2000, excluding those within a leap second. Differences across leap
second boundaries do not represent the number of microseconds elapsed.
us1980
Microseconds since midnight Jan 1, 1980, excluding those within a leap second.
t2010
Seconds since midnight Jan 1, 2010, excluding leap seconds.
t2000
Seconds since midnight Jan 1, 2000, excluding leap seconds.
t1970
seconds since midnight Jan 1, 1970, excluding leap seconds.
ms1970
milliseconds since midnight Jan 1, 1970, excluding leap seconds.
mj1958
roughly days since on midnight on 1958-01-01, Julian - 2436204.5 to be more precise.
mjd
The Modified Julian Day (MJD) is the number of days (with decimal fraction of the day) that have elapsed since midnight at the beginning of Wednesday November 17, 1858.
Julian - 2400000.5
julianDay
The Julian Day (MJD) is the number of days (with decimal fraction of the day) that have elapsed since noon on January 1, 4713 BCE.
Julian - 2400000.5
cdfEpoch
cdf epoch milliseconds since midnight, 01-Jan-0000, excluding those with a leap second. There must be skipped days, because this doesn't yield 01-Jan-0000 for 0.,
but works fine at 1-1-2000., excluding those within a leap second
cdfTT2000
the number of nanoseconds since 01-Jan-2000T12:00, roughly. This includes leap seconds, so conversion is more than a scale,offset.
decimalYear
the year plus the fraction into the current year, ((doy-1)/365) for non-leap years.
percent
ratiometric units
dB
Define a set of units to describe ratiometric (logarithmic) spacing. Note that Units.percent
is no longer the defacto ratiometric spacing, and Units.percentIncrease takes its place.
Note the log10Ratio is the preferred method for expressing spacing, but all are convertible
See logERatio, log10Ratio and google for "fold change."
ampRatio
percentIncrease
log10Ratio
logERatio
convertDoubleTo
convertDoubleTo( Units toUnits, double value ) → double
convert the double in this units' space to toUnits' space.
Parameters
toUnits - the units.
value - the value in toUnits.
Returns:
the double in the new units system.
search for examples
view on GitHub
view source
createDatum
createDatum( double value ) → Datum
Returns:
org.das2.datum.Datum
search for examples
view on GitHub
view source
getAllUnits
getAllUnits( ) → List
return all the known units.
Returns:
list of all the known units.
search for examples
view on GitHub
view source
getCanonicalUnit
getCanonicalUnit( Units units ) → Units
return the preferred unit to use when there are multiple representations
of the same unit (having conversion UnitsConverter.IDENTITY.
Parameters
units -
Returns:
the preferred unit
search for examples
view on GitHub
view source
getConvertableUnits
Deprecated: use getConvertibleUnits, which is spelled correctly.
getConverter
getConverter( Units fromUnits, Units toUnits ) → UnitsConverter
lookup the UnitsConverter object that takes numbers from fromUnits to toUnits.
This will chain together UnitsConverters registered via units.registerConverter.
Parameters
fromUnits - units instance that is the source units.
toUnits - units instance that is the target units.
Returns:
UnitsConverter object
search for examples
view on GitHub
view source
getConvertibleUnits
getConvertibleUnits( ) → Units
return the units to which this unit is convertible.
Returns:
the units to which this unit is convertible.
search for examples
view on GitHub
view source
getDatumFormatterFactory
getDatumFormatterFactory( ) → DatumFormatterFactory
Returns:
org.das2.datum.format.DatumFormatterFactory
search for examples
view on GitHub
view source
getFillDatum
getFillDatum( ) → Datum
Returns:
org.das2.datum.Datum
search for examples
view on GitHub
view source
getFillDouble
getFillDouble( ) → double
Returns:
double
search for examples
view on GitHub
view source
grannyFormat
grannyFormat( Datum datum ) → String
Returns:
java.lang.String
search for examples
view on GitHub
view source
isConvertableTo
Deprecated: use isConvertibleTo (which does not contain spelling error)
isConvertibleTo
isConvertibleTo( Units toUnits ) → boolean
return true if the unit can be converted to toUnits.
Parameters
toUnits - Units object.
Returns:
true if the unit can be converted to toUnits.
search for examples
view on GitHub
view source
isValid
isValid( double value ) → boolean
test if the double represents a valid datum in the context of this unit.
Note slight differences in implementation may cause isFill and isValid
to produce inconsistent results. For example, this code checks for NaNs
whereas isFill does not.
Parameters
value - the value to check.
Returns:
true if the data is not fill and not NaN.
search for examples
view on GitHub
view source
registerConverter
registerConverter( Units toUnits, org.das2.datum.UnitsConverter converter ) → void
register a converter between the units. Note these converters can be
changed together to derive conversions. (A to B, B to C defines A to C.)
Parameters
toUnits - the target units
converter - the converter that goes from this unit to target units.
Returns:
void (returns nothing)
search for examples
view on GitHub
view source