mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 14:29:42 -05:00
Merge pull request #2728 from OpenSpace/issue/2649
Fix for date format in sssb v2 asteroids files (issue 2649)
This commit is contained in:
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Amor Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_amor_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Apollo Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_apollo_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Aten Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_aten_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Atira Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_atira_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Centaur Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_centaur_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Chiron-type Comet)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_chiron-type_comet",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Encke-type Comet)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_encke-type_comet",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Halley-type Comet)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_halley-type_comet",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Inner Main Belt Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_inner_main_belt_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Jupiter Family Comet)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_jupiter-family_comet",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Jupiter Trojan Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_jupiter_trojan_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Main Belt Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_main_belt_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Mars-Crossing Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_mars-crossing_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Outer Main Belt Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_outer_main_belt_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Potentially hazardous Asteroids)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_pha",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local sssb = asset.syncedResource({
|
||||
Name = "Small SolarSystem Body Data (Trans-Neptunian Object Asteroid)",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sssb_data_transneptunian_object_asteroid",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -239,8 +239,9 @@ namespace {
|
||||
}
|
||||
|
||||
double epochFromYMDdSubstring(const std::string& epoch) {
|
||||
// The epochString is in the form:
|
||||
// The epochString can be in one of two forms:
|
||||
// YYYYMMDD.ddddddd
|
||||
// YYYY-MM-DD.ddddddd
|
||||
// With YYYY as the year, MM the month (1 - 12), DD the day of month (1-31),
|
||||
// and dddd the fraction of that day.
|
||||
|
||||
@@ -258,8 +259,14 @@ namespace {
|
||||
e += ".0";
|
||||
}
|
||||
// 1, 2
|
||||
size_t nDashes = std::count_if(
|
||||
epoch.begin(),
|
||||
epoch.end(),
|
||||
[](char c) { return c == '-'; }
|
||||
);
|
||||
std::string formatString = (nDashes == 2) ? "{:4}-{:2}-{:2}{}" : "{:4}{:2}{:2}{}";
|
||||
auto [res, year, monthNum, dayOfMonthNum, fractionOfDay] =
|
||||
scn::scan_tuple<int, int, int, double>(e, "{:4}{:2}{:2}{}");
|
||||
scn::scan_tuple<int, int, int, double>(e, formatString);
|
||||
if (!res) {
|
||||
throw ghoul::RuntimeError(fmt::format("Error parsing epoch '{}'", epoch));
|
||||
}
|
||||
@@ -598,10 +605,12 @@ std::vector<Parameters> readSbdbFile(std::filesystem::path file) {
|
||||
|
||||
std::string line;
|
||||
std::getline(f, line);
|
||||
// Newer versions downloaded from the JPL SBDB website have " around variables
|
||||
line.erase(remove(line.begin(), line.end(), '\"'), line.end());
|
||||
if (line != ExpectedHeader) {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
"Expected JPL SBDB file to start with '{}' but found '{}' instead",
|
||||
ExpectedHeader, line
|
||||
ExpectedHeader, line.substr(0, 100)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user