public class CssiSolarGeophysicalData extends SolarGeophysicalData
Modifier and Type | Field and Description |
---|---|
static double |
DefaultObservationTimeOfDay
Gets the default for the time of day at which the entries in the data file are assumed to take effect.
|
Modifier | Constructor and Description |
---|---|
protected |
CssiSolarGeophysicalData(CssiSolarGeophysicalData existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone(CopyContext context)
Clones this object using the specified context.
|
double |
computeApDailyAverage(JulianDate date)
Calculates the arithmetic average of the eight ap geomagnetic flux values for the given day,
rounded to the nearest whole value.
|
double |
computeApValue(JulianDate date)
Computes the geomagnetic flux ap value at the given date.
|
double |
computeAverageSolarRadioFlux(JulianDate date)
Gets the 81 day average solar radiation flux value centered on the given date.
|
double |
computeKpDailyAverage(JulianDate date)
Calculates the sum of the array of the eight ap geomagnetic flux values for the given day.
|
double |
computeKpValue(JulianDate date)
Computes the geomagnetic flux kp value at the given date.
|
double |
computeSolarRadioFlux(JulianDate date)
Computes the solar radiation flux value (often called F10.7) at the given date.
|
double[] |
computeThreeHourApValues(JulianDate date)
Calculates the array of the eight ap geomagnetic flux values for the given day.
|
double[] |
computeThreeHourKpValues(JulianDate date)
Calculates the array of the eight ap geomagnetic flux values for the given day.
|
TimeInterval |
getDailyPredictedInterval()
Gets the time interval of daily predicted data points, if known.
|
boolean |
getIsThreadSafe()
Gets a value indicating whether the methods on this instance are safe to call from
multiple threads simultaneously.
|
TimeInterval |
getMonthlyFitInterval()
Gets the time interval of monthly fit data points, if known.
|
TimeInterval |
getMonthlyPredictedInterval()
Gets the time interval of monthly predicted data points, if known.
|
double |
getObservationSecondsOfDay()
Gets the number of seconds since the start of midnight UTC
at which the observations of the solar flux are assumed to be made.
|
TimeInterval |
getObservedInterval()
Gets the time interval of observed data points, if known.
|
boolean |
getUseApToComputeKpValues()
Gets a value indicating whether the geophysical data set was configured to use the Ap geomagnetic flux indices
to compute the Kp values, instead of using the Kp values reported natively in the raw data.
|
boolean |
getUseDailyFluxData()
Gets a value indicating whether this instance always uses daily values for the Geomagnetic Flux instead of producing
the 3-hour values when calling
CssiSolarGeophysicalData.computeThreeHourKpValues(agi.foundation.time.JulianDate) or CssiSolarGeophysicalData.computeThreeHourApValues(agi.foundation.time.JulianDate) . |
static CssiSolarGeophysicalData |
readFromFile(String filePath)
Processes the CSSI Space Weather file into a set of time varying geophysical data.
|
static CssiSolarGeophysicalData |
readFromFile(String filePath,
double obsTimeOfDay,
boolean useApToComputeKp,
boolean useDailyForGeoFlux)
Processes the CSSI Space Weather file into a set of time varying geophysical data.
|
static CssiSolarGeophysicalData |
readFromStream(BufferedReader reader)
Processes the CSSI Space Weather file into a set of time varying geophysical data.
|
static CssiSolarGeophysicalData |
readFromStream(BufferedReader reader,
double obsTimeOfDay,
boolean useApToComputeKp,
boolean useDailyForGeoFlux)
Processes the CSSI Space Weather file into a set of time varying geophysical data.
|
calculateApFromKp, calculateKpFromAp
public static final double DefaultObservationTimeOfDay
protected CssiSolarGeophysicalData(@Nonnull CssiSolarGeophysicalData existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.public Object clone(CopyContext context)
This method should be implemented to call a copy constructor on the class of the
object being cloned. The copy constructor should take the CopyContext
as a parameter
in addition to the existing instance to copy. The copy constructor should first call
CopyContext.addObjectMapping(T, T)
to identify the newly constructed instance
as a copy of the existing instance. It should then copy all fields, using
CopyContext.updateReference(T)
to copy any reference fields.
A typical implementation of ICloneWithContext
:
public static class MyClass implements ICloneWithContext {
public MyClass(MyClass existingInstance, CopyContext context) {
context.addObjectMapping(existingInstance, this);
someReference = context.updateReference(existingInstance.someReference);
}
@Override
public final Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
}
In general, all fields that are reference types should be copied with a call to
CopyContext.updateReference(T)
. There are a couple of exceptions:
If one of these exceptions applies, the CopyContext
should be given an opportunity
to update the reference before the reference is copied explicitly. Use
CopyContext.updateReference(T)
to update the reference. If CopyContext.updateReference(T)
returns
the original object, indicating that the context does not have a replacement registered,
then copy the object manually by invoking a Clone method, a copy constructor, or by manually
constructing a new instance and copying the values.
alwaysCopy = context.updateReference(existingInstance.alwaysCopy);
if (existingInstance.alwaysCopy != null && alwaysCopy == existingInstance.alwaysCopy) {
alwaysCopy = (AlwaysCopy) existingInstance.alwaysCopy.clone(context);
}
If you are implementing an evaluator (a class that implements IEvaluator
), the
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
method shares some responsibilities with the
copy context constructor. Code duplication can be avoided by doing the following:
CopyContext.updateReference(T)
. You should still call CopyContext.updateReference(T)
on any references to
non-evaluators.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as the last line in the constructor and pass it the
same CopyContext
passed to the constructor.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as normal. See the reference documentation for
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
for more information on implementing that method.
public MyClass(MyClass existingInstance, CopyContext context) {
super(existingInstance, context);
someReference = context.updateReference(existingInstance.someReference);
evaluatorReference = existingInstance.evaluatorReference;
updateEvaluatorReferences(context);
}
@Override
public void updateEvaluatorReferences(CopyContext context) {
evaluatorReference = context.updateReference(evaluatorReference);
}
@Override
public Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
private IEvaluator evaluatorReference;
clone
in interface ICloneWithContext
clone
in class SolarGeophysicalData
context
- The context to use to perform the copy.public boolean getIsThreadSafe()
If this property is true
, all methods and properties are guaranteed to be thread safe.
Conceptually, an object that returns true
for this method acts as if there is a lock
protecting each method and property such that only one thread at a time can be inside any method or
property in the class. In reality, such locks are generally not used and are in fact discouraged. However,
the user must not experience any exceptions or inconsistent behavior that would not be experienced if such
locks were used.
If this property is false
, the behavior when using this class from multiple threads
simultaneously is undefined and may include inconsistent results and exceptions. Clients wishing to use
multiple threads should call CopyForAnotherThread.copy(T)
to get a separate instance of the
object for each thread.
getIsThreadSafe
in interface IThreadAware
getIsThreadSafe
in class SolarGeophysicalData
@Nonnull public static CssiSolarGeophysicalData readFromFile(@Nonnull String filePath)
CssiSolarGeophysicalData.DefaultObservationTimeOfDay
determines
when to transition from one entry to the next. The UseApToComputeKpValues
(get
) flag
is set to true by default, indicating that Kp will produce the more precise value computed from
Ap rather than interpolating the rounded values of Kp represented in the data file. The
UseDailyFluxData
(get
) flag is set to false by default.filePath
- The full path and filename of the file containing the space weather data in the CSSI format.NumberFormatException
- Thrown if there was a problem with the format of the file, the version is prior to 1.1, or
if there were no data entries in the file.@Nonnull public static CssiSolarGeophysicalData readFromFile(@Nonnull String filePath, double obsTimeOfDay, boolean useApToComputeKp, boolean useDailyForGeoFlux)
filePath
- The full path and filename of the file containing the space weather data in the CSSI format.obsTimeOfDay
- This is the time since the start of the calendar day, in seconds, when the observations are taken.
This is the time at which the daily values come into effect. Prior to this time, the previous days values are used.
By default, this is CssiSolarGeophysicalData.DefaultObservationTimeOfDay
(20 hours).useApToComputeKp
- This indicates whether to use the Ap geomagnetic flux indices in the file to compute the Kp values.
By default, this is true.useDailyForGeoFlux
- Indicates that the variation in values every three hours for Ap and Kp
should be ignored and instead replaced with a constant daily value when calling CssiSolarGeophysicalData.computeThreeHourApValues(agi.foundation.time.JulianDate)
and
CssiSolarGeophysicalData.computeThreeHourKpValues(agi.foundation.time.JulianDate)
.NumberFormatException
- Thrown if there was a problem with the format of the file, the version is prior to 1.1, or
if there were no data entries in the file.@Nonnull public static CssiSolarGeophysicalData readFromStream(@Nonnull BufferedReader reader)
reader
- A stream containing the space weather data in the CSSI format.NumberFormatException
- Thrown if there was a problem with the format of the file, the version is prior to 1.1, or
if there were no data entries in the file.@Nonnull public static CssiSolarGeophysicalData readFromStream(@Nonnull BufferedReader reader, double obsTimeOfDay, boolean useApToComputeKp, boolean useDailyForGeoFlux)
reader
- A stream containing the space weather data in the CSSI format.obsTimeOfDay
- This is the time since the start of the calendar day, in seconds, when the observations are taken.
This is the time at which the daily values come into effect. Prior to this time, the previous days values are used.
By default, this is CssiSolarGeophysicalData.DefaultObservationTimeOfDay
(20 hours).useApToComputeKp
- This indicates whether to use the Ap geomagnetic flux indices in the file to compute the Kp values.
By default, this is true.useDailyForGeoFlux
- Indicates that the variation in values every three hours for Ap and Kp
should be ignored and instead replaced with a constant daily value when calling CssiSolarGeophysicalData.computeThreeHourApValues(agi.foundation.time.JulianDate)
and
CssiSolarGeophysicalData.computeThreeHourKpValues(agi.foundation.time.JulianDate)
.NumberFormatException
- Thrown if there was a problem with the format of the file, the version is prior to 1.1, or
if there were no data entries in the file.public final boolean getUseDailyFluxData()
CssiSolarGeophysicalData.computeThreeHourKpValues(agi.foundation.time.JulianDate)
or CssiSolarGeophysicalData.computeThreeHourApValues(agi.foundation.time.JulianDate)
.
If daily values are used, the value for that day will be repeated for all 3-hour values.public final double getObservationSecondsOfDay()
public final boolean getUseApToComputeKpValues()
public double computeApValue(@Nonnull JulianDate date)
computeApValue
in class SolarGeophysicalData
date
- The date of the value to calculate.public double[] computeThreeHourApValues(@Nonnull JulianDate date)
computeThreeHourApValues
in class SolarGeophysicalData
date
- The day to calculate.public double computeApDailyAverage(@Nonnull JulianDate date)
computeApDailyAverage
in class SolarGeophysicalData
date
- The day to calculate.CssiSolarGeophysicalData.computeThreeHourApValues(agi.foundation.time.JulianDate)
.public double computeKpValue(@Nonnull JulianDate date)
computeKpValue
in class SolarGeophysicalData
date
- The date of the value to calculate.public double[] computeThreeHourKpValues(@Nonnull JulianDate date)
computeThreeHourKpValues
in class SolarGeophysicalData
date
- The day to calculate.public double computeKpDailyAverage(@Nonnull JulianDate date)
computeKpDailyAverage
in class SolarGeophysicalData
date
- The day to calculate.public double computeAverageSolarRadioFlux(@Nonnull JulianDate date)
computeAverageSolarRadioFlux
in class SolarGeophysicalData
date
- The date of the value to calculate.public double computeSolarRadioFlux(@Nonnull JulianDate date)
computeSolarRadioFlux
in class SolarGeophysicalData
date
- The date of the value to calculate.public final TimeInterval getObservedInterval()
public final TimeInterval getDailyPredictedInterval()
public final TimeInterval getMonthlyPredictedInterval()
public final TimeInterval getMonthlyFitInterval()