How to use the CCMC-created Python Script to write an SEP Scoreboard JSON data file
You can download the helper script (sep_json_writer.py) here (last updated on 2021.08.11). The helper script is supposed to help the modeler to provide their model data to the CCMC in the proper JSON format required by the SEP Scoreboard.
There are three ways to use the helper script to write out JSON data files for the SEP Scoreboard.
- If your model is written in Python, inside your Python script, call the class inside the helper script file. (If you're going to go to this trouble, it would be better to load the Python JSON library and write it. See https://stackabuse.com/reading-and-writing-json-to-a-file-in-python/ on how to do that.)
- Call the helper script with command line arguments.
- Make a Python library file with your data and import it. (This is the least recommended method.)
Method 1 - Call the class inside the helper script
Really, if you're able to do this, it would be better for you to add this to your python script:
#Import Python's JSON reading-and-writing library. It's built in. No need to download or install anything.
import json
#Get all your data into a python dictionary, organized exactly like the JSON output you are looking for.
data = {<get all your data into the python dictionary>}
#Open an output file, named however you please. We suggest your file name be <ModelShortName>.<PredictionWindowStartTime>.<IssueTime>.json
with open('YourModelShortName.PWStartTime.IssueTime.json', 'w') as outfile:
json.dump(data, outfile)
If you really don't want to do that, you can follow these steps:
- Define dataD as a python dictionary with all your values (see sep_example_python_dictionary_format.py as an example)
- Set the following variables: . output_file_basename (string, the basename you want the output file to have, otherwise it will be .<issue_time>.<current_time>.json) . output_dir (string, full path to directory to hold the output JSON files) . log_msgs (boolean, True if you want to log messages, False if you don’t want to log messages) . log_dir (string, full path to log directory. Feel free to use ‘./’, the current directory.) . log_starter (string, beginning of the log filename NOTE: date and time will be added automatically).
- Add the following to your code:
from sep_json_writer import ConvertToJSON
ConvertToJSON(dataD, output_file_basename, output_dir, log_msgs, log_dir, log_starter)
Method 2 - Call the helper script with command line arguments
This section has
usage: sep_json_writer.py
[-h]
[-o OUTPUT_FILENAME]
[-d OUTPUT_DIR]
[-n]
[-l LOG_DIR]
[-b LOG_STARTER]
[--import-data-dictionary]
[--data-dictionary DATA_DICTIONARY]
[--contact-name CONTACT_NAME]
[--contact-email CONTACT_EMAIL]
[--model-short-name MODEL_SHORT_NAME]
[--spase-id SPASE_ID]
[--issue-time ISSUE_TIME]
[--mode MODE]
[--cme-start-time CME_START_TIME]
[--cme-liftoff-time CME_LIFTOFF_TIME]
[--cme-lat CME_LAT]
[--cme-lon CME_LON]
[--cme-pa CME_PA]
[--cme-half-width CME_HALF_WIDTH]
[--cme-speed CME_SPEED]
[--cme-acceleration CME_ACCELERATION]
[--cme-height CME_HEIGHT]
[--cme-time-at-height-time CME_TIME_AT_HEIGHT_TIME]
[--cme-time-at-height-height CME_TIME_AT_HEIGHT_HEIGHT]
[--cme-coordinates CME_COORDINATES]
[--cme-catalog CME_CATALOG]
[--cme-catalog-id CME_CATALOG_ID]
[--cme-urls [CME_URLS [CME_URLS ...]]]
[--flare-last-data-time FLARE_LAST_DATA_TIME]
[--flare-start-time FLARE_START_TIME]
[--flare-peak-time FLARE_PEAK_TIME]
[--flare-end-time FLARE_END_TIME]
[--flare-location FLARE_LOCATION]
[--flare-intensity FLARE_INTENSITY]
[--flare-integrated-intensity FLARE_INTEGRATED_INTENSITY]
[--flare-noaa-region FLARE_NOAA_REGION]
[--flare-urls [FLARE_URLS [FLARE_URLS ...]]]
[--cme-sim-model CME_SIM_MODEL]
[--cme-sim-completion-time CME_SIM_COMPLETION_TIME]
[--cme-sim-urls [CME_SIM_URLS [CME_SIM_URLS ...]]]
[--pi-observatory PI_OBSERVATORY]
[--pi-instrument PI_INSTRUMENT]
[--pi-last-data-time PI_LAST_DATA_TIME]
[--pi-ongoing-events-start-time [PI_ONGOING_EVENTS_START_TIME [PI_ONGOING_EVENTS_START_TIME ...]]]
[--pi-ongoing-events-threshold [PI_ONGOING_EVENTS_THRESHOLD [PI_ONGOING_EVENTS_THRESHOLD ...]]]
[--pi-ongoing-events-energy-min [PI_ONGOING_EVENTS_ENERGY_MIN [PI_ONGOING_EVENTS_ENERGY_MIN ...]]]
[--pi-ongoing-events-energy-max [PI_ONGOING_EVENTS_ENERGY_MAX [PI_ONGOING_EVENTS_ENERGY_MAX ...]]]
[--magcon-method [MAGCON_METHOD [MAGCON_METHOD ...]]]
[--magcon-lat [MAGCON_LAT [MAGCON_LAT ...]]]
[--magcon-lon [MAGCON_LON [MAGCON_LON ...]]]
[--magcon-angle-great-circle [MAGCON_ANGLE_GREAT_CIRCLE [MAGCON_ANGLE_GREAT_CIRCLE ...]]]
[--magcon-angle-lat [MAGCON_ANGLE_LAT [MAGCON_ANGLE_LAT ...]]]
[--magcon-angle-lon [MAGCON_ANGLE_LON [MAGCON_ANGLE_LON ...]]]
[--magcon-solar-wind-observatory [MAGCON_SOLAR_WIND_OBSERVATORY [MAGCON_SOLAR_WIND_OBSERVATORY ...]]]
[--magcon-solar-wind-speed [MAGCON_SOLAR_WIND_SPEED [MAGCON_SOLAR_WIND_SPEED ...]]]
[--magnetogram-observatory [MAGNETOGRAM_OBSERVATORY [MAGNETOGRAM_OBSERVATORY ...]]]
[--magnetogram-instrument [MAGNETOGRAM_INSTRUMENT [MAGNETOGRAM_INSTRUMENT ...]]]
[--magnetogram-product [MAGNETOGRAM_PRODUCT [MAGNETOGRAM_PRODUCT ...]]]
[--magnetogram-product-last-data-time [MAGNETOGRAM_PRODUCT_LAST_DATA_TIME [MAGNETOGRAM_PRODUCT_LAST_DATA_TIME ...]]]
[--energy-min ENERGY_MIN]
[--energy-max ENERGY_MAX]
[--energy-units ENERGY_UNITS]
[--species SPECIES]
[--location LOCATION]
[--prediction-window PREDICTION_WINDOW PREDICTION_WINDOW]
[--peak-intensity PEAK_INTENSITY]
[--peak-intensity-units PEAK_INTENSITY_UNITS]
[--peak-intensity-uncertainty PEAK_INTENSITY_UNCERTAINTY]
[--peak-intensity-uncertainty-low PEAK_INTENSITY_UNCERTAINTY_LOW]
[--peak-intensity-uncertainty-high PEAK_INTENSITY_UNCERTAINTY_HIGH]
[--peak-intensity-time PEAK_INTENSITY_TIME]
[--peak-intensity-esp PEAK_INTENSITY_ESP]
[--peak-intensity-esp-units PEAK_INTENSITY_ESP_UNITS]
[--peak-intensity-esp-uncertainty PEAK_INTENSITY_ESP_UNCERTAINTY]
[--peak-intensity-esp-uncertainty-low PEAK_INTENSITY_ESP_UNCERTAINTY_LOW]
[--peak-intensity-esp-uncertainty-high PEAK_INTENSITY_ESP_UNCERTAINTY_HIGH]
[--peak-intensity-esp-time PEAK_INTENSITY_ESP_TIME]
[--peak-intensity-max PEAK_INTENSITY_MAX]
[--peak-intensity-max-units PEAK_INTENSITY_MAX_UNITS]
[--peak-intensity-max-uncertainty PEAK_INTENSITY_MAX_UNCERTAINTY]
[--peak-intensity-max-uncertainty-low PEAK_INTENSITY_MAX_UNCERTAINTY_LOW]
[--peak-intensity-max-uncertainty-high PEAK_INTENSITY_MAX_UNCERTAINTY_HIGH]
[--peak-intensity-max-time PEAK_INTENSITY_MAX_TIME]
[--fluences [FLUENCES [FLUENCES ...]]]
[--fluence-units [FLUENCE_UNITS [FLUENCE_UNITS ...]]]
[--fluence-uncertainty-low [FLUENCE_UNCERTAINTY_LOW [FLUENCE_UNCERTAINTY_LOW ...]]]
[--fluence-uncertainty-high [FLUENCE_UNCERTAINTY_HIGH [FLUENCE_UNCERTAINTY_HIGH ...]]]
[--event-length-start-times [EVENT_LENGTH_START_TIMES [EVENT_LENGTH_START_TIMES ...]]]
[--event-length-end-times [EVENT_LENGTH_END_TIMES [EVENT_LENGTH_END_TIMES ...]]]
[--event-length-threshold-starts [EVENT_LENGTH_THRESHOLD_STARTS [EVENT_LENGTH_THRESHOLD_STARTS ...]]]
[--event-length-threshold-units [EVENT_LENGTH_THRESHOLD_UNITS [EVENT_LENGTH_THRESHOLD_UNITS ...]]]
[--thresh-crossing-times [THRESH_CROSSING_TIMES [THRESH_CROSSING_TIMES ...]]]
[--thresh-uncertainties [THRESH_UNCERTAINTIES [THRESH_UNCERTAINTIES ...]]]
[--crossing-thresholds [CROSSING_THRESHOLDS [CROSSING_THRESHOLDS ...]]]
[--crossing-threshold-units [CROSSING_THRESHOLD_UNITS [CROSSING_THRESHOLD_UNITS ...]]]
[--probabilities [PROBABILITIES [PROBABILITIES ...]]]
[--prob-uncertainties [PROB_UNCERTAINTIES [PROB_UNCERTAINTIES ...]]]
[--prob-thresholds [PROB_THRESHOLDS [PROB_THRESHOLDS ...]]]
[--prob-threshold-units [PROB_THRESHOLD_UNITS [PROB_THRESHOLD_UNITS ...]]]
[--all-clear ALL_CLEAR]
[--all-clear-threshold ALL_CLEAR_THRESHOLD]
[--all-clear-threshold-units ALL_CLEAR_THRESHOLD_UNITS]
[--all-clear-probability-threshold ALL_CLEAR_PROBABILITY_THRESHOLD]
[--sep-profile SEP_PROFILE]
[--native-id NATIVE_ID]
Details about the optional arguments for sep_json_writer.py
flags | description | required | |
---|---|---|---|
-h, --help | show this help message and exit | Optional Supercedes all other arguments | |
-o OUTPUT_FILENAME, --output OUTPUT_FILENAME | JSON output filename. | Optional Default is the <model_short_name>.<prediction_window_start_time>.<issue_time>.json | |
-d OUTPUT_DIR, --output-dir OUTPUT_DIR | Full path to output directory. Default is current directory. | Optional Default is the current directory. | |
-n, --no-logging | Turn off logging. | Optional It is turned on by default. | |
-l LOG_DIR, --log-dir LOG_DIR | Full path to log directory. | Optional Default is the current directory. | |
-b LOG_STARTER, --log-basename LOG_STARTER | Beginning of the log filename (date and time will be added automatically). | Optional Default is 'isep_model_run'. | |
--import-data-dictionary | import the data dictionary (in the 'sep_forecast_submission_dataDict' variable from a file named 'named input_sep.py', OR use the --data-dictionary option to specify the full path to the file that holds the 'sep_forecast_submission_dataDict' variable. | Optional | |
--data-dictionary DATA_DICTIONARY | full path to the file holding the 'sep_forecast_submission_dataDict' data dictionary. NOTE: this is ignored if --import-data-dictionary is not used. | Optional | |
--model-short-name [MODEL_SHORT_NAME [MODEL_SHORT_NAME ...]] | Short name (e.g. acronym) of model to appear on scoreboard. Consider including version number with acronym if distinction needed. 30 character limit. | Required | |
--spase-id SPASE_ID | Link to URL of full model description metadata in CCMC metadata registry in SPASE format (contact CCMC to register your model). | Required | |
--issue-time ISSUE_TIME | Forecast issue time (e.g. model run is complete and forecast is created) | Required | |
--mode MODE | Allowed values: forecast, historical, nowcast, simulated_realtime_forecast. Default is 'forecast'. | Optional | |
--cme-start-time CME_START_TIME | Provide if forecast is issued based on a CME trigger. Timestamp of 1st coronagraph image CME is visible in. | Optional | |
--cme-liftoff-time CME_LIFTOFF_TIME | Timestamp of coronagraph image with 1st indication of CME liftoff (used by CACTUS). | Optional | |
--cme-lat CME_LAT | CME latitude (deg). | Optional, but required with cme-lon | |
--cme-lon CME_LON | CME latitude (deg). | Optional, but required with cme-lat | |
--cme-pa CME_PA | CME plane-of-sky position angle (measured from solar north in degrees counter-clockwise ). | Optional | |
--cme-half-width CME_HALF_WIDTH | CME half-width (deg). | Optional | |
--cme-speed CME_SPEED | CME speed (km/s). | Optional | |
--cme-acceleration CME_ACCELERATION | CME acceleration (km/s^2). | Optional | |
--cme-height CME_HEIGHT | CME height at which the above parameters were derived (solar radii from Sun center). | Optional | |
--cme-time-at-height-time CME_TIME_AT_HEIGHT_TIME | CME time at specificied height. | Optional, required with cme_time_at_height_height | |
--cme-time-at-height-height CME_TIME_AT_HEIGHT_HEIGHT | Specificied height in solar radii. | Optional, required with cme_time_at_height_time | |
--cme-coordinates CME_COORDINATES | Coordinate system for CME lat/lon parameters (e.g. HEEQ or Carrington) | Optional, but required with cme-lat or cme-lon | |
--cme-catalog CME_CATALOG | Name of catalog where CME information was pulled from. Allowed values: ARTEMIS, DONKI, HELCATS, JHU APL, CACTUS_NRL, CACTUS_SIDC, CORIMP, SEEDS, SOHO_CDAW, STEREO_COR1, SWPC (contact us to add a new catalog name) | Optional | |
--cme-catalog-id CME_CATALOG_ID | ID value for the catalog where CME information was pulled from. | Required if catalog value is DONKI, otherwise it is optional | |
--cme-urls [CME_URLS [CME_URLS ...]] | List of urls where CME information can be found, or information was pulled from. | Optional, more than one is allowed | |
--flare-last-data-time FLARE_LAST_DATA_TIME | Last time data timestamp that was used to create forecast (relevant for forecasts issued before flare end times) | Optional | |
--flare-start-time FLARE_START_TIME | Flare start time | Optional | |
--flare-peak-time FLARE_PEAK_TIME | Flare peak time | Optional | |
--flare-end-time FLARE_END_TIME | Flare end time | Optional | |
--flare-location FLARE_LOCATION | Flare location in Stonyhurst coordinates (i.e., N00W00/S00E00 format). | Optional | |
--flare-intensity FLARE_INTENSITY | Flare intensity (W/m^2) | Optional | |
--flare-integrated-intensity FLARE_INTEGRATED_INTENSITY | Flare integrated intensity (J/m^2) | Optional | |
--flare-noaa-region FLARE_NOAA_REGION | Associated NOAA active region number (including the preceding 1) | Optional | |
--flare-urls [FLARE_URLS [FLARE_URLS ...]] | List of urls where flare information can be found, or information was pulled from. | Optional, more than one is allowed | |
--cme-sim-model CME_SIM_MODEL | Model name | Optional | |
--cme-sim-completion-time CME_SIM_COMPLETION_TIME | Simulation completion time | Optional, required if cme-sim-model is used | |
--cme-sim-urls [CME_SIM_URLS [CME_SIM_URLS ...]] | List of urls where simulation information can be found, or information was pulled from. | Optional, more than one is allowed | |
--pi-observatory PI_OBSERVATORY | Name of observatory/spacecraft data are from. | Optional | |
--pi-instrument PI_INSTRUMENT | Name of instrument data are from. | Optional, required if pi-observatory used | |
--pi-last-data-time PI_LAST_DATA_TIME | Last time data timestamp used to create forecast. | Optional, required if pi-observatory used | |
--pi-ongoing-events-start-time [PI_ONGOING_EVENTS_START_TIME [PI_ONGOING_EVENTS_START_TIME ...]] | If an ongoing event triggers your forecast, this is the start time. | Optional | |
--pi-ongoing-events-threshold [PI_ONGOING_EVENTS_THRESHOLD [PI_ONGOING_EVENTS_THRESHOLD ...]] | If an ongoing event triggers your forecast, this is the threshold used to define the event in pfu. | Optional, required if pi-ongoing-events-start-time used | |
--pi-ongoing-events-energy-min [PI_ONGOING_EVENTS_ENERGY_MIN [PI_ONGOING_EVENTS_ENERGY_MIN ...]] | If an ongoing event triggers your forecast, this is the min of energy channel range in MeV. | Optional, required if pi-ongoing-events-start-time used | |
--pi-ongoing-events-energy-max [PI_ONGOING_EVENTS_ENERGY_MAX [PI_ONGOING_EVENTS_ENERGY_MAX ...]] | If an ongoing event triggers your forecast, this is the max of energy channel range in MeV. -1 represents an unbounded integral channel. | Optional, required if pi-ongoing-events-start-time used | |
--magcon-method [MAGCON_METHOD [MAGCON_METHOD ...]] | Provide if specific magnetic connectivity information was used to produce your forecast method string required, if magnetic_connectivity used. allowed values: Parker Spiral, PFSS-Parker Spiral, WSA, WSA-ENLIL, ADAPT-WSA-ENLIL (contact us to add your method to this format). | Optional, required if magnetic_connectivity was used | |
--magcon-lat [MAGCON_LAT [MAGCON_LAT ...]] | Provide if specific magnetic connectivity information was used to produce your forecast method string required, if magnetic_connectivity used. Latitude (deg) position of magnetic field line footpoint linking the observing spacecraft to the Sun (in Stonyhurst coordinates). | Optional | |
--magcon-lon [MAGCON_LON [MAGCON_LON ...]] | Provide if specific magnetic connectivity information was used to produce your forecast method string required, if magnetic_connectivity used. Longitude (deg) position of magnetic field line footpoint linking the observing spacecraft to the Sun (in Stonyhurst coordinates). | Optional, required, if magnetic_connectivity used | |
--magcon-angle-great-circle [MAGCON_ANGLE_GREAT_CIRCLE [MAGCON_ANGLE_GREAT_CIRCLE ...]] | Provide if specific magnetic connectivity information was used to produce your forecast method string required, if magnetic_connectivity used. Angle (deg) between the related solar event and the foot point of the magnetic field line linking the observing spacecraft to the Sun. | Optional | |
--magcon-angle-lat [MAGCON_ANGLE_LAT [MAGCON_ANGLE_LAT ...]] | Provide if specific magnetic connectivity information was used to produce your forecast method string required, if magnetic_connectivity used. Angle between the related solar event and the foot point of the magnetic field line linking the observing spacecraft to the Sun. connection angle lat = solar event lat - magnetic connectivity footpoint lat | Optional | |
--magcon-angle-lon [MAGCON_ANGLE_LON [MAGCON_ANGLE_LON ...]] | Provide if specific magnetic connectivity information was used to produce your forecast method string required, if magnetic_connectivity used. Angle between the related solar event and the foot point of the magnetic field line linking the observing spacecraft to the Sun. connection angle lon = solar event lon - magnetic connectivity footpoint lon | Optional, required, if connection_angle used). | |
--magcon-solar-wind-observatory [MAGCON_SOLAR_WIND_OBSERVATORY [MAGCON_SOLAR_WIND_OBSERVATORY ...]] | Provide if specific magnetic connectivity information was used to produce your forecast method string required, if magnetic_connectivity used. Use if a certain solar wind speed was assumed to compute the magnetic connectivity observatory string optional Name of observatory/spacecraft data are from | Optional, required, if solar_wind used | |
--magcon-solar-wind-speed [MAGCON_SOLAR_WIND_SPEED [MAGCON_SOLAR_WIND_SPEED ...]] | Provide if specific magnetic connectivity information was used to produce your forecast method string required, if magnetic_connectivity used. Use if a certain solar wind speed was assumed to compute the magnetic connectivity. Assumed solar wind speed to compute magnetic connectivity. | Optional, required, if solar_wind used | |
--magnetogram-observatory [MAGNETOGRAM_OBSERVATORY [MAGNETOGRAM_OBSERVATORY ...]] | Provide if a magnetogram was used to produce your forecast. Name of observatory/spacecraft data are from. | Optional, required if magnetogram was used. | |
--magnetogram-instrument [MAGNETOGRAM_INSTRUMENT [MAGNETOGRAM_INSTRUMENT ...]] | Provide if a magnetogram was used to produce your forecast. Name of instrument data are from. | Optional, required if magnetogram was used. | |
--magnetogram-product [MAGNETOGRAM_PRODUCT [MAGNETOGRAM_PRODUCT ...]] | Provide if a magnetogram was used to produce your forecast. Name of data product used. | Optional | |
--magnetogram-product-last-data-time [MAGNETOGRAM_PRODUCT_LAST_DATA_TIME [MAGNETOGRAM_PRODUCT_LAST_DATA_TIME ...]] | Provide if a magnetogram was used to produce your forecast Last time data timestamp available at the time of forecast. | Optional, required if magnetogram was used. | |
--energy-min ENERGY_MIN | Min of energy channel range. | Required | |
--energy-max ENERGY_MAX | Max of energy channel range. -1 represented an unbounded integral channel. | Required | |
--energy-units ENERGY_UNITS | Energy channel units | Required | |
--species SPECIES | Valid values are: electron, proton, helium, helium3, helium4, oxygen, iron, ion. | Required | |
--location LOCATION | Valid values are: mercury, venus, earth, mars, psp, stereoa, stereob, dawn, juno, L1, L2, L4, L5. | Required | |
--prediction-window PREDICTION_WINDOW PREDICTION_WINDOW | Start time and end time (in that order) of the prediction window that is relevant to the given data. Start of forecast prediction window must be within one hour of forecast issue time when in 'forecast' mode. | Required | |
--peak-intensity PEAK_INTENSITY | Forecast peak intensity value. | Optional | |
--peak-intensity-units PEAK_INTENSITY_UNITS | Forecast peak intensity value units. | Optional, required if peak-intensity used | |
--peak-intensity-uncertainty PEAK_INTENSITY_UNCERTAINTY | Forecast peak intensity uncertainty value | same units as peak intensity). | Optional |
--peak-intensity-uncertainty-low PEAK_INTENSITY_UNCERTAINTY_LOW | Forecast peak intensity lowest uncertainty value (same units as peak intensity). | Optional, required if peak-intensity-uncertainty-high used. Ignored if peak-intensity-uncertainty used. | |
--peak-intensity-uncertainty-high PEAK_INTENSITY_UNCERTAINTY_HIGH | Forecast peak intensity highest uncertainty value (same units as peak intensity). | Optional, required if peak-intensity-uncertainty-low used. Ignored if peak-intensity-uncertainty used. | |
--peak-intensity-time PEAK_INTENSITY_TIME | Forecast time for reaching peak intensity value. | Optional | |
--peak-intensity-esp PEAK_INTENSITY_ESP | Forecast peak intensity value in the vicinity of shock passage. | Optional | |
--peak-intensity-esp-units PEAK_INTENSITY_ESP_UNITS | Forecast peak intensity units in the vicinity of shock passage. | Optional, required if peak-intensity-esp used | |
--peak-intensity-esp-uncertainty PEAK_INTENSITY_ESP_UNCERTAINTY | Forecast peak intensity in the vicinity of shock passage uncertainty value (same units as peak intensity). | Optional, cannot be used with either peak-intensity-esp-uncertainty-low or peak-intensity-esp-uncertainty-high | |
--peak-intensity-esp-uncertainty-low PEAK_INTENSITY_ESP_UNCERTAINTY_LOW | Forecast peak intensity in the vicinity of shock passage lowest uncertainty value (same units as peak intensity). | Optional, required if peak-intensity-esp-uncertainty-high used. Cannot be used if peak-intensity-esp-uncertainty is used. | |
--peak-intensity-esp-uncertainty-high PEAK_INTENSITY_ESP_UNCERTAINTY_HIGH | Forecast peak intensity in the vicinity of shock passage highest uncertainty value (same units as peak intensity). | Optional, required if peak-intensity-esp-uncertainty-low used. Cannot be used if peak-intensity-esp-uncertainty is used. | |
--peak-intensity-esp-time PEAK_INTENSITY_ESP_TIME | Forecast time for reaching peak intensity value in the vicinity of shock passage. | Optional | |
--peak-intensity-max PEAK_INTENSITY_MAX | Forecast max peak intensity for the entire prediction window value. | Optional | |
--peak-intensity-max-units PEAK_INTENSITY_MAX_UNITS | Forecast max peak intensity value units | Optional, required if peak-intensity-max used | |
--peak-intensity-max-uncertainty PEAK_INTENSITY_MAX_UNCERTAINTY | Forecast max peak intensity uncertainty value (same units as intensity) (for symmetric uncertainties). | Optional, cannot be used with either peak-intensity-max-uncertainty-low or peak-intensity-max-uncertainty-high | |
--peak-intensity-max-uncertainty-low PEAK_INTENSITY_MAX_UNCERTAINTY_LOW | Forecast max peak intensity low uncertainty value (same units as peak intensity). | Optional, required if peak-intensity-max-uncertainty-high used. Cannot be used if peak-intensity-max-uncertainty is used. | |
--peak-intensity-max-uncertainty-high PEAK_INTENSITY_MAX_UNCERTAINTY_HIGH | Forecast max peak intensity high uncertainty value (same units as peak intensity). | Optional, required if peak-intensity-max-uncertainty-low used. Cannot be used if peak-intensity-max-uncertainty is used. | |
--peak-intensity-max-time PEAK_INTENSITY_MAX_TIME | Forecast time for reaching max peak intensity value. | Optional | |
--fluences [FLUENCES [FLUENCES ...]] | Forecast fluence value (corresponds to event length). | Optional | |
--fluence-units [FLUENCE_UNITS [FLUENCE_UNITS ...]] | Forecast fluence units. | Optional, required if fluence used | |
--fluence-uncertainty-low [FLUENCE_UNCERTAINTY_LOW [FLUENCE_UNCERTAINTY_LOW ...]] | Forecast fluence lowest uncertainty value (same units as fluence). | Optional, required if fluence-uncertainty-high used. | |
--fluence-uncertainty-high [FLUENCE_UNCERTAINTY_HIGH [FLUENCE_UNCERTAINTY_HIGH ...]] | Forecast fluence highest uncertainty value (same units as fluence). | Optional, required if fluence-uncertainty-low used. | |
--event-length-start-times [EVENT_LENGTH_START_TIMES [EVENT_LENGTH_START_TIMES ...]] | Event length must fall within prediction window. Forecast energetic particle event start time ('onset' time). | Optional | |
--event-length-end-times [EVENT_LENGTH_END_TIMES [EVENT_LENGTH_END_TIMES ...]] | Forecast energetic particle event end time. | Optional | |
--event-length-threshold-starts [EVENT_LENGTH_THRESHOLD_STARTS [EVENT_LENGTH_THRESHOLD_STARTS ...]] | Threshold used to extract start times. | Optional, required if event-length-start-time used | |
--event-length-threshold-ends [EVENT_LENGTH_THRESHOLD_ENDS [EVENT_LENGTH_THRESHOLD_ENDS ...]] | Threshold used to extract end times. | Optional | |
--event-length-threshold-units [EVENT_LENGTH_THRESHOLD_UNITS [EVENT_LENGTH_THRESHOLD_UNITS ...]] | Units of threshold. | Optional, required if event-length-start-time used | |
--thresh-crossing-times [THRESH_CROSSING_TIMES [THRESH_CROSSING_TIMES ...]] | Multiple threshold_crossings can be provided for the same forecast energy channel. Forecast threshold crossing time. | Optional, more than one is allowed | |
--thresh-uncertainties [THRESH_UNCERTAINTIES [THRESH_UNCERTAINTIES ...]] | Forecast crossing time uncertainty in hours. | Optional, more than one is allowed | |
--crossing-thresholds [CROSSING_THRESHOLDS [CROSSING_THRESHOLDS ...]] | Particle intensity threshold value crossing time refers to. | Optional, required if thresh-crossing-times used, more than one is allowed | |
--crossing-threshold-units [CROSSING_THRESHOLD_UNITS [CROSSING_THRESHOLD_UNITS ...]] | Units of threshold. | Optional, required if thresh-crossing-times used, more than one is allowed | |
--probabilities [PROBABILITIES [PROBABILITIES ...]] | Multiple probabilities can be provided for the same forecast energy channel. forecast probability value (range 0 to 1). | Optional, more than one is allowed | |
--prob-uncertainties [PROB_UNCERTAINTIES [PROB_UNCERTAINTIES ...]] | Plus/minus error bar for probability_value (in probability_value units). | Optional, more than one is allowed | |
--prob-thresholds [PROB_THRESHOLDS [PROB_THRESHOLDS ...]] | Particle intensity threshold value probability forecast refers to. | Optional, required if probabilities is used, more than one is allowed | |
--prob-threshold-units [PROB_THRESHOLD_UNITS [PROB_THRESHOLD_UNITS ...]] | Units of threshold. | Optional, required if probabilities is used, more than one is allowed | |
--all-clear ALL_CLEAR | There are three situations for setting all_clear_boolean=false: (1) for >10MeV energy channel, your forecast of peak intensity OR threshold crossing exceeds 10 pfu OR your probability forecast for a threshold of 10 pfu exceeds your custom probability_threshold; (2) for the >100MeV energy channel, your forecast of peak intensity OR threshold crossing exceeds 1 pfu OR your probability forecast for a threshold of 1 pfu exceeds your custom probability_threshold; (3) for your custom (non-integral) energy channel, your forecast peak intensity OR threshold crossing exceeds your custom threshold. NOTE: Custom cases are being stored, but will not be used in the all-clear scoreboard display. | Optional | |
--all-clear-threshold ALL_CLEAR_THRESHOLD | Particle intensity threshold value all_clear_boolean refers to. Can be 10 pfu for >10MeV channel, 1 pfu for >100MeV channel, or a custom threshold value. | Optional, required if all-clear is used | |
--all-clear-threshold-units ALL_CLEAR_THRESHOLD_UNITS | Units of threshold. | Optional, required if all-clear is used | |
--all-clear-probability-threshold ALL_CLEAR_PROBABILITY_THRESHOLD | Probability threshold value all_clear_boolean refers to. Must specify this threshold if setting all_clear_boolean based on probability forecast. | Optional | |
--sep-profile SEP_PROFILE | Text file with 2 columns: datetime string and predicted SEP intensity for this energy channel. | Optional | |
--native-id NATIVE_ID | Specify only if forecast has a native id from your model run. | Optional |
Sample Commands and Resulting Output
Sample 1:
Simple Command line example, where only one probability forecast is being made
./sep_json_writer.py --model-short-name MAG4-LOS-FE --spase-id spase://CCMC/SimulationModel/MAG4/v20190127 --issue-time 2017-09-10T23:30Z --mode forecast --energy-min 10 --energy-max -1 --energy-units MeV --species proton --location earth --prediction-window 2017-09-11T00:00Z 2017-09-11T23:59Z --probabilities 0.85 --prob-uncertainties 0.08 --prob-thresholds 10 --prob-threshold-units pfu --all-clear False --all-clear-threshold 10.0 --all-clear-threshold-units pfu --all-clear-probability-threshold 0.3
It is hard to read all those values when they are on the same line, so let's list all the arguments on their own line for readability.
./sep_json_writer.py
--model-short-name MAG4-LOS-FE
--spase-id spase://CCMC/SimulationModel/MAG4/v20190127
--issue-time 2017-09-10T23:30Z
--mode forecast
--energy-min 10
--energy-max -1
--energy-units MeV
--species proton
--location earth
--prediction-window 2017-09-11T00:00Z 2017-09-11T23:59Z
--probabilities 0.85
--prob-uncertainties 0.08
--prob-thresholds 10
--prob-threshold-units pfu
--all-clear False
--all-clear-threshold 10.0
--all-clear-threshold-units pfu
--all-clear-probability-threshold 0.3
JSON Output from the Previous Example
{
"sep_forecast_submission": {
"model": {
"short_name": "MAG4-LOS-FE",
"spase_id": "spase://CCMC/SimulationModel/MAG4/v20190127"
},
"issue_time": "2017-09-10T23:30Z",
"mode": "forecast",
"forecasts": [
{
"energy_channel": {
"min": "10",
"max": "-1",
"units": "MeV"
},
"species": "proton",
"location": "earth",
"prediction_window": {
"start_time": "2017-09-11T00:00Z",
"end_time": "2017-09-11T23:59Z"
},
"probabilities": [
{
"probability_value": "0.85",
"uncertainty": "0.08",
"threshold": "10",
"threshold_units": "pfu"
}
],
"all_clear": {
"all_clear_boolean": false,
"threshold": "10.0",
"threshold_units": "pfu",
"probability_threshold": "0.3"
}
}
]
}
}
Sample 2:
Another command line example, where multiple probability forecasts are being made
./sep_json_writer.py --model-short-name MAG4_LOS_FE --spase-id spase://CCMC/SimulationModel/MAG4/v20190127 --issue-time 2017-09-10T23:30Z --mode forecast --energy-min 10 --energy-max -1 --energy-units MeV --species proton --location earth --prediction-window 2017-09-11T00:00Z 2017-09-11T23:59Z --probabilities 0.85 0.22 --prob-uncertainties 0.08 None --prob-thresholds 10 100.0 --prob-threshold-units pfu pfu --all-clear False --all-clear-threshold 10.0 --all-clear-threshold-units pfu --all-clear-probability-threshold 0.3 --energy-min 100 --energy-max -1 --energy-units MeV --species proton --location earth --prediction-window 2017-09-11T00:00Z 2017-09-11T23:59Z --probabilities 0.01 --prob-uncertainties None --prob-thresholds 1 --prob-threshold-units pfu --all-clear True --all-clear-threshold 1.0 --all-clear-threshold-units pfu --all-clear-probability-threshold 0.2
Here's that same example in a more human-readable format:
./sep_json_writer.py
--model-short-name MAG4_LOS_FE
--spase-id spase://CCMC/SimulationModel/MAG4/v20190127
--issue-time 2017-09-10T23:30Z
--mode forecast
--energy-min 10
--energy-max -1
--energy-units MeV
--species proton
--location earth
--prediction-window 2017-09-11T00:00Z 2017-09-11T23:59Z
--probabilities 0.85 0.22
--prob-uncertainties 0.08 None
--prob-thresholds 10 100.0
--prob-threshold-units pfu pfu
--all-clear False
--all-clear-threshold 10.0
--all-clear-threshold-units pfu
--all-clear-probability-threshold 0.3
--energy-min 100
--energy-max -1
--energy-units MeV
--species proton
--location earth
--prediction-window 2017-09-11T00:00Z 2017-09-11T23:59Z
--probabilities 0.01
--prob-uncertainties None
--prob-thresholds 1
--prob-threshold-units pfu
--all-clear True
--all-clear-threshold 1.0
--all-clear-threshold-units pfu
--all-clear-probability-threshold 0.2
JSON Output from the Previous Example
{ "sep_forecast_submission": {
"model": {
"short_name": "MAG4_LOS_FE",
"spase_id": "spase://CCMC/SimulationModel/MAG4/v20190127"
},
"issue_time": "2017-09-10T23:30Z",
"mode": "forecast",
"forecasts": [
{
"energy_channel": {
"min": "10",
"max": "-1",
"units": "MeV"
},
"species": "proton",
"location": "earth",
"prediction_window": {
"start_time": "2017-09-11T00:00Z",
"end_time": "2017-09-11T23:59Z"
},
"probabilities": [
{
"probability_value": "0.85",
"uncertainty": "0.08",
"threshold": "10",
"threshold_units": "pfu"
},
{
"probability_value": "0.22",
"threshold": "100.0",
"threshold_units": "pfu"
}
],
"all_clear": {
"all_clear_boolean": false,
"threshold": "10.0",
"threshold_units": "pfu",
"probability_threshold": "0.3"
}
},
{
"energy_channel": {
"min": "100",
"max": "-1",
"units": "MeV"
},
"species": "proton",
"location": "earth",
"prediction_window": {
"start_time": "2017-09-11T00:00Z",
"end_time": "2017-09-11T23:59Z"
},
"probabilities": [
{
"probability_value": "0.01",
"threshold": "1",
"threshold_units": "pfu"
}
],
"all_clear": {
"all_clear_boolean": true,
"threshold": "1.0",
"threshold_units": "pfu",
"probability_threshold": "0.2"
}
}
]
} }
Sample 3:
Another command line example, where multiple intensity/flux forecasts are being made, with model triggers
./sep_json_writer.py --model-short-name MODEL ACRONYM --spase-id spase://CCMC/SimulationModel/MODEL_NAME1/VERSION --issue-time 2017-09-10T20:00Z --mode forecast --cme-start-time 2017-09-10T16:06Z --cme-lat -9 --cme-lon 108 --cme-pa 261 --cme-half-width 70 --cme-speed 2500 --cme-height 21.5 --cme-time-at-height-time 2017-09-10T17:15Z --cme-time-at-height-height 21.5 --cme-coordinates HEEQ --cme-catalog DONKI --cme-urls [https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/CME/13107/4](https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/CME/13107/4 "https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/CME/13107/4") --cme-sim-model WSA-ENLIL+Cone --cme-sim-completion-time 2017-09-11T09:42Z --cme-sim-urls [https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/WSA-ENLIL/13114/1](https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/WSA-ENLIL/13114/1 "https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/WSA-ENLIL/13114/1") --energy-min 10 --energy-max -1 --energy-units MeV --species proton --location earth --prediction-window 2017-09-10T17:15Z 2017-09-17T00:00Z --peak-intensity 1000.0 --peak-intensity-units pfu --peak-intensity-time 2017-09-11T00:00Z --peak-intensity-esp 100 --peak-intensity-esp-units pfu --peak-intensity-esp-time 2017-09-13T00:00Z --event-length-start-time 2017-09-10T22:00Z --event-length-end-time 2017-09-13T00:00Z --event-length-threshold-start 1.0 --event-length-threshold-units pfu --thresh-crossing-times 2017-09-10T22:00Z --crossing-thresholds 10.0 --crossing-threshold-units pfu --all-clear false --all-clear-threshold 10.0 --all-clear-threshold-units pfu --sep-profile samplesepprofile10MeV.txt --energy-min 100 --energy-max -1 --energy-units MeV --species proton --location earth --prediction-window 2017-09-10T19:30Z 2017-09-17T22:30Z --peak-intensity 10.0 --peak-intensity-units pfu --peak-intensity-time 2017-09-11T01:00Z --peak-intensity-esp None --peak-intensity-esp-units None --peak-intensity-esp-time None --event-length-start-time 2017-09-10T22:00Z --event-length-end-time 2017-09-12T00:00Z --event-length-threshold 0.3 --event-length-threshold-units pfu --thresh-crossing-times 2017-09-10T22:00Z --crossing-thresholds 1.0 --crossing-threshold-units pfu --all-clear false --all-clear-threshold 1.0 --all-clear-threshold-units pfu --sep-profile samplesepprofile100MeV.txt
Here's that same example in a more human-readable format:
./sep_json_writer.py
--model-short-name MODEL ACRONYM
--spase-id spase://CCMC/SimulationModel/MODEL_NAME1/VERSION
--issue-time 2017-09-10T20:00Z
--mode forecast
--cme-start-time 2017-09-10T16:06Z
--cme-lat -9
--cme-lon 108
--cme-pa 261
--cme-half-width 70
--cme-speed 2500
--cme-height 21.5
--cme-time-at-height-time 2017-09-10T17:15Z
--cme-time-at-height-height 21.5
--cme-coordinates HEEQ
--cme-catalog DONKI
--cme-urls [https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/CME/13107/4](https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/CME/13107/4 "https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/CME/13107/4")
--cme-sim-model WSA-ENLIL+Cone
--cme-sim-completion-time 2017-09-11T09:42Z
--cme-sim-urls [https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/WSA-ENLIL/13114/1](https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/WSA-ENLIL/13114/1 "https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/WSA-ENLIL/13114/1")
--energy-min 10
--energy-max -1
--energy-units MeV
--species proton
--location earth
--prediction-window 2017-09-10T17:15Z 2017-09-17T00:00Z
--peak-intensity 1000.0
--peak-intensity-units pfu
--peak-intensity-time 2017-09-11T00:00Z
--peak-intensity-esp 100
--peak-intensity-esp-units pfu
--peak-intensity-esp-time 2017-09-13T00:00Z
--event-length-start-time 2017-09-10T22:00Z
--event-length-end-time 2017-09-13T00:00Z
--event-length-threshold-start 1.0
--event-length-threshold-units pfu
--thresh-crossing-times 2017-09-10T22:00Z
--crossing-thresholds 10.0
--crossing-threshold-units pfu
--all-clear false
--all-clear-threshold 10.0
--all-clear-threshold-units pfu
--sep-profile samplesepprofile10MeV.txt
--energy-min 100
--energy-max -1
--energy-units MeV
--species proton
--location earth
--prediction-window 2017-09-10T19:30Z 2017-09-17T22:30Z
--peak-intensity 10.0
--peak-intensity-units pfu
--peak-intensity-time 2017-09-11T01:00Z
--peak-intensity-esp None
--peak-intensity-esp-units None
--peak-intensity-esp-time None
--event-length-start-time 2017-09-10T22:00Z
--event-length-end-time 2017-09-12T00:00Z
--event-length-threshold 0.3
--event-length-threshold-units pfu
--thresh-crossing-times 2017-09-10T22:00Z
--crossing-thresholds 1.0
--crossing-threshold-units pfu
--all-clear false
--all-clear-threshold 1.0
--all-clear-threshold-units pfu
--sep-profile samplesepprofile100MeV.txt
JSON Output from the Previous Example
{ "sep_forecast_submission": {
"model": {
"short_name": "MODEL ACRONYM",
"spase_id": "spase://CCMC/SimulationModel/MODEL_NAME1/VERSION"
},
"issue_time": "2017-09-10T20:00Z",
"mode": "forecast",
"triggers": [
{
"cme": {
"start_time": "2017-09-10T16:06Z",
"lat": "-9",
"lon": "108",
"pa": "261",
"half_width": "70",
"speed": "2500",
"height": "21.5",
"time_at_height": {
"time": "2017-09-10T17:15Z",
"height": "21.5"
},
"coordinates": "HEEQ",
"catalog": "DONKI",
"urls": [
"[https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/CME/13107/4](https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/CME/13107/4 "https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/CME/13107/4")"
]
}
},
{
"cme_simulation": {
"model": "WSA-ENLIL+Cone",
"simulation_completion_time": "2017-09-11T09:42Z",
"urls": [
"[https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/WSA-ENLIL/13114/1](https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/WSA-ENLIL/13114/1 "https://kauai.ccmc.gsfc.nasa.gov/DONKI/view/WSA-ENLIL/13114/1")"
]
}
}
],
"forecasts": [
{
"energy_channel": {
"min": "10",
"max": "-1",
"units": "MeV"
},
"species": "proton",
"location": "earth",
"prediction_window": {
"start_time": "2017-09-10T17:15Z",
"end_time": "2017-09-17T00:00Z"
},
"peak_intensity": {
"intensity": "1000.0",
"units": "pfu",
"time": "2017-09-11T00:00Z"
},
"peak_intensity_esp": {
"intensity": "100",
"units": "pfu"
},
"event_lengths": [
{
"start_time": "2017-09-10T22:00Z",
"end_time": "2017-09-13T00:00Z",
"threshold_start": "1.0",
"threshold_units": "pfu"
}
],
"threshold_crossings": [
{
"crossing_time": "2017-09-10T22:00Z",
"threshold": "10.0",
"threshold_units": "pfu"
}
],
"all_clear": {
"all_clear_boolean": false,
"threshold": "10.0",
"threshold_units": "pfu"
},
"sep_profile": "samplesepprofile10MeV.txt"
},
{
"energy_channel": {
"min": "100",
"max": "-1",
"units": "MeV"
},
"species": "proton",
"location": "earth",
"prediction_window": {
"start_time": "2017-09-10T19:30Z",
"end_time": "2017-09-17T22:30Z"
},
"peak_intensity": {
"intensity": "10.0",
"units": "pfu",
"time": "2017-09-11T01:00Z"
},
"event_lengths": [
{
"start_time": "2017-09-10T22:00Z",
"end_time": "2017-09-13T00:00Z",
"threshold": "0.3",
"threshold_units": "pfu"
}
],
"threshold_crossings": [
{
"crossing_time": "2017-09-10T22:00Z",
"threshold": "1.0",
"threshold_units": "pfu"
}
],
"all_clear": {
"all_clear_boolean": false,
"threshold": "1.0",
"threshold_units": "pfu"
},
"sep_profile": "samplesepprofile100MeV.txt"
}
]
} }
Method 3 - Make a Python library file with your data and import it
(Note: This is the least recommended method)
- Create a file named input_sep.py in the same directory with the downloaded helper script.
- Inside input_sep.py, put a python dictionary named sep_forecast_submission_dataDict.
The contents of the input_sep.py file will look like this:sep_forecast_submission_dataDict = {_...lots of data here in a python dictionary format...organized exactly like the JSON output you are looking for..._ }
- Then run the script like this on the terminal command line:
./sep_json_writer.py --import-data-dictionary
However, the best way to write your data to a JSON file is to load the JSON library for your language and use it to write out a JSON file. This is the best method to ensure that the JSON is properly formatted.
You can google ' write json file' and get the steps to do that in your programming language.
Contact Dr. M. Leila Mays and/or Joycelyn Jones for additional assistance.