space_weather_module Module

Read and lookup CSSI Space Weather data files (legacy text format).

Compatible with CSSI Space Weather files.

The CSSI Space Weather format contains:

  • F10.7 solar flux (observed and adjusted)
  • F10.7a 81-day centered average
  • Geomagnetic Kp indices (8 values per day, 3-hour periods)
  • Ap indices (geomagnetic activity)

Reference:


Uses

  • module~~space_weather_module~~UsesGraph module~space_weather_module space_weather_module module~jacchia_roberts_kinds jacchia_roberts_kinds module~space_weather_module->module~jacchia_roberts_kinds module~jacchia_roberts_utilities jacchia_roberts_utilities module~space_weather_module->module~jacchia_roberts_utilities iso_fortran_env iso_fortran_env module~jacchia_roberts_kinds->iso_fortran_env module~jacchia_roberts_utilities->module~jacchia_roberts_kinds

Used by

  • module~~space_weather_module~~UsedByGraph module~space_weather_module space_weather_module module~jacchia_roberts_module jacchia_roberts_module module~jacchia_roberts_module->module~space_weather_module

Derived Types

type, public ::  flux_data_type

Space weather data type

Components

Type Visibility Attributes Name Initial
real(kind=dp), public :: mjd = 0.0_dp

Modified Julian Date

real(kind=dp), public :: f107_obs = 0.0_dp

Observed F10.7 solar flux

real(kind=dp), public :: f107_adj = 0.0_dp

Adjusted F10.7 solar flux

real(kind=dp), public :: f107a_obs_ctr = 0.0_dp

Observed F10.7 81-day centered average

real(kind=dp), public :: f107a_adj_ctr = 0.0_dp

Adjusted F10.7 81-day centered average

real(kind=dp), public :: kp(8) = 0.0_dp

Kp indices for 8 3-hour periods

real(kind=dp), public :: ap_avg = 0.0_dp

Average Ap for the day

type, public ::  sw_data_type

Space weather data management type

Components

Type Visibility Attributes Name Initial
integer(kind=ip), private :: n_records = 0

Number of valid records loaded

real(kind=dp), private, allocatable :: mjd(:)

Modified Julian Dates for each record

real(kind=dp), private, allocatable :: f107_obs(:)

Observed F10.7 solar flux for each record

real(kind=dp), private, allocatable :: f107_adj(:)

Adjusted F10.7 solar flux for each record

real(kind=dp), private, allocatable :: f107a_obs_ctr(:)

Observed F10.7 81-day centered average for each record

real(kind=dp), private, allocatable :: f107a_adj_ctr(:)

Adjusted F10.7 81-day centered average for each record

real(kind=dp), private, allocatable :: kp(:,:)

Kp indices for 8 3-hour periods (8, n_records)

real(kind=dp), private, allocatable :: ap_avg(:)

Average Ap for each record

logical, private :: initialized = .false.

Flag to indicate if data has been loaded

real(kind=dp), private :: historic_start = -1.0_dp

First epoch in data

real(kind=dp), private :: historic_end = -1.0_dp

Last daily epoch + 1

real(kind=dp), private :: historic_daily_end = -1.0_dp

Last contiguous daily data epoch

logical, private :: warn_epoch_before = .true.

Flag to warn if requested epoch is before data start

logical, private :: warn_epoch_after = .true.

Flag to warn if requested epoch is after data end

Type-Bound Procedures

procedure, public :: initialize => sw_init
procedure, public :: get_flux_data => sw_get_flux_data
procedure, public :: destroy => sw_cleanup
procedure, private :: get_record => copy_record

Functions

private pure function copy_record(me, idx) result(flux_data)

Copy a single record from the space weather data

Arguments

Type IntentOptional Attributes Name
class(sw_data_type), intent(in) :: me
integer(kind=ip), intent(in) :: idx

Index of the record to copy

Return Value type(flux_data_type)

Output flux data structure


Subroutines

private subroutine sw_init(me, filename, status)

Initialize the space weather module by reading a CSSI file

Arguments

Type IntentOptional Attributes Name
class(sw_data_type), intent(inout) :: me
character(len=*), intent(in) :: filename

Path to CSSI space weather file

integer(kind=ip), intent(out) :: status

Output status (0=success, non-zero=error)

private subroutine sw_get_flux_data(me, mjd, flux_data, status)

Get space weather data for a given Modified Julian Date. Uses direct indexing for daily data and record selection for monthly data

Arguments

Type IntentOptional Attributes Name
class(sw_data_type), intent(inout) :: me
real(kind=dp), intent(in) :: mjd

Modified Julian Date

type(flux_data_type), intent(out) :: flux_data

Output flux data structure

logical, intent(out) :: status

Output status (true=success, false=not initialized)

private subroutine sw_cleanup(me)

Clean up allocated memory

Arguments

Type IntentOptional Attributes Name
class(sw_data_type), intent(inout) :: me