sw_data_type Derived Type

type, public :: sw_data_type

Space weather data management type


Inherited by

type~~sw_data_type~~InheritedByGraph type~sw_data_type sw_data_type type~jacchia_roberts_type jacchia_roberts_type type~jacchia_roberts_type->type~sw_data_type sw_data

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

  • 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)

procedure, public :: get_flux_data => sw_get_flux_data

  • 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)

procedure, public :: destroy => sw_cleanup

  • private subroutine sw_cleanup(me)

    Clean up allocated memory

    Arguments

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

procedure, private :: get_record => copy_record

  • 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

Source Code

   type,public :: sw_data_type
      !! Space weather data management type
      private
      integer(ip) :: n_records = 0              !! Number of valid records loaded
      real(dp), allocatable :: mjd(:)           !! Modified Julian Dates for each record
      real(dp), allocatable :: f107_obs(:)      !! Observed F10.7 solar flux for each record
      real(dp), allocatable :: f107_adj(:)      !! Adjusted F10.7 solar flux for each record
      real(dp), allocatable :: f107a_obs_ctr(:) !! Observed F10.7 81-day centered average for each record
      real(dp), allocatable :: f107a_adj_ctr(:) !! Adjusted F10.7 81-day centered average for each record
      real(dp), allocatable :: kp(:,:)          !! Kp indices for 8 3-hour periods (8, n_records)
      real(dp), allocatable :: ap_avg(:)        !! Average Ap for each record
      logical :: initialized = .false.          !! Flag to indicate if data has been loaded
      real(dp) :: historic_start = -1.0_dp      !! First epoch in data
      real(dp) :: historic_end = -1.0_dp        !! Last daily epoch + 1
      real(dp) :: historic_daily_end = -1.0_dp  !! Last contiguous daily data epoch
      logical :: warn_epoch_before = .true.     !! Flag to warn if requested epoch is before data start
      logical :: warn_epoch_after = .true.      !! Flag to warn if requested epoch is after data end
      contains
      private
      procedure,public :: initialize    => sw_init
      procedure,public :: get_flux_data => sw_get_flux_data
      procedure,public :: destroy       => sw_cleanup
      procedure :: get_record => copy_record
   end type sw_data_type