Class PotentialCoefficientsReader
- java.lang.Object
-
- org.orekit.forces.gravity.potential.PotentialCoefficientsReader
-
- All Implemented Interfaces:
DataLoader
- Direct Known Subclasses:
EGMFormatReader
,GRGSFormatReader
,ICGEMFormatReader
,PythonPotentialCoefficientsReader
,SHMFormatReader
public abstract class PotentialCoefficientsReader extends Object implements DataLoader
This abstract class represents a Gravitational Potential Coefficients file reader.As it exits many different coefficients models and containers this interface represents all the methods that should be implemented by a reader. The proper way to use this interface is to call the
GravityFieldFactory
which will determine which reader to use with the selected potential coefficients file.- Author:
- Fabien Maussion
- See Also:
GravityFields
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PotentialCoefficientsReader(String supportedNames, boolean missingCoefficientsAllowed)
Simple constructor.protected
PotentialCoefficientsReader(String supportedNames, boolean missingCoefficientsAllowed, TimeScale timeScale)
Simple constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static double[]
buildFlatArray(org.orekit.forces.gravity.potential.Flattener flattener, double value)
Build a coefficients array in flat form.protected static double[]
buildRow(int degree, int order, double value)
Build a coefficients row.protected static double[][]
buildTriangularArray(int degree, int order, double value)
Deprecated.as of 11.1, replaced bybuildFlatArray(Flattener, double)
protected void
extendListOfLists(List<List<Double>> list, int degree, int order, double value)
Deprecated.as of 11.1, not used anymoreprotected double
getAe()
Get the central body reference radius.protected org.orekit.forces.gravity.potential.ConstantSphericalHarmonics
getBaseProvider(boolean wantNormalized, int degree, int order)
Get a time-independent provider containing base harmonics coefficients.protected org.orekit.forces.gravity.potential.ConstantSphericalHarmonics
getConstantProvider(boolean wantNormalized, int degree, int order)
Deprecated.as of 11.1, not used anymoreint
getMaxAvailableDegree()
Get the maximal degree available in the last file parsed.int
getMaxAvailableOrder()
Get the maximal order available in the last file parsed.int
getMaxParseDegree()
Get the degree limit for the next file parsing.int
getMaxParseOrder()
Get the order limit for the next file parsing.protected double
getMu()
Get the central body attraction coefficient.abstract RawSphericalHarmonicsProvider
getProvider(boolean wantNormalized, int degree, int order)
Get a provider for read spherical harmonics coefficients.String
getSupportedNames()
Get the regular expression for supported files names.protected TideSystem
getTideSystem()
Get theTideSystem
used in the gravity field.abstract void
loadData(InputStream input, String name)
Load data from a stream.boolean
missingCoefficientsAllowed()
Check if missing coefficients are allowed in the input data.protected void
parseCoefficient(String field, double[][] array, int i, int j, String cName, String name)
Deprecated.as of 11.1, replaced byparseCoefficient(String, Flattener, double[], int, int, String, String)
protected void
parseCoefficient(String field, List<List<Double>> list, int i, int j, String cName, String name)
Deprecated.as of 11.1, replaced byparseCoefficient(String, Flattener, double[], int, int, String, String)
protected void
parseCoefficient(String field, org.orekit.forces.gravity.potential.Flattener f, double[] array, int i, int j, String cName, String name)
Parse a coefficient.protected static double
parseDouble(String string)
Parse a double from a string.protected org.orekit.forces.gravity.potential.TimeDependentHarmonic[]
rescale(boolean wantNormalized, org.orekit.forces.gravity.potential.Flattener rescaledFlattener, org.orekit.forces.gravity.potential.Flattener originalFlattener, org.orekit.forces.gravity.potential.TimeDependentHarmonic[] original)
Rescale coefficients arrays.protected static void
rescale(double scale, boolean normalizedOrigin, double[][] originC, double[][] originS, boolean wantNormalized, double[][] rescaledC, double[][] rescaledS)
Deprecated.as of 11.1, replaced byrescale(double, boolean, Flattener, Flattener, double[])
protected double[]
rescale(double scale, boolean wantNormalized, org.orekit.forces.gravity.potential.Flattener rescaledFlattener, org.orekit.forces.gravity.potential.Flattener originalFlattener, double[] original)
Rescale coefficients arrays.protected void
setAe(double ae)
Set the central body reference radius.void
setMaxParseDegree(int maxParseDegree)
Set the degree limit for the next file parsing.void
setMaxParseOrder(int maxParseOrder)
Set the order limit for the next file parsing.protected void
setMu(double mu)
Set the central body attraction coefficient.protected void
setRawCoefficients(boolean rawNormalized, double[][] c, double[][] s, String name)
Deprecated.as of 11.1, replaced bysetRawCoefficients(boolean, Flattener, double[], double[], String)
protected void
setRawCoefficients(boolean rawNormalized, org.orekit.forces.gravity.potential.Flattener f, double[] c, double[] s, String name)
Set the tesseral-sectorial coefficients matrix.protected void
setReadComplete(boolean readComplete)
Set the indicator for completed read.protected void
setTideSystem(TideSystem tideSystem)
Set theTideSystem
used in the gravity field.boolean
stillAcceptsData()
Check if the loader still accepts new data.protected double[][]
toArray(List<List<Double>> list)
Deprecated.as of 11.1, not used anymoreprotected AbsoluteDate
toDate(DateComponents components)
Create a date from components.protected AbsoluteDate
toDate(DateComponents dc, TimeComponents tc)
Create a date from components.
-
-
-
Constructor Detail
-
PotentialCoefficientsReader
@DefaultDataContext protected PotentialCoefficientsReader(String supportedNames, boolean missingCoefficientsAllowed)
Simple constructor.Build an uninitialized reader.
This constructor uses the
default data context
.- Parameters:
supportedNames
- regular expression for supported files namesmissingCoefficientsAllowed
- allow missing coefficients in the input data- See Also:
PotentialCoefficientsReader(String, boolean, TimeScale)
-
PotentialCoefficientsReader
protected PotentialCoefficientsReader(String supportedNames, boolean missingCoefficientsAllowed, TimeScale timeScale)
Simple constructor.Build an uninitialized reader.
- Parameters:
supportedNames
- regular expression for supported files namesmissingCoefficientsAllowed
- allow missing coefficients in the input datatimeScale
- to use when parsing dates.- Since:
- 10.1
-
-
Method Detail
-
getSupportedNames
public String getSupportedNames()
Get the regular expression for supported files names.- Returns:
- regular expression for supported files names
-
missingCoefficientsAllowed
public boolean missingCoefficientsAllowed()
Check if missing coefficients are allowed in the input data.- Returns:
- true if missing coefficients are allowed in the input data
-
setMaxParseDegree
public void setMaxParseDegree(int maxParseDegree)
Set the degree limit for the next file parsing.- Parameters:
maxParseDegree
- maximal degree to parse (may be safely set toInteger.MAX_VALUE
to parse all available coefficients)- Since:
- 6.0
-
getMaxParseDegree
public int getMaxParseDegree()
Get the degree limit for the next file parsing.- Returns:
- degree limit for the next file parsing
- Since:
- 6.0
-
setMaxParseOrder
public void setMaxParseOrder(int maxParseOrder)
Set the order limit for the next file parsing.- Parameters:
maxParseOrder
- maximal order to parse (may be safely set toInteger.MAX_VALUE
to parse all available coefficients)- Since:
- 6.0
-
getMaxParseOrder
public int getMaxParseOrder()
Get the order limit for the next file parsing.- Returns:
- order limit for the next file parsing
- Since:
- 6.0
-
stillAcceptsData
public boolean stillAcceptsData()
Check if the loader still accepts new data.This method is used to speed up data loading by interrupting crawling the data sets as soon as a loader has found the data it was waiting for. For loaders that can merge data from any number of sources (for example JPL ephemerides or Earth Orientation Parameters that are split among several files), this method should always return true to make sure no data is left over.
- Specified by:
stillAcceptsData
in interfaceDataLoader
- Returns:
- true while the loader still accepts new data
-
setReadComplete
protected void setReadComplete(boolean readComplete)
Set the indicator for completed read.- Parameters:
readComplete
- if true, a gravity field has been completely read
-
setAe
protected void setAe(double ae)
Set the central body reference radius.- Parameters:
ae
- central body reference radius
-
getAe
protected double getAe()
Get the central body reference radius.- Returns:
- central body reference radius
-
setMu
protected void setMu(double mu)
Set the central body attraction coefficient.- Parameters:
mu
- central body attraction coefficient
-
getMu
protected double getMu()
Get the central body attraction coefficient.- Returns:
- central body attraction coefficient
-
setTideSystem
protected void setTideSystem(TideSystem tideSystem)
Set theTideSystem
used in the gravity field.- Parameters:
tideSystem
- tide system used in the gravity field
-
getTideSystem
protected TideSystem getTideSystem()
Get theTideSystem
used in the gravity field.- Returns:
- tide system used in the gravity field
-
setRawCoefficients
@Deprecated protected void setRawCoefficients(boolean rawNormalized, double[][] c, double[][] s, String name)
Deprecated.as of 11.1, replaced bysetRawCoefficients(boolean, Flattener, double[], double[], String)
Set the tesseral-sectorial coefficients matrix.- Parameters:
rawNormalized
- if true, raw coefficients are normalizedc
- raw tesseral-sectorial coefficients matrixs
- raw tesseral-sectorial coefficients matrixname
- name of the file (or zip entry)
-
setRawCoefficients
protected void setRawCoefficients(boolean rawNormalized, org.orekit.forces.gravity.potential.Flattener f, double[] c, double[] s, String name)
Set the tesseral-sectorial coefficients matrix.- Parameters:
rawNormalized
- if true, raw coefficients are normalizedf
- converter from triangular to flat formc
- raw tesseral-sectorial coefficients matrixs
- raw tesseral-sectorial coefficients matrixname
- name of the file (or zip entry)- Since:
- 11.1
-
getMaxAvailableDegree
public int getMaxAvailableDegree()
Get the maximal degree available in the last file parsed.- Returns:
- maximal degree available in the last file parsed
- Since:
- 6.0
-
getMaxAvailableOrder
public int getMaxAvailableOrder()
Get the maximal order available in the last file parsed.- Returns:
- maximal order available in the last file parsed
- Since:
- 6.0
-
loadData
public abstract void loadData(InputStream input, String name) throws IOException, ParseException, OrekitException
Load data from a stream.- Specified by:
loadData
in interfaceDataLoader
- Parameters:
input
- data input streamname
- name of the file (or zip entry)- Throws:
IOException
- if data can't be readParseException
- if data can't be parsed or if some loader specific error occursOrekitException
-
getProvider
public abstract RawSphericalHarmonicsProvider getProvider(boolean wantNormalized, int degree, int order)
Get a provider for read spherical harmonics coefficients.- Parameters:
wantNormalized
- if true, the provider will provide normalized coefficients, otherwise it will provide un-normalized coefficientsdegree
- maximal degreeorder
- maximal order- Returns:
- a new provider
- Since:
- 6.0
- See Also:
getConstantProvider(boolean, int, int)
-
getBaseProvider
protected org.orekit.forces.gravity.potential.ConstantSphericalHarmonics getBaseProvider(boolean wantNormalized, int degree, int order)
Get a time-independent provider containing base harmonics coefficients.Beware that some coeefficients may be missing here, if they are managed as time-dependent piecewise models (as in ICGEM V2.0).
- Parameters:
wantNormalized
- if true, the raw provider must provide normalized coefficients, otherwise it will provide un-normalized coefficientsdegree
- maximal degreeorder
- maximal order- Returns:
- a new provider, with no time-dependent parts
- Since:
- 11.1
- See Also:
getProvider(boolean, int, int)
-
getConstantProvider
@Deprecated protected org.orekit.forces.gravity.potential.ConstantSphericalHarmonics getConstantProvider(boolean wantNormalized, int degree, int order)
Deprecated.as of 11.1, not used anymoreGet a time-independent provider for read spherical harmonics coefficients.- Parameters:
wantNormalized
- if true, the raw provider must provide normalized coefficients, otherwise it will provide un-normalized coefficientsdegree
- maximal degreeorder
- maximal order- Returns:
- a new provider, with no time-dependent parts
- Since:
- 6.0
- See Also:
getProvider(boolean, int, int)
-
buildTriangularArray
@Deprecated protected static double[][] buildTriangularArray(int degree, int order, double value)
Deprecated.as of 11.1, replaced bybuildFlatArray(Flattener, double)
Build a coefficients triangular array.- Parameters:
degree
- array degreeorder
- array ordervalue
- initial value to put in array elements- Returns:
- built array
-
buildFlatArray
protected static double[] buildFlatArray(org.orekit.forces.gravity.potential.Flattener flattener, double value)
Build a coefficients array in flat form.- Parameters:
flattener
- converter from triangular to flat formvalue
- initial value to put in array elements- Returns:
- built array
- Since:
- 11.1
-
parseDouble
protected static double parseDouble(String string)
Parse a double from a string. Accept the Fortran convention of using a 'D' or 'd' instead of an 'E' or 'e'.- Parameters:
string
- to be parsed.- Returns:
- the double value of
string
.
-
buildRow
protected static double[] buildRow(int degree, int order, double value)
Build a coefficients row.- Parameters:
degree
- row degreeorder
- row ordervalue
- initial value to put in array elements- Returns:
- built row
-
extendListOfLists
@Deprecated protected void extendListOfLists(List<List<Double>> list, int degree, int order, double value)
Deprecated.as of 11.1, not used anymoreExtend a list of lists of coefficients if needed.- Parameters:
list
- list of lists of coefficientsdegree
- degree required to be presentorder
- order required to be presentvalue
- initial value to put in list elements
-
toArray
@Deprecated protected double[][] toArray(List<List<Double>> list)
Deprecated.as of 11.1, not used anymoreConvert a list of list into an array.- Parameters:
list
- list of lists of coefficients- Returns:
- a new array
-
parseCoefficient
@Deprecated protected void parseCoefficient(String field, List<List<Double>> list, int i, int j, String cName, String name)
Deprecated.as of 11.1, replaced byparseCoefficient(String, Flattener, double[], int, int, String, String)
Parse a coefficient.- Parameters:
field
- text field to parselist
- list where to put the coefficienti
- first index in the listj
- second index in the listcName
- name of the coefficientname
- name of the file
-
parseCoefficient
@Deprecated protected void parseCoefficient(String field, double[][] array, int i, int j, String cName, String name)
Deprecated.as of 11.1, replaced byparseCoefficient(String, Flattener, double[], int, int, String, String)
Parse a coefficient.- Parameters:
field
- text field to parsearray
- array where to put the coefficienti
- first index in the listj
- second index in the listcName
- name of the coefficientname
- name of the file
-
parseCoefficient
protected void parseCoefficient(String field, org.orekit.forces.gravity.potential.Flattener f, double[] array, int i, int j, String cName, String name)
Parse a coefficient.- Parameters:
field
- text field to parsef
- converter from triangular to flat formarray
- array where to put the coefficienti
- first index in the listj
- second index in the listcName
- name of the coefficientname
- name of the file- Since:
- 11.1
-
rescale
@Deprecated protected static void rescale(double scale, boolean normalizedOrigin, double[][] originC, double[][] originS, boolean wantNormalized, double[][] rescaledC, double[][] rescaledS)
Deprecated.as of 11.1, replaced byrescale(double, boolean, Flattener, Flattener, double[])
Rescale coefficients arrays.- Parameters:
scale
- general scaling factor to apply to all elementsnormalizedOrigin
- if true, the origin coefficients are normalizedoriginC
- cosine part of the original coefficientsoriginS
- sine part of the origin coefficientswantNormalized
- if true, the rescaled coefficients must be normalizedrescaledC
- cosine part of the rescaled coefficients to fill in (may be the originC array)rescaledS
- sine part of the rescaled coefficients to fill in (may be the originS array)
-
rescale
protected double[] rescale(double scale, boolean wantNormalized, org.orekit.forces.gravity.potential.Flattener rescaledFlattener, org.orekit.forces.gravity.potential.Flattener originalFlattener, double[] original)
Rescale coefficients arrays.The normalized/unnormalized nature of original coefficients is inherited from previous parsing.
- Parameters:
scale
- general scaling factor to apply to all elementswantNormalized
- if true, the rescaled coefficients must be normalized, otherwise they must be un-normalizedrescaledFlattener
- converter from triangular to flat formoriginalFlattener
- converter from triangular to flat formoriginal
- original coefficients- Returns:
- rescaled coefficients
- Since:
- 11.1
-
rescale
protected org.orekit.forces.gravity.potential.TimeDependentHarmonic[] rescale(boolean wantNormalized, org.orekit.forces.gravity.potential.Flattener rescaledFlattener, org.orekit.forces.gravity.potential.Flattener originalFlattener, org.orekit.forces.gravity.potential.TimeDependentHarmonic[] original)
Rescale coefficients arrays.The normalized/unnormalized nature of original coefficients is inherited from previous parsing.
- Parameters:
wantNormalized
- if true, the rescaled coefficients must be normalized, otherwise they must be un-normalizedrescaledFlattener
- converter from triangular to flat formoriginalFlattener
- converter from triangular to flat formoriginal
- original coefficients- Returns:
- rescaled coefficients
- Since:
- 11.1
-
toDate
protected AbsoluteDate toDate(DateComponents components)
Create a date from components. Assumes the time part is noon.- Parameters:
components
- year, month, day.- Returns:
- date.
-
toDate
protected AbsoluteDate toDate(DateComponents dc, TimeComponents tc)
Create a date from components.- Parameters:
dc
- dates components.tc
- time components- Returns:
- date.
- Since:
- 11.1
-
-