pyValEIA.plots.swarm_diagnostic_plots

Functions for plotting Swarm data and evaluating EIA detection.

Functions

swarm_panel(axs, stime, satellite, swarm_file_dir[, ...])

Plot a single Swarm panel without model data.

pyiri_model_swarm_plot(sday, daily_dir, swarm_dir[, ...])

Create and plot a 1 day file for PyIRI, using output from another model.

model_swarm_mapplot(start_day, swarm_file_dir, ...[, ...])

Plot Swarm and model data for 1 day and create file of EIA info.

model_swarm_single_plot(stime, satellite, ...[, ...])

Plot and save a single model/Swarm EIA type plot.

Module Contents

pyValEIA.plots.swarm_diagnostic_plots.swarm_panel(axs, stime, satellite, swarm_file_dir, MLat=30, swarm_filt='barrel_average', swarm_interpolate=1, swarm_envelope=True, swarm_barrel=3, swarm_window=2, fosi=14, scale=False, scale_by='num', scale_num=10**5)[source]

Plot a single Swarm panel without model data.

Parameters:
axsmatplotlib axis

axis for the data to be plotted onto

stimedatetime object

time of desired plot, nearest time within mlatitudinal window will be plotted

satellite: str

‘A’, ‘B’, or ‘C’ for Swarm

swarm_file_dirstr

directory where swarm file can be found

MLatint

magnetic latitude range +/-MLat (default=30)

swarm_filtstr

Desired Filter for swarm data (default=’barrel_average’)

swarm_interpolateint

int that determines the number of data points in interpolation new length will be len(density) x interpolate; if 1 is specified there will not be any interpolation. (default=1)

swarm_envelopebool

If True, barrel roll will include points inside an envelope and if False, no envelope will be used (default=True)

swarm_barreldouble

latitudinal radius of barrel for Swarm in degrees of magnetic latitude (default=3)

swarm_windowfloat

latitudinal width of moving window in degrees of magnetic latitude (default=2)

fosiint

fontsize for the legend (default=14)

scalebool

Specifies whether to scale the data, if True, or leave as-is, if False (default=False)

scale_bystr

If scale is True, scale the data by a number if ‘num’ is provided or scale the data by the maximum if ‘max’ is provided (default=’num’)

scale_numfloat

If scale is True and scale_by is ‘num’, the density data will be divided by scale_num (default=10**5)

Returns:
axsmatplotlib axis

axis for the data to be plotted onto

Notes

filt options include: ‘barrel’, ‘average’, ‘median’, ‘barrel_average’ ‘barrel_median’, ‘average_barrel’, and ‘median_barrel’

pyValEIA.plots.swarm_diagnostic_plots.pyiri_model_swarm_plot(sday, daily_dir, swarm_dir, model_name='NIMO', fig_on=True, fig_save_dir='', file_save_dir='', pyiri_filt='', pyiri_interpolate=2, pyiri_envelope=False, pyiri_barrel=3, pyiri_window=3, fosi=18)[source]

Create and plot a 1 day file for PyIRI, using output from another model.

Parameters:
sday: dt.datetime

Starting date with time-of-day information set to zero

daily_dirstr

Directory of daily files made for the other model-Swarm comparison.

swarm_dirstr

Swarm data directory to which data will be downloaded into an appropriate date/satellite directory structure

model_namestr

Name for the model against which PyIRI will be compared (default=’NIMO’)

file_save_dirstr

directory where file should be saved, (default=’’)

fig_onbool

Set to true, plot will be made, if false, plot will not be made (default=True)

fig_save_dirstr

directory where figure should be saved (default=’’)

pyiri_filtstr

Desired Filter for the model data, ‘’ is no filter (default=’’)

pyiri_interpolateint

int that determines the number of data points in interpolation new length will be len(density) x interpolate, with one indicating no interpolation (default=2)

pyiri_envelopebool

if True, barrel roll will include points inside an envelope, if false, no envelope will be used (default=False)

pyiri_barrelfloat

latitudinal radius of barrel for Swarm in degrees of magnetic latitude (default=3)

pyiri_windowfloat

latitudinal width of moving window of degrees in magnetic latitude (default=3)

fosiint

fontsize for plot, with the main title being 10 points larger and the legend being three points smaller (default=18)

Returns:
dfmpl.Figure or NoneType

Figure containing 2 panels for each pass between +/-MLat: Swarm and pyIRI or None if no data is available

daily_dfpd.DataFrame or NoneType

Daily file containing pyIRI information or None if no data is available

pyValEIA.plots.swarm_diagnostic_plots.model_swarm_mapplot(start_day, swarm_file_dir, mod_file_dir, mod_name_format, model_name='NIMO', mod_load_func=io.load.load_nimo, MLat=30, file_dir='', fig_on=True, fig_dir='', swarm_filt='barrel_average', swarm_interpolate=1, swarm_envelope=True, swarm_barrel=3, swarm_window=2, mod_filt='', mod_interpolate=2, mod_envelope=False, mod_barrel=3, mod_window=3, fosi=18, ne_var='dene', lon_var='lon', lat_var='lat', alt_var='alt', hr_var='hour', min_var='minute', tec_var='tec', hmf2_var='hmf2', nmf2_var='nmf2', mod_cadence=15, max_tdif=15, offset=0)[source]

Plot Swarm and model data for 1 day and create file of EIA info.

Parameters:
start_daydatetime

day starting at 0,0

swarm_file_dirstr

directory where swarm file can be found

mod_file_dirstr

directory where model file can be found

mod_name_formatstr

prefix of the desired model NetCDF file including date format before the .nc extention, e.g., ‘NIMO_AQ_%Y%j’

mod_load_funcfunction

Function for loading the model data (default=`io.load.load_nimo`)

MLat: int

Absolute value of the desired maximum magnetic latitude range, e.g., +/- MLat (default=30)

file_dirstr

Directory for daily files (default=’’)

fig_onbool

Make plots if True, or don’t if False (default=True)

fig_dirstr

Directory for figures (default=’’)

swarm_filtstr

Desired Filter for swarm data (default=’barrel_average’)

swarm_interpolateint

Multiple of data points to increase density by through interpolation, new length will be len(density) x swarm_interpolate (default=1)

swarm_envelopebool

if True, barrel roll will include points inside an envelope, if False, no envelope will be used (default=True)

swarm_barrelfloat

latitudinal radius of barrel for swarm (default=3)

swarm_windowfloat

latitudinal width of moving window (default=2)

mod_filtstr

Desired Filter for model data (default=’’)

mod_interpolateint

int that determines the number of data points in interpolation new length will be len(density) x interpolate (default=2)

mod_envelopebool

if True, barrel roll will include points inside an envelope, if false, no envelope will be used (default=False)

mod_barrelfloat

latitudinal radius of barrel for swarm (default=3)

mod_windowfloat

latitudinal width of moving window (default=3)

fosiint

Fontsize for plot, with super title equal to fosi + 10 and the legend text being fosi - 3 (default=18)

ne_varstr

Electron denstiy variable in the model file (default=’dene’)

lon_varstr

Longitude variable in the model file (default=’lon’)

lat_varstr

Latitude variable in the model file (default=’lat’)

alt_varstr

Altitude variable in the model file (default=’alt’)

hr_varstr

Hour of day variable in the model file (default=’hour’)

min_varstr

Minute of hour variable in the model file (default=’minute’)

tec_varstr

TEC variable in the model file (default=’tec’)

hmf2_varstr

hmF2 variable in the model file (default=’hmf2’)

nmf2_varstr

NmF2 variable in the model file (default=’nmf2’)

mod_cadenceint

Time cadence of Model data in minutes (default=15)

max_tdiffloat

Maximum allowed time in minutes between a model and Swarm conjunction (default=15)

offsetint

Number of days to offset Swarm data from model data to test the model reliability (default=0)

Returns:
dfpd.DataFrame

dataframe of info that went into daily file

pyValEIA.plots.swarm_diagnostic_plots.model_swarm_single_plot(stime, satellite, swarm_file_dir, mod_file_dir, mod_name_format, model_name='NIMO', mod_load_func=io.load.load_nimo, MLat=30, swarm_filt='barrel_average', swarm_interpolate=1, swarm_envelope=True, swarm_barrel=3, swarm_window=2, mod_filt='', mod_interpolate=2, mod_envelope=False, mod_barrel=3, mod_window=3, fosi=18, plot_dir='', ne_var='dene', lon_var='lon', lat_var='lat', alt_var='alt', hr_var='hour', min_var='minute', tec_var='tec', hmf2_var='hmf2', nmf2_var='nmf2', mod_cadence=15)[source]

Plot and save a single model/Swarm EIA type plot.

Parameters:
stimedatetime object

time of desired plot, nearest time within mlatitudinal window will be plotted

satellitestr

‘A’, ‘B’, or ‘C’ for Swarm

swarm_file_dirstr

directory where swarm file can be found

mod_file_dirstr

directory where nimo file can be found

mod_name_formatstr

Prefix of model file including date format before the .nc extension, e.g., ‘NIMO_AQ_%Y%j’

model_namestr

Model name (default=’NIMO’)

mod_load_funcfunction

Function for loading the model data (default=`io.load.load_nimo`)

MLatint

magnetic latitude range +/-MLat (default=30)

swarm_filtstr kwarg

Desired Filter for swarm data (default=’barrel_average’)

swarm_interpolateint

int that determines the number of data points in interpolation new length will be len(density) x interpolate (default=1)

swarm_envelopebool

if True, barrel roll will include points inside an envelope, if False, no envelope will be used (default=True)

swarm_barrelfloat

latitudinal radius of barrel for swarm (default=3)

swarm_windowfloat

latitudinal width of moving window (default=2)

mod_filtstr

Desired Filter for nimo data (default=’’)

mod_interpolateint

int that determines the number of data points in interpolation new length will be len(density) x interpolate (default=2)

mod_envelopebool

if True, barrel roll will include points inside an envelope, if False, no envelope will be used (default=False)

mod_barrelfloat

latitudinal radius of barrel for swarm (default=3)

mod_windowfloat

latitudinal width of moving window (default=3)

fosiint

fontsize for plot, with super title equal to fosi + 10 and the legend text equal to fosi - 3 (default=18)

plot_dirstr

output folder for plot, or ‘’ to not save output. If saved, an additional date directory will be created: plot_dir/{%Y%m%d}/fig.jpg (default=’’)

ne_varstr

Electron denstiy variable in the model file (default=’dene’)

lon_varstr

Longitude variable in the model file (default=’lon’)

lat_varstr

Latitude variable in the model file (default=’lat’)

alt_varstr

Altitude variable in the model file (default=’alt’)

hr_varstr

Hour of day variable in the model file (default=’hour’)

min_varstr

Minute of hour variable in the model file (default=’minute’)

tec_varstr

TEC variable in the model file (default=’tec’)

hmf2_varstr

hmF2 variable in the model file (default=’hmf2’)

nmf2_varstr

NmF2 variable in the model file (default=’nmf2’)

mod_cadence: int

Time cadence of model data in minutes (default=15)

Returns:
figmatplotlib.Figure

Figure handle

Notes

filt options include: ‘barrel’, ‘average’, ‘median’, ‘barrel_average’ ‘barrel_median’, ‘average_barrel’, and ‘median_barrel’