Package org.esa.snap.core.util.math
Class RsMathUtils
java.lang.Object
org.esa.snap.core.util.math.RsMathUtils
A utility class providing a set of mathematical functions frequently used in the fields of remote sensing.
All functions have been implemented with extreme caution in order to provide a maximum performance.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleA constant used for the barometric formula - normalize to input in hPa.static final doubleA constant used for radian/degree conversions.static final doubleThe earth's gravity acceleration in m / s^2.static final floatThe constant in Koschmieder's Formula.static final doubleThe Earth's mean radius in meters.static final doubleA constant used for degree/radian conversions.static final doubleThe specific weight of air in kg / m^3 It's value is1.26895. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyGeodeticCorrection(GeoPos gp, double h, double vz, double va) Applies a geodetic correction to the given geographical coordinate.static floatelevationToZenith(float elevation) Converts an elevation angle to a zenith angle.static float[]elevationToZenith(float[] elevation, float[] recycle) Converts a vector of elevation angles to a vector of zenith angles.static floatkoschmieder(float visibility) Transforms horizontal visibility(km) to aerosol optical depth according to Koschmieder's formula.static floatkoschmiederInv(float opticalDepth) Transforms aerosol optical depth to horizontal visibility(km) according to Koschmieder's formula.static float[]radianceToReflectance(float[] rad, float[] sza, float e0, float[] recycle) Converts an array of radiance values to an array of reflectance values for given solar spectral flux and sun zenith angle.static floatradianceToReflectance(float rad, float sza, float e0) Converts a radiance value to a reflectance value for given solar spectral flux and sun zenith angle.static floatreflectanceToRadiance(float refl, float sza, float e0) Converts a reflectance value to a radiance value for given solar spectral flux and sun zenith angle.static float[]simpleBarometric(float[] seaPress, float[] height, float[] recycle) Calculates the air pressure in a given height given the sea level air pressure.static floatsimpleBarometric(float seaPress, float height) Calculates the air pressure in a given height given the sea level air pressure.static floatzenithToElevation(float zenith) Converts a zenith angle to an elevation angle.static float[]zenithToElevation(float[] zenith, float[] recycle) Converts a vector of zenith angles to a vector of elevation angles.
-
Field Details
-
SPEC_WEIGHT_AIR
public static final double SPEC_WEIGHT_AIRThe specific weight of air in kg / m^3 It's value is1.26895.- See Also:
-
GRAVITY_ACC
public static final double GRAVITY_ACCThe earth's gravity acceleration in m / s^2. It's value is9.80665.- See Also:
-
BAROMETRIC_CONST
public static final double BAROMETRIC_CONSTA constant used for the barometric formula - normalize to input in hPa. It's value isGRAVITY_ACC * SPEC_WEIGHT_AIR * 1e-2.- See Also:
-
KOSCHMIEDER_CONST
public static final float KOSCHMIEDER_CONSTThe constant in Koschmieder's Formula. It's value is3.92 * 2.- See Also:
-
RAD_PER_DEG
public static final double RAD_PER_DEGA constant used for degree/radian conversions. It's value isMath.PI / 180.0.- See Also:
-
DEG_PER_RAD
public static final double DEG_PER_RADA constant used for radian/degree conversions. It's value is180.0 / Math.PI.- See Also:
-
MEAN_EARTH_RADIUS
public static final double MEAN_EARTH_RADIUSThe Earth's mean radius in meters.- See Also:
-
-
Constructor Details
-
RsMathUtils
public RsMathUtils()
-
-
Method Details
-
reflectanceToRadiance
public static float reflectanceToRadiance(float refl, float sza, float e0) Converts a reflectance value to a radiance value for given solar spectral flux and sun zenith angle. This is the inverse ofradianceToReflectance.- Parameters:
refl- the reflectancesza- the sun zenith angle in decimal degreese0- the solar spectral flux in mW / (m^2 * sr * nm)- Returns:
- the corresponding radiance in mW /(m^2 * sr * nm)
-
radianceToReflectance
public static float radianceToReflectance(float rad, float sza, float e0) Converts a radiance value to a reflectance value for given solar spectral flux and sun zenith angle.- Parameters:
rad- the radiance in mW /(m^2 * sr * nm)sza- the sun zenith angle in decimal degreese0- the solar spectral flux in mW / (m^2 * sr * nm)- Returns:
- the corresponding reflectance
-
radianceToReflectance
public static float[] radianceToReflectance(float[] rad, float[] sza, float e0, float[] recycle) Converts an array of radiance values to an array of reflectance values for given solar spectral flux and sun zenith angle.If the
recycleparameter is of the same size as the radiance array, this array will be filled with the results and returned. The returned result may contain reflectances <0 or >1.The method performs no plausability check on the conversion.
- Parameters:
rad- the radiances in mW /(m^2 * sr * nm)sza- the sun zenith angle in decimal degreese0- the solar spectral fluxrecycle- optional array which will be filled with the results, can be null.- Returns:
- the array of corresponding reflectance
-
zenithToElevation
public static float zenithToElevation(float zenith) Converts a zenith angle to an elevation angle.- Parameters:
zenith- the zenith angle in decimal degrees
-
zenithToElevation
public static float[] zenithToElevation(float[] zenith, float[] recycle) Converts a vector of zenith angles to a vector of elevation angles. If recycle is notnulland has the same size as the zenith angle vector, recycle will be filled and returned to minimize the memory finmgerprint.- Parameters:
zenith- the zenith angle vector in decimal degreesrecycle- optional array which will be filled with the results. can be null.
-
elevationToZenith
public static float elevationToZenith(float elevation) Converts an elevation angle to a zenith angle. Convenience routine. Does the same as zenithToElevation but for code clarity ...- Parameters:
elevation- the lelevation angle in decimal degrees
-
elevationToZenith
public static float[] elevationToZenith(float[] elevation, float[] recycle) Converts a vector of elevation angles to a vector of zenith angles. If recycle is notnulland has the same size as the elevation angle vector, recycle will be filled and returned to minimize the memory fingerprint. Convenience routine. Does the same as zenithToElevation but for code clarity ...- Parameters:
elevation- a vector of elevation angles (in degree)recycle- optional array which will be filled with the results. can be null.
-
simpleBarometric
public static float simpleBarometric(float seaPress, float height) Calculates the air pressure in a given height given the sea level air pressure. Simple version with no dependency on temperature etc...- Parameters:
seaPress- the sea level air pressure in hPaheight- the height above sea level in m
-
simpleBarometric
public static float[] simpleBarometric(float[] seaPress, float[] height, float[] recycle) Calculates the air pressure in a given height given the sea level air pressure. Simple version with no dependency on temperature etc... This method processes on vectors. If recycle is notnulland has the same size as the sea pressure vector, recycle will be filled and returned to minimize the memory fingerprint.- Parameters:
seaPress- vector of sea level air pressure in hPaheight- vector of height above sea level in mrecycle- optional array which will be filled with the results. can be null.
-
koschmieder
public static float koschmieder(float visibility) Transforms horizontal visibility(km) to aerosol optical depth according to Koschmieder's formula.- Parameters:
visibility- horizontal visibility in km- Throws:
IllegalArgumentException- if the given parameter is 0.f
-
koschmiederInv
public static float koschmiederInv(float opticalDepth) Transforms aerosol optical depth to horizontal visibility(km) according to Koschmieder's formula.- Parameters:
opticalDepth- aerosol optical depth- Throws:
IllegalArgumentException- if the given parameter is 0.f
-
applyGeodeticCorrection
Applies a geodetic correction to the given geographical coordinate.The implementation assumes that the Earth is flat at the given coordinate point at elevetion zero and at the given elevation. Furthermore the earth is assumed to be a sphere with the fixed radius
MEAN_EARTH_RADIUS.- Parameters:
gp- the geographical coordinate to be corrected and which will be correctedh- elevation above the Earth's sphere or ellipsoid surface in metersvz- satellite viewing zenith angle in degreeva- satellite viewing azimuth angle in degree
-