Added slight improvent to showing fieldlines when progressing fast in time, also added parker solar probe field line assets + the trail.

This commit is contained in:
Kollberg
2019-09-06 11:41:05 -04:00
parent 05ed1ae546
commit 2545d4a88c
12 changed files with 328 additions and 49 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

@@ -0,0 +1,64 @@
local assetHelper = asset.require('util/asset_helper')
local transforms = asset.require('scene/solarsystem/sun/transforms')
local ParkerSolarProbeTrail = {
Identifier = "ParkerSolarProbeTrail",
Parent = transforms.SolarSystemBarycenter.Identifier,
Renderable = {
Type = "RenderableTrailTrajectory",
Translation = {
Type = "HorizonsTranslation",
HorizonsTextFile = "C:/Users/skollber/Downloads/parker_20180812-20191231.dat"
},
Color = { 0.9, 0.9, 0.0 },
StartTime = "2018 AUG 12 12:00:00",
EndTime = "2025 Aug 31 09:11:00",
Period = 365.242,
SampleInterval = 1000,
TimeStampSubsampleFactor = 1
},
GUI = {
Name = "'Parker Solar Probe Trail",
Path = "/Solar System/Missions"
}
}
local PspPosition = {
Identifier = "PspPosition",
Parent = transforms.SolarSystemBarycenter.Identifier,
Transform = {
Translation = {
Type = "HorizonsTranslation",
HorizonsTextFile = "C:/Users/skollber/Downloads/parker_20180812-20191231.dat"
},
},
GUI = {
Name = "Parker Solar Probe",
Path = "/Solar System/Missions/Parker Solar Probe Position",
hidden = true
}
}
local PspMarker = {
Identifier = "PspMarker",
Parent = PspPosition.Identifier,
Renderable = {
Type = "RenderablePlaneImageLocal",
Enabled = false,
Size = 3.0E8,
Origin = "Center",
Billboard = true,
Texture = "C:/OpenSpace_dev/OpenSpace/data/assets/scene/solarsystem/missions/parkersolarprobe/marker.png",
BlendMode = "Additive"
},
GUI = {
Name = "Parker Solar Probe Marker",
Path = "/Solar System/Missions/Parker Solar Probe Marker"
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { ParkerSolarProbeTrail, PspPosition, PspMarker })
+7 -7
View File
@@ -31,16 +31,16 @@ local earthRadius = 6371
-- Selected field lines + some additional field lines
asset.require('./testwsa/scs_oi')
asset.require('./testwsa/pfss_oi')
--asset.require('./testwsa/pfss_io')
-- Parker Solar Probe
-- asset.require('scene/solarsystem/missions/parkersolarprobe/parker_solar_probe_trail')
asset.require('./testwsa/pfss_io')
-- Sun earth connection
--asset.require('./testwsa/sub_earth')
-- Every N:th WSA field line
-- asset.require('./testwsa/pfss_io_25')
-- Parker Solar Probe asset package
asset.require('scene/solarsystem/missions/parkersolarprobe/parker_solar_probe_trail')
--asset.require('./testwsa/psp_pfss_io')
--asset.require('./testwsa/psp_pfss_oi')
--asset.require('./testwsa/psp_scs_oi')
-- asset.require('./testwsa/psp_sub_satellite')
local Keybindings = {
{
+50
View File
@@ -0,0 +1,50 @@
local assetHelper = asset.require('util/asset_helper')
local transforms = asset.require('./transforms')
local fieldlinesDirectory = asset.localResource("fl_pfss_io")
local transferFunctions = asset.localResource("transferfunctions")
local opennessColorTable = transferFunctions .. "/openness_spec.txt"
local sunRadius = 695508000
-- Fieldlies from json
local fieldlines = {
Identifier = "PSP_WSA_Fieldlines_PFSS_IO",
Parent = transforms.HNMReferenceFrame.Identifier, -- Use this for ADAPT GONG (Parker Solar Probe endpoints)
Renderable = {
Type = "RenderableFieldlinesSequence",
SourceFolder = fieldlinesDirectory,
-- Dynamic web content wants a url with a unique id where the data may be fetched.
DynamicWebContent = "https://iswa.gsfc.nasa.gov/IswaSystemWebApp/FilesInRangeServlet?dataID=1194",
FlowEnabled = false,
AlphaBlendlingEnabled = false,
InputFileType = "osfls",
ColorTablePaths = {
opennessColorTable
},
ColorTableRanges = {
{ 0.0, 2.0 }
},
LoadAtRuntime = true,
ScaleToMeters = 1.0,
SecondsBefore = 24*60*60,
SecondsAfter = 24*60*60,
SimulationModel = "wsa",
Color = {
Uniform = {0.725, 0.1, 0, 1}
},
ColoringMethod = "Quantity"
},
GUI = {
Path = "/Solar System/Heliosphere",
Name = "PSP WSA PFSS In to Out Lines"
},
Transform = {
Scale = {
Type = "StaticScale",
Scale = sunRadius
},
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { fieldlines })
+53
View File
@@ -0,0 +1,53 @@
local assetHelper = asset.require('util/asset_helper')
local transforms = asset.require('./transforms')
local fieldlinesDirectory = asset.localResource("fl_pfss_oi")
local transferFunctions = asset.localResource("transferfunctions")
local windSpeedPolarityColorTable = transferFunctions .. "/polarity_spec.txt"
local currentSheetColorTable = transferFunctions .. "/currentsheet_spec.txt"
local sunRadius = 695508000
-- Fieldlies from json
local fieldlines = {
Identifier = "PSP_WSA_Fieldlines_PFSS_OI",
Parent = transforms.HNMReferenceFrame.Identifier, -- Use this for ADAPT GONG (Parker Solar Probe endpoints)
Renderable = {
Type = "RenderableFieldlinesSequence",
SourceFolder = fieldlinesDirectory,
-- Dynamic web content wants a url with a unique id where the data may be fetched.
DynamicWebContent = "https://iswa.gsfc.nasa.gov/IswaSystemWebApp/FilesInRangeServlet?dataID=1195",
FlowEnabled = false,
AlphaBlendlingEnabled = false,
InputFileType = "osfls",
ColorTablePaths = {
windSpeedPolarityColorTable,
currentSheetColorTable
},
ColorTableRanges = {
{ -1.0, 1.0 },
{ 0.0, 1.0 },
},
LoadAtRuntime = true,
ScaleToMeters = 1.0,
SecondsBefore = 24*60*60,
SecondsAfter = 24*60*60,
SimulationModel = "wsa",
Color = {
Uniform = {0.725, 0.1, 0, 1}
},
ColoringMethod = "Quantity"
},
GUI = {
Path = "/Solar System/Heliosphere",
Name = "PSP WSA PFSS Out to In Filled Boundary Lines"
},
Transform = {
Scale = {
Type = "StaticScale",
Scale = sunRadius
},
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { fieldlines })
+53
View File
@@ -0,0 +1,53 @@
local assetHelper = asset.require('util/asset_helper')
local transforms = asset.require('./transforms')
local fieldlinesDirectory = asset.localResource("fl_scs_oi")
local transferFunctions = asset.localResource("transferfunctions")
local windSpeedPolarityColorTable = transferFunctions .. "/polarity_spec.txt"
local currentSheetColorTable = transferFunctions .. "/currentsheet_spec.txt"
local sunRadius = 695508000
-- Fieldlies from json
local fieldlines = {
Identifier = "PSP_WSA_Fieldlines_SCS_OI",
Parent = transforms.HNMReferenceFrame.Identifier, -- Use this for ADAPT GONG (Parker Solar Probe endpoints)
Renderable = {
Type = "RenderableFieldlinesSequence",
SourceFolder = fieldlinesDirectory,
-- Dynamic web content wants a url with a unique id where the data may be fetched.
DynamicWebContent = "https://iswa.gsfc.nasa.gov/IswaSystemWebApp/FilesInRangeServlet?dataID=1193",
FlowEnabled = false,
AlphaBlendlingEnabled = false,
InputFileType = "osfls",
ColorTablePaths = {
windSpeedPolarityColorTable,
currentSheetColorTable
},
ColorTableRanges = {
{ -1.0, 1.0 },
{ 0.0, 1.0 },
},
LoadAtRuntime = true,
ScaleToMeters = 1.0,
SecondsBefore = 24*60*60,
SecondsAfter = 24*60*60,
SimulationModel = "wsa",
Color = {
Uniform = {0, 0.725, 0.75, 1}
},
ColoringMethod = "Quantity",
},
GUI = {
Path = "/Solar System/Heliosphere",
Name = "PSP WSA SCS Out to In Filled Boundary Lines"
},
Transform = {
Scale = {
Type = "StaticScale",
Scale = sunRadius
},
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { fieldlines })
@@ -0,0 +1,54 @@
local assetHelper = asset.require('util/asset_helper')
local transforms = asset.require('./transforms')
local transferFunctions = asset.localResource("transferfunctions")
local fieldlinesDirectory = asset.localResource("fl_sub_earth")
local polarityColorTable = transferFunctions .. "/polarity_spec.txt"
local subEarthLevelColorTable = transferFunctions .. "/subearth_spec.txt"
local sunRadius = 695508000
-- Fieldlies from json
local fieldlines = {
Identifier = "PSP_WSA_Fieldlines_Sub_Satellite",
Parent = transforms.HNMReferenceFrame.Identifier, -- Use this for ADAPT GONG (Parker Solar Probe endpoints)
Renderable = {
Type = "RenderableFieldlinesSequence",
SourceFolder = fieldlinesDirectory,
-- Dynamic web content wants a url with a unique id where the data may be fetched.
DynamicWebContent = "https://iswa.gsfc.nasa.gov/IswaSystemWebApp/FilesInRangeServlet?dataID=1192",
FlowEnabled = false,
AlphaBlendlingEnabled = false,
InputFileType = "osfls",
ColorTablePaths = {
polarityColorTable,
subEarthLevelColorTable
},
ColorTableRanges = {
{ 0.0, 1.0 },
{ 0.0, 2.0 }
},
LoadAtRuntime = true,
ScaleToMeters = 1.0,
SecondsBefore = 24*60*60,
SecondsAfter = 24*60*60,
SimulationModel = "wsa",
Color = {
Uniform = {0.725, 0.1, 0, 1}
},
ColoringMethod = "Quantity",
},
GUI = {
Path = "/Solar System/Heliosphere",
Name = "WSA Sub-PSP track"
},
Transform = {
Scale = {
Type = "StaticScale",
Scale = sunRadius
},
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { fieldlines })
@@ -46,7 +46,7 @@ namespace openspace{
std::vector<double>& _startTimes)
{
// Initialize the sliding window
_webFieldlinesWindow = WebFieldlinesWindow(_syncDir, url, _sourceFiles, _startTimes, _nStates, convertIdentifierToID(identifier));
_webFieldlinesWindow = WebFieldlinesWindow(_syncDir, url, _sourceFiles, _startTimes, _nStates);
LTRACE("WebFieldlinesManager initialized " + identifier);
}
@@ -96,16 +96,45 @@ namespace openspace{
case 1180:
type = "WSA_OUT";
break;
// Parker solar probe endpoints
case 1192:
type = "trace_sub_psp";
break;
case 1193:
type = "trace_scs_outtoin";
break;
case 1194:
type = "trace_pfss_intoout";
break;
case 1195:
type = "trace_pfss_outtoin";
break;
case 1196:
type = "ADAPT_WSA_OUT";
break;
}
// TODO(Axel): Change this endpoint to be dynamic for each dataset
std::string url = "https://iswa.ccmc.gsfc.nasa.gov/iswa_data_tree/model/solar/WSA4.5/WSA4.5_fieldlines/" + type + "/2017/09/2017-09-28T00-23-22.000.osfls";
std::string destinationpath = absPath(_syncDir + ghoul::filesystem::FileSystem::PathSeparator + "2017-09-28T00-23-22.000.osfls"); // what the downloaded filename is to be
/* For experimentation with suntexturemanager */
/* For experimentation with suntexturemanager & parker solor probe, hopefully this hardcoding can go away */
if (ID == 1180) {
url = "https://iswa.ccmc.gsfc.nasa.gov/iswa_data_tree/model/solar/WSA4.5/" + type + "/2017/09/wsa_201709280023R000_gong.fits";
destinationpath = absPath(_syncDir + ghoul::filesystem::FileSystem::PathSeparator + "wsa_201709280023R000_gong.fits"); // what the downloaded filename is to be
}
// For parker solar probe
if (ID > 1190) {
url = "https://iswa.ccmc.gsfc.nasa.gov/iswa_data_tree/model/solar/ADAPT_WSA4.5/ADAPT_WSA4.5_fieldlines/" + type + "/2018/11/2018-11-01T00-00-00.000.osfls";
destinationpath = absPath(_syncDir + ghoul::filesystem::FileSystem::PathSeparator + "2018-11-01T00-00-00.000.osfls"); // what the downloaded filename is to be
}
if (ID == 1196) {
url = "https://iswa.ccmc.gsfc.nasa.gov/iswa_data_tree/model/solar/ADAPT_WSA4.5/" + type + "/2018/11/wsa_201811010000R007_agong.fits";
destinationpath = absPath(_syncDir + ghoul::filesystem::FileSystem::PathSeparator + "wsa_201811010000R007_agong.fits"); // what the downloaded filename is to be
}
/* End of experiment */
AsyncHttpFileDownload ashd = AsyncHttpFileDownload(url, destinationpath, HttpFileDownload::Overwrite::Yes);
@@ -119,7 +148,7 @@ namespace openspace{
void WebFieldlinesManager::update(){
const double openspaceTime = global::timeManager.time().j2000Seconds();
const auto deltaTime = global::timeManager.deltaTime();
const int speedThreshhold = 10000;
const int speedThreshhold = 7200; // More than 2hrs a second would generally be unfeasable for a regular internet connection to operate at
// Hold your horses, we don't want to do anything while deltatime is too high
if (abs(deltaTime) < speedThreshhold){
@@ -167,26 +196,9 @@ namespace openspace{
}
// --------------------------- PRIVATE FUNCTIONS --------------------------- //
FieldLineType WebFieldlinesManager::convertIdentifierToID(std::string identifier) {
std::map<std::string, FieldLineType> string2ID{
{"WSA_Fieldlines_Sub_Earth_Track",WSA_Fieldlines_Sub_Earth_Track},
{"WSA_Fieldlines_SCS_OI",WSA_Fieldlines_SCS_OI},
{"WSA_Fieldlines_PFSS_IO",WSA_Fieldlines_PFSS_IO},
{"WSA_Fieldlines_PFSS_OI",WSA_Fieldlines_PFSS_OI}
};
if (auto found = string2ID.find(identifier); found != string2ID.end()) {
return found->second;
}
else
return FieldLineType::ID_NOT_FOUND;
}
std::string WebFieldlinesManager::getDirectory(){
return _syncDir;
}
} // namespace openspace
@@ -29,17 +29,8 @@
#include <vector>
#include <string>
enum FieldLineType {
WSA_Fieldlines_Sub_Earth_Track = 1176,
WSA_Fieldlines_SCS_OI = 1177,
WSA_Fieldlines_PFSS_IO = 1178,
WSA_Fieldlines_PFSS_OI = 1179,
ID_NOT_FOUND = 0,
};
namespace openspace {
class WebFieldlinesManager{
public:
// Constructor
@@ -84,8 +75,6 @@ private:
// The datastructure for managing the interval of fieldline sets to be downloaded
WebFieldlinesWindow _webFieldlinesWindow;
// Converts a string to id used in api request.
FieldLineType convertIdentifierToID(std::string identifier);
};
@@ -42,8 +42,8 @@ namespace openspace{
// --------------------------- CONSTRUCTORS ---------------------------------------//
WebFieldlinesWindow::WebFieldlinesWindow(std::string syncDir, std::string serverUrl,
std::vector<std::string>& _sourceFiles,
std::vector<double>& _startTimes, size_t& _nStates, int apiID):
_apiID(apiID){
std::vector<double>& _startTimes, size_t& _nStates)
{
_window.backWidth = 3;
_window.forwardWidth = 3;
@@ -71,7 +71,7 @@ public:
// If files existed on disk already
WebFieldlinesWindow(std::string syncDir, std::string serverUrl,
std::vector<std::string>& _sourceFiles,
std::vector<double>& _startTimes, size_t& _nStates, int apiID);
std::vector<double>& _startTimes, size_t& _nStates);
// Copy constructor
WebFieldlinesWindow& operator=(WebFieldlinesWindow&&) = default;
@@ -109,7 +109,6 @@ public:
private:
// PRIVATE MEMBER VARIABLES
size_t _apiID;
// Sliding download window
Window _window;
@@ -123,15 +123,16 @@ namespace openspace{
}
// Download all files in the current window
// This function starts in the middle of the window and proceeds to download all future timesteps,
// then steps backwards from the middle
// This function starts usually in the middle of the window and proceeds to download all future timesteps,
// then steps backwards from the startingpoint
//TODO(Axel): Different behaviour depending on direction the user is moving in, might be wanted?
void WebFieldlinesWorker::downloadWindow(std::vector<std::pair<double, std::string>> triggerTimes) {
// Helper variables
int middle = triggerTimes.size() / 2;
int startingPoint = triggerTimes.size() / 2;
bool downloaded = false;
bool oneUpdate = false;
bool fastDownload = global::timeManager.deltaTime() > 1800.0;
// May be interesting to keep something like this, if it will be possible to use a list of
// AsyncHttpFileDownloads
@@ -146,20 +147,23 @@ namespace openspace{
}
else { */
if (fastDownload) startingPoint = triggerTimes.size() - 1;
if (_downloading && _downloading->hasSucceeded() && _newWindow) {
_downloading->wait();
addToDownloadedList(_latestDownload);
_readyToDownload = true;
// This is to trigger one update of the fieldline timestamp that the user is currently on,
// while the rest of them will be downloaded in the background, and updated once ready
if (_latestDownload.second == triggerTimes[middle].second)
if (_latestDownload.second == triggerTimes[startingPoint].second)
oneUpdate = true;
}
if (_readyToDownload) {
// Forwards
std::vector<std::pair<double, std::string>>::iterator forwardIt = triggerTimes.begin();
std::advance(forwardIt, middle);
std::advance(forwardIt, startingPoint);
std::for_each(forwardIt, triggerTimes.end(), [this, &downloaded](auto it) {
if (!downloaded && !fileIsOnDisk(it.first)) {
downloadOsfls(it);
@@ -168,9 +172,10 @@ namespace openspace{
}
});
// Backwards
if (!downloaded) {
std::for_each(triggerTimes.rbegin() + middle, triggerTimes.rend(), [this, &downloaded](auto it) {
std::for_each(triggerTimes.rbegin(), triggerTimes.rend(), [this, &downloaded](auto it) {
if (!downloaded && !fileIsOnDisk(it.first)) {
downloadOsfls(it);
downloaded = true;