SPEDAS Developer's Guide: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== Command Line == | == Command Line == | ||
Central to all command-line plug-ins in SPEDAS is a routine (typcailly yyy_load_xyz, where YYY is the mission and XYZ is the instrument) or set of routines that grab remote data files from an | Central to all command-line plug-ins in SPEDAS is a routine (typcailly yyy_load_xyz, where YYY is the mission and XYZ is the instrument) or set of routines that grab remote data files from an HTTP/FTP server and loads those data into tplot variables. The simplest way to get started is to host your data on a [https://github.com/hapi-server HAPI server], and implement a yyy_load_xyz routine that loads the XYZ data from your HAPI server using hapi_load_data; here's a simple example that loads Voyager LECP data | ||
<syntaxhighlight lang="idl"> | |||
;+ | |||
; NAME: | |||
; voy_load_lecp | |||
; | |||
; PURPOSE: | |||
; Loads Voyager LECP flux data into tplot variables | |||
; | |||
; KEYWORDS: | |||
; PROBE = S/C number to load (default: 1) | |||
; TRANGE = Time range of interest (2 element array), if | |||
; this is not set, the default is to prompt the user. Note | |||
; that if the input time range is not a full day, a full | |||
; days data is loaded | |||
; | |||
; EXAMPLE: | |||
; voy_load_lecp, trange=['1977-09-10', '1977-09-20'], probe=2 | |||
; | |||
;- | |||
pro voy_load_lecp, probe=probe, trange=trange, tplotnames=tplotnames, suffix=suffix | |||
; default to probe 1, and convert to a string if the user does supply the probe via a keyword | |||
if undefined(probe) then probe = '1' else probe = strcompress(string(probe), /remove_all) | |||
; simply load the LECP data from the example server | |||
hapi_load_data, prefix='voy'+probe+'_', $ | |||
trange=trange, $ | |||
suffix=suffix, $ | |||
dataset='spase://VEPO/NumericalData/Voyager'+probe+'/LECP/Flux.Proton.PT1H', $ | |||
server='http://datashop.elasticbeanstalk.com/hapi', $ | |||
tplotnames=tplotnames | |||
end | |||
</syntaxhighlight> | |||
Revision as of 19:21, 30 April 2018
Command Line
Central to all command-line plug-ins in SPEDAS is a routine (typcailly yyy_load_xyz, where YYY is the mission and XYZ is the instrument) or set of routines that grab remote data files from an HTTP/FTP server and loads those data into tplot variables. The simplest way to get started is to host your data on a HAPI server, and implement a yyy_load_xyz routine that loads the XYZ data from your HAPI server using hapi_load_data; here's a simple example that loads Voyager LECP data
<syntaxhighlight lang="idl">
- +
- NAME
- voy_load_lecp
- PURPOSE
- Loads Voyager LECP flux data into tplot variables
- KEYWORDS
- PROBE = S/C number to load (default
- 1)
- TRANGE = Time range of interest (2 element array), if
- this is not set, the default is to prompt the user. Note
- that if the input time range is not a full day, a full
- days data is loaded
- EXAMPLE
- voy_load_lecp, trange=['1977-09-10', '1977-09-20'], probe=2
- -
pro voy_load_lecp, probe=probe, trange=trange, tplotnames=tplotnames, suffix=suffix
; default to probe 1, and convert to a string if the user does supply the probe via a keyword if undefined(probe) then probe = '1' else probe = strcompress(string(probe), /remove_all) ; simply load the LECP data from the example server hapi_load_data, prefix='voy'+probe+'_', $ trange=trange, $ suffix=suffix, $ dataset='spase://VEPO/NumericalData/Voyager'+probe+'/LECP/Flux.Proton.PT1H', $ server='http://datashop.elasticbeanstalk.com/hapi', $ tplotnames=tplotnames
end </syntaxhighlight>
If your data files are in CDF format, you can download them using spd_download, then load them into tplot variables using cdf2tplot.
For reference, the data model for tplot variables can be found at:
http://spedas.org/wiki/index.php?title=Data_model
Graphical User Interface (GUI)
GUI plug-ins are described by a simple text file located in the folder: spedas_gui/plugins/. Each mission contains its own text file describing the various components of the plugin.
Several types of GUI plug-in components are available, including:
- Load Data
- Configuration Settings
- Tools Menu
- Data Processing
- About
A GUI plug-in consists of one or more of the above components, and can have multiple components of any type (e.g., the THEMIS plug-in in SPEDAS contains 2 load_data components, 13 data_processing components, 2 menu components, 1 about component and 1 config component). The suggested way of creating a component for your mission is to fork the example code found in the spedas_gui/api_examples/ folder and modify it for your own mission.
Load Data
Load Data (load_data) components allow you to add a new mission tab to the Load Data window found at the menu: File -> Load Data. These tabs are essentially wrappers around the command-line load routine used to load data into tplot variables.
An example of adding a new tab can be found at: spedas_gui/api_examples/load_data_tab/
Configuration Settings
Config Settings components allow you to add a new mission tab to the Configuration Settings window found at the menu: File -> Configuration Settings...; these tabs allow your users to modify various configuration settings that persist through SPEDAS sessions. For most missions, these are wrappers meant to override settings in your mission system variable (!yyy), usually set in yyy_init. For example, config plug-ins allow your users to change the local data directory, whether data are downloaded from a remote site or only loaded from the local cache.
Tools Menu
Menu components allow you to add a new item to the 'Tools' menu in the GUI. These are currently used in SPEDAS to generate mission overview plots, but can also be used to act as wrappers around more complex functionality (e.g., generating 2D particle slices).
Data Processing
Data Processing components allow you to add a new item to the "More..." menu in the "Data Processing" window, found at Analysis -> Data Processing. Data Processing components allow you to add additional data processing operations to the Data Processing window (e.g., mission specific coordinate transformations).
About
About components allow you to add a new item describing your mission to the "About SPEDAS Plugins..." menu found at Help -> About.
Adding Plug-ins to the GUI
Create a .txt file that fully describes your GUI plug-in components and drop it into the /spedas_gui/plugins folder.