Commit 636d1820 authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Added default supported name for CSSI space weather data.

parent 3a2a26c5
......@@ -40,12 +40,12 @@ import org.orekit.utils.ImmutableTimeStampedCache;
* models: F107 solar flux, Ap and Kp indexes.
* The {@link org.orekit.data.DataLoader} implementation and the parsing is handled by the class {@link CssiSpaceWeatherDataLoader}.
* <p>
* The data are retrieved through space weather files offered by CSSI/AGI. The
* data can be retrieved on the AGI
* <a href="ftp://ftp.agi.com/pub/DynamicEarthData/SpaceWeather-All-v1.2.txt">
* FTP</a>. This file is updated several times a day by using several sources
* mentioned in the <a href="http://celestrak.com/SpaceData/SpaceWx-format.php">
* Celestrak space weather data documentation</a>.
* The data are retrieved through space weather files offered by AGI/CSSI on the AGI
* <a href="ftp://ftp.agi.com/pub/DynamicEarthData/SpaceWeather-All-v1.2.txt">FTP</a> as
* well as on the CelesTrack <a href="http://celestrak.com/SpaceData/">website</a>.
* These files are updated several times a day by using several sources mentioned in the
* <a href="http://celestrak.com/SpaceData/SpaceWx-format.php">Celestrak space
* weather data documentation</a>.
* </p>
*
* @author Clément Jonglez
......@@ -54,6 +54,9 @@ import org.orekit.utils.ImmutableTimeStampedCache;
public class CssiSpaceWeatherData extends AbstractSelfFeedingLoader
implements DTM2000InputParameters, NRLMSISE00InputParameters {
/** Default regular expression for supported names that works with all officially published files. */
public static final String DEFAULT_SUPPORTED_NAMES = "^S(?:pace)?W(?:eather)?-(?:All)?.*\\.txt$";
/** Serializable UID. */
private static final long serialVersionUID = 4249411710645968978L;
......@@ -86,30 +89,40 @@ public class CssiSpaceWeatherData extends AbstractSelfFeedingLoader
/**
* Simple constructor. This constructor uses the default data context.
* <p>
* The original file names provided by AGI/CSSI are of the form:
* SpaceWeather-All-v1.2.txt (AGI's ftp) or SW-Last5Years.txt (CelesTrak's website).
* So a recommended regular expression for the supported names that works
* with all published files is: {@link #DEFAULT_SUPPORTED_NAMES}.
* </p>
*
* @param fileName name of the CSSI space weather file.
* @param supportedNames regular expression for supported AGI/CSSI space weather files names
*/
@DefaultDataContext
public CssiSpaceWeatherData(final String fileName) {
this(fileName, DataContext.getDefault().getDataProvidersManager(),
DataContext.getDefault().getTimeScales().getUTC());
public CssiSpaceWeatherData(final String supportedNames) {
this(supportedNames, DataContext.getDefault().getDataProvidersManager(),
DataContext.getDefault().getTimeScales().getUTC());
}
/**
* Constructor that allows specifying the source of the CSSI space weather file.
* Constructor that allows specifying the source of the CSSI space weather
* file.
*
* @param fileName name of the CSSI space weather file.
* @param supportedNames regular expression for supported AGI/CSSI space weather files names
* @param dataProvidersManager provides access to auxiliary data files.
* @param utc UTC time scale.
*/
public CssiSpaceWeatherData(final String fileName, final DataProvidersManager dataProvidersManager,
final TimeScale utc) {
super(fileName, dataProvidersManager);
public CssiSpaceWeatherData(final String supportedNames,
final DataProvidersManager dataProvidersManager,
final TimeScale utc) {
super(supportedNames, dataProvidersManager);
this.utc = utc;
final CssiSpaceWeatherDataLoader loader = new CssiSpaceWeatherDataLoader(utc);
final CssiSpaceWeatherDataLoader loader =
new CssiSpaceWeatherDataLoader(utc);
this.feed(loader);
data = new ImmutableTimeStampedCache<>(N_NEIGHBORS, loader.getDataSet());
data =
new ImmutableTimeStampedCache<>(N_NEIGHBORS, loader.getDataSet());
firstDate = loader.getMinDate();
lastDate = loader.getMaxDate();
lastObservedDate = loader.getLastObservedDate();
......
......@@ -70,7 +70,7 @@ public class CssiSpaceWeatherLoaderTest {
}
private CssiSpaceWeatherData loadCswl() {
CssiSpaceWeatherData cswl = new CssiSpaceWeatherData("SpaceWeather-All-v1.2_snapshot_20200224.txt");
CssiSpaceWeatherData cswl = new CssiSpaceWeatherData(CssiSpaceWeatherData.DEFAULT_SUPPORTED_NAMES);
return cswl;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment