### Install PyIRI System-Wide Source: https://pyiri.readthedocs.io/en/latest/_sources/installation.rst.txt Install PyIRI for all users on the system. This method requires root privileges. ```bash sudo pip install . ``` -------------------------------- ### Install PyIRI with Documentation Requirements Source: https://pyiri.readthedocs.io/en/latest/installation.html Install PyIRI with additional optional dependencies needed for building the documentation locally. ```bash python -m pip install PyIRI[doc] ``` -------------------------------- ### Install PyIRI at User Level Source: https://pyiri.readthedocs.io/en/latest/_sources/installation.rst.txt Install PyIRI for the current user only. This method does not require root privileges. ```bash pip install --user . ``` -------------------------------- ### Install PyIRI with Test Requirements Source: https://pyiri.readthedocs.io/en/latest/installation.html Install PyIRI along with optional packages required for running the test suite and building documentation locally. ```bash python -m pip install PyIRI[test] ``` -------------------------------- ### Install PyIRI in Editable Mode Source: https://pyiri.readthedocs.io/en/latest/_sources/installation.rst.txt Install PyIRI in editable mode for development. Changes made to the source code will be reflected immediately without needing reinstallation. ```bash pip install --user -e . ``` -------------------------------- ### Clone PyIRI Git Repository Source: https://pyiri.readthedocs.io/en/latest/_sources/installation.rst.txt Clone the PyIRI repository from GitHub to your local machine. This is the first step before installing the library. ```bash git clone https://github.com/victoriyaforsythe/PyIRI.git ``` -------------------------------- ### Plot Electron Density Profile (Sample) Source: https://pyiri.readthedocs.io/en/latest/api.html Plots the electron density profile for a single location for solar minimum and maximum conditions. Requires electron density data, time, and location parameters. ```python PyIRI.plotting.PyIRI_EDP_sample(_EDP_ , _aUT_ , _alon_ , _alat_ , _lon_plot_ , _lat_plot_ , _aalt_ , _UT_ , _plot_dir_ , _plot_name ='PyIRI_EDP_sample.png'_) ``` -------------------------------- ### Plot Electron Density Profile (1 Day) Source: https://pyiri.readthedocs.io/en/latest/api.html Plots the electron density profile for a single location for a given day. Requires electron density data, time, and location parameters. ```python PyIRI.plotting.PyIRI_EDP_sample_1day(_EDP_ , _aUT_ , _alon_ , _alat_ , _lon_plot_ , _lat_plot_ , _aalt_ , _UT_ , _plot_dir_ , _plot_name ='PyIRI_EDP_sample_1day.png'_) ``` -------------------------------- ### PyIRI_EDP_sample_1day() Source: https://pyiri.readthedocs.io/en/latest/api.html Provides a sample of the EDP data for a single day. This is a specialized sample function. ```APIDOC ## PyIRI_EDP_sample_1day() ### Description Provides a sample of the EDP data for a single day. This is a specialized sample function. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters (Specific parameters not detailed in the source) ### Request Example (Not specified) ### Response (Not specified) ``` -------------------------------- ### Run IRI for Daily Density Profiles Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/sh_library.html Calculates daily ionospheric density profiles using specified parameters. Requires coefficient directory, time/spatial resolutions, altitude range, F107 index, and F2 region modeling choices. ```python from PyIRI.sh_library import run_iri_reg_grid # Example usage: alon, alat, alon_2d, alat_2d, aalt, aUT, F2, F1, E, sun, mag, EDP = run_iri_reg_grid( year=2023, month=1, day=1, F107=150, hr_res=1, lat_res=5, lon_res=5, alt_res=20, alt_min=100, alt_max=1000, coord='GEO' ) ``` -------------------------------- ### PyIRI.edp_update.EDP_builder Source: https://pyiri.readthedocs.io/en/latest/api.html Constructs the vertical Electron Density Profile (EDP) using provided parameters. It takes a 11-parameter array, time, and horizontal grid information to generate a 3-D electron density output. ```APIDOC ## PyIRI.edp_update.EDP_builder ### Description Constructs the vertical Electron Density Profile (EDP) from the provided parameters for all time frames, all vertical, and all horizontal points. ### Parameters #### Path Parameters - **x** (array-like) - Required - Array where 1st dimension indicates the parameter (total 11 parameters), second dimension is time, and third is horizontal grid [11, N_T, N_G]. - **aalt** (array-like) - Required - 1-D array of altitudes [N_V] in km. ### Returns #### Success Response - **density_out** (array-like) - 3-D electron density [N_T, N_V, N_G] in m-3. ### Notes This function builds the EDP from the provided parameters for all time frames, all vertical and all horizontal points. ### References Forsythe et al. (2023), PyIRI: Whole-Globe Approach to the International Reference Ionosphere Modeling Implemented in Python, Space Weather. ``` -------------------------------- ### PyIRI.main_library.run_iri_reg_grid Source: https://pyiri.readthedocs.io/en/latest/api.html Runs the IRI model for a single day on a regular grid with specified resolutions and boundaries. ```APIDOC ## PyIRI.main_library.run_iri_reg_grid ### Description Runs the IRI model for a single day on a regular grid with specified resolutions and boundaries. ### Method (Not specified, likely a function call) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body (None specified) ### Parameters - **year** (int) - Four digit year in C.E. - **month** (int) - Integer month (range 1-12). - **day** (int) - Integer day of month (range 1-31). - **f107** (int or float) - F10.7 index for the given day. - **hr_res** (int or float) - Time resolution in hours (default=1). - **lat_res** (int or float) - Latitude resolution. - **lon_res** (int or float) - Longitude resolution. - **alt_res** (int or float) - Altitude resolution (default=10). - **alt_min** (int or float) - Minimum altitude (default=0). - **alt_max** (int or float) - Maximum altitude (default=700). - **ccir_or_ursi** (int) - Specifies CCIR or URSI model (default=0). ``` -------------------------------- ### Plot foE for Solar Min/Max Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/plotting.html Generates plots of foE (minimum and maximum electron density) for solar minimum and maximum conditions. Requires pre-calculated IRI data and solar position information. ```python import matplotlib.pyplot as plt import numpy as np import os def PyIRI_plot_foE_min_max(E, aUT, alon, alat, alon_2d, alat_2d, sun, UT, plot_dir, plot_name='PyIRI_foE_min_max.png'): """Plot foE for solar min and max. Parameters ---------- E : dict Dictionary output of IRI_monthly_mean_parameters. aUT : array-like Array of universal times in hours used in PyIRI. alon : array-like Flattened array of geo longitudes in degrees. alat : array-like Flattened array of geo latitudes in degrees. alon_2d : array-like 2-D array of geo longitudes in degrees. alat_2d : array-like 2-D array of geo latitudes in degrees. sun : dict Dictionary output of IRI_monthly_mean_parameters. UT : float UT time frame from array aUT to plot. plot_dir : str Direction where to save the figure. plot_name : str Name for the output figure, without directory (default='PyIRI_foE_min_max.png') """ ind_time = np.where(aUT == UT) ind_grid = np.where(np.isfinite(alon)) figname = os.path.join(plot_dir, plot_name) fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3), constrained_layout=True) plt.xlim([-180, 180]) plt.ylim([-90, 90]) plt.xticks(np.arange(-180, 180 + 45, 90)) plt.yticks(np.arange(-90, 90 + 45, 45)) abc = ['(a)', '(b)'] atitle = ['Solar Min', 'Solar Max'] for isol in range(0, 2): ax[isol].set_facecolor('grey') ax[isol].set_xlabel('Geo Lon (°)') ax[isol].set_ylabel('Geo Lat (°)') if isol == 1: ax[1].set_ylabel(' ') z = np.reshape(E['fo'][ind_time, ind_grid, isol], alon_2d.shape) mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z) cbar = fig.colorbar(mesh, ax=ax[isol]) ax[isol].text(140, 70, abc[isol], c='white') ax[isol].title.set_text(atitle[isol]) ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red', s=20, edgecolors="black", linewidths=0.5) cbar.set_label('$fo$E (MHz)') plt.savefig(figname, format='pdf', bbox_inches='tight') return ``` -------------------------------- ### PyIRI_EDP_sample() Source: https://pyiri.readthedocs.io/en/latest/api.html Provides a sample of the Empirical Dynamic Profile (EDP) data. This is likely for demonstration or testing purposes. ```APIDOC ## PyIRI_EDP_sample() ### Description Provides a sample of the Empirical Dynamic Profile (EDP) data. This is likely for demonstration or testing purposes. ### Method Not specified (likely a Python function call) ### Endpoint Not applicable (Python function) ### Parameters (Specific parameters not detailed in the source) ### Request Example (Not specified) ### Response (Not specified) ``` -------------------------------- ### Plotting Electron Density Profile (EDP) Sample Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/plotting.html Plots a single electron density profile for a specific location and time, comparing solar minimum and maximum conditions. Requires EDP data, time/location arrays, and altitude information. The plot is saved as a PDF. ```python figname = os.path.join(plot_dir, plot_name) fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(5, 5), constrained_layout=True) ax.set_xlabel('Electron Density (m$^{-3}$)') ax.set_ylabel('Altitude (km)') ax.set_facecolor("grey") ind_grid = np.where((alon == lon_plot) & (alat == lat_plot)) ind_time = np.where(aUT == UT) ind_vert = np.where(aalt >= 0) ind_min = 0, ind_time, ind_vert, ind_grid x = np.reshape(EDP[ind_min], aalt.shape) ax.plot(x, aalt, c='black', label='Sol min', linewidth=1) ind_max = 1, ind_time, ind_vert, ind_grid x = np.reshape(EDP[ind_max], aalt.shape) ax.plot(x, aalt, c='white', label='Sol max', linewidth=1) ax.legend(loc='upper right', prop={'size': 8}) plt.title(str(lon_plot) + ' Lon, ' + str(lat_plot) + ' Lat') plt.savefig(figname, format='pdf', bbox_inches='tight') return ``` -------------------------------- ### Organize Solar Parameters Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/edp_update.html Collects solar position parameters (longitude and latitude) into a dictionary. ```python sun = {'lon': slon, 'lat': slat} ``` -------------------------------- ### PyIRI.main_library.EDP_builder Source: https://pyiri.readthedocs.io/en/latest/api.html Constructs the vertical Electron Density Profile (EDP) from provided parameters for all time frames, vertical, and horizontal points. ```APIDOC ## PyIRI.main_library.EDP_builder ### Description Constructs the vertical Electron Density Profile (EDP) from provided parameters. ### Parameters #### Path Parameters - **x** (array-like) - Required - Array where 1st dimension indicates the parameter (total 11 parameters), second dimension is time, and third is horizontal grid [11, N_T, N_G]. - **aalt** (array-like) - Required - 1-D array of altitudes [N_V] in km. ### Returns #### Success Response - **density_out** (array-like) - 3-D electron density [N_T, N_V, N_G] in m-3. ``` -------------------------------- ### Organize F1 Layer Parameters Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/edp_update.html Collects F1 layer parameters into a dictionary. ```python F1 = {'Nm': NmF1, 'fo': foF1, 'P': P_F1, 'hm': hmF1, 'B_bot': B_F1_bot} ``` -------------------------------- ### PyIRI.sh_library.EDP_builder_continuous Source: https://pyiri.readthedocs.io/en/latest/api.html Constructs vertical Electron Density Profiles (EDP) with a continuous F1 layer using provided parameters for F2, F1, and E layers. ```APIDOC ## PyIRI.sh_library.EDP_builder_continuous(_F2_ , _F1_ , _E_ , _aalt_) ### Description Construct vertical EDP with continuous F1 layer. ### Parameters #### Path Parameters * **F2** (dict) - Dictionary of parameters for the F2 layer. Shape (N_T, N_G). * **F1** (dict) - Dictionary of parameters for the F1 layer. Shape (N_T, N_G). * **E** (dict) - Dictionary of parameters for the E layer. Shape (N_T, N_G). * **aalt** (array-like) - 1-D array of altitudes [km]. Shape (N_V,) ### Returns * **density** (numpy.ndarray) - 3-D electron density profiles [m-3]. Shape (N_T, N_V, N_G) ### Notes This function builds the EDP from the provided parameters for all time frames, all vertical and all horizontal points. ### References Forsythe et al. (2023), PyIRI: Whole-Globe Approach to the International Reference Ionosphere Modeling Implemented in Python, Space Weather. ``` -------------------------------- ### Plot F1 Bottom Side Thickness (Solar Min/Max) Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/plotting.html Generates plots for the thickness of the F1 bottom side for solar minimum and maximum conditions. Requires IRI_monthly_mean_parameters output and plotting configurations. ```python def PyIRI_plot_B_F1_bot_min_max(F1, aUT, alon, alat, alon_2d, alat_2d, sun, UT, plot_dir, plot_name='PyIRI_B_F1_bot_min_max.png'): """Plot thickness of F1 bottom side for solar min and max. Parameters ---------- F1 : dict Dictionary output of IRI_monthly_mean_parameters. aUT : array-like Array of universal times in hours used in PyIRI alon : array-like Flattened array of geo longitudes in degrees. alat : array-like Flattened array of geo latitudes in degrees. alon_2d : array-like 2-D array of geo longitudes in degrees. alat_2d : array-like 2-D array of geo latitudes in degrees. sun : dict Dictionary output of IRI_monthly_mean_parameters. UT : float UT time frame from array aUT to plot. plot_dir : str Direction where to save the figure. plot_name : str Name for the output figure, without directory (default='PyIRI_B_F1_bot_min_max.png') """ ind_time = np.where(aUT == UT) ind_grid = np.where(np.isfinite(alon)) figname = os.path.join(plot_dir, plot_name) fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3), constrained_layout=True) plt.xlim([-180, 180]) plt.ylim([-90, 90]) plt.xticks(np.arange(-180, 180 + 45, 90)) plt.yticks(np.arange(-90, 90 + 45, 45)) abc = ['(a)', '(b)'] atitle = ['Solar Min', 'Solar Max'] for isol in range(0, 2): ax[isol].set_facecolor('grey') ax[isol].set_xlabel('Geo Lon (°)') ax[isol].set_ylabel('Geo Lat (°)') if isol == 1: ax[1].set_ylabel(' ') z = np.reshape(F1['B_bot'][ind_time, ind_grid, isol], alon_2d.shape) mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z) cbar = fig.colorbar(mesh, ax=ax[isol]) ax[isol].text(140, 70, abc[isol], c='white') ax[isol].title.set_text(atitle[isol]) ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red', s=20, edgecolors="black", linewidths=0.5) cbar.set_label('$B^{F1}_{bot}$ (km)') plt.savefig(figname, format='pdf', bbox_inches='tight') return ``` -------------------------------- ### PyIRI.main_library.reconstruct_density_from_parameters_1level Source: https://pyiri.readthedocs.io/en/latest/api.html Constructs vertical Electron Density Profiles (EDP) for one level of solar activity using provided layer parameters. ```APIDOC ## PyIRI.main_library.reconstruct_density_from_parameters_1level ### Description Constructs vertical Electron Density Profiles (EDP) for one level of solar activity using provided layer parameters. ### Method (Not specified, likely a function call) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body (None specified) ### Parameters - **F2** (dict) - Dictionary of parameters for F2 layer. - **F1** (dict) - Dictionary of parameters for F1 layer. - **E** (dict) - Dictionary of parameters for E layer. - **alt** (array-like) - 1-D array of altitudes [N_V] in km. ### Returns - **x_out** (array-like) - Electron density for two levels of solar activity [N_T, N_V, N_G] in m-3. ### Notes This function calculates 3-D density from given dictionaries of the parameters for 1 level of solar activity. ### References Forsythe et al. (2023), PyIRI: Whole-Globe Approach to the International Reference Ionosphere Modeling Implemented in Python, Space Weather. ``` -------------------------------- ### Plot F2 Top Side Thickness (Solar Min/Max) Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/plotting.html Generates plots for the thickness of the F2 top side for solar minimum and maximum conditions. Requires IRI_monthly_mean_parameters output and plotting configurations. ```python def PyIRI_plot_B_F2_top_min_max(F2, aUT, alon, alat, alon_2d, alat_2d, sun, UT, plot_dir, plot_name='PyIRI_B_F2_top_min_max.png'): """Plot thickness of F2 topside for solar min and max. Parameters ---------- F2 : dict Dictionary output of IRI_monthly_mean_parameters. aUT : array-like Array of universal times in hours used in PyIRI. alon : array-like Flattened array of geo longitudes in degrees. alat : array-like Flattened array of geo latitudes in degrees. alon_2d : array-like 2-D array of geo longitudes in degrees. alat_2d : array-like 2-D array of geo latitudes in degrees. sun : dict Dictionary output of IRI_monthly_mean_parameters. UT : float UT time frame from array aUT to plot. plot_dir : str Direction where to save the figure. plot_name : str Name for the output figure, without directory (default='PyIRI_B_F2_top_min_max.png') """ ind_time = np.where(aUT == UT) ind_grid = np.where(np.isfinite(alon)) figname = os.path.join(plot_dir, plot_name) ``` -------------------------------- ### PyIRI.main_library.reconstruct_density_from_parameters Source: https://pyiri.readthedocs.io/en/latest/api.html Constructs vertical Electron Density Profiles (EDP) for two levels of solar activity using provided layer parameters. ```APIDOC ## PyIRI.main_library.reconstruct_density_from_parameters ### Description Constructs vertical Electron Density Profiles (EDP) for two levels of solar activity using provided layer parameters. ### Method (Not specified, likely a function call) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body (None specified) ### Parameters - **F2** (dict) - Dictionary of parameters for F2 layer. - **F1** (dict) - Dictionary of parameters for F1 layer. - **E** (dict) - Dictionary of parameters for E layer. - **alt** (array-like) - 1-D array of altitudes [N_V] in km. ### Returns - **x_out** (array-like) - Electron density for two levels of solar activity [2, N_T, N_V, N_G] in m-3. ### Notes This function calculates 3-D density from given dictionaries of the parameters for 2 levels of solar activity. ### References Forsythe et al. (2023), PyIRI: Whole-Globe Approach to the International Reference Ionosphere Modeling Implemented in Python, Space Weather. ``` -------------------------------- ### PyIRI.main_library.create_reg_grid Source: https://pyiri.readthedocs.io/en/latest/api.html Generates a regular grid for running the IRI model on a single day. It allows customization of time, latitude, longitude, and altitude resolutions and ranges. ```APIDOC ## PyIRI.main_library.create_reg_grid ### Description Run IRI for a single day on a regular grid. ### Parameters * **hr_res** (int or float) - Time resolution in hours (default=1). * **lat_res** (int or float) - Latitude resolution in degrees (default=1). * **lon_res** (int or float) - Longitude resolution in degrees (default=1). * **alt_res** (int or float) - Altitude resolution in km (default=10). * **alt_min** (int or float) - Altitude minimum in km (default=0). * **alt_max** (int or float) - Altitude maximum in km (default=700). ### Returns * **alon** (array-like) - 1D longitude grid. * **alat** (array-like) - 1D latitude grid. * **alon_2d** (array-like) - 2D longitude grid. * **alat_2d** (array-like) - 2D latitude grid. * **aalt** (array-like) - Altitude grid. * **ahr** (array-like) - UT grid. ### Notes This function creates a regular global grid in Geographic coordinates using given spatial resolution lon_res, lat_res. In case you want to run IRI in magnetic coordinates, you can obtain a regular grid in magnetic coordinates, then convert it to geographic coordinates using your own methods, and then use these 1-D alon and alat arrays. Similarly, if you are interested in regional grid, then use your own alon and alat 1-D arrays. alon and alat can also be irregular arrays. In case you need to run IRI for 1 grid point, define alon and alat as NumPy arrays that have only 1 element. Size of alon and alat is [N_G]. This function creates creates an array of altitudes for the vertical dimension of electron density profiles. Any 1-D Numpy array in [km] would work, regularly or irregularly spaced. This function also creates time array aUT using a given temporal resolution hr_res in hours. E.g. if hr_res = 0.25 it will lead to 15-minutes time resolution. You can define aUT your own way, just keep it 1-D and expressed in hours. It can be regularly or irregularly spaced array. If you want to run PyIRI for just 1 time frame, then define aUT as NumPy arrays that have only 1 element. Size of aUT is [N_T]. ``` -------------------------------- ### Clone PyIRI Fork Source: https://pyiri.readthedocs.io/en/latest/develop_guide/contributing.html Clone your forked PyIRI repository locally to begin development. ```bash git clone git@github.com:your_name_here/PyIRI.git ``` -------------------------------- ### Plot F2 Bottom Side Thickness (Solar Min/Max) Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/plotting.html Generates plots for the thickness of the F2 bottom side for solar minimum and maximum conditions. Requires IRI_monthly_mean_parameters output and plotting configurations. ```python def PyIRI_plot_B_F2_bot_min_max(F2, aUT, alon, alat, alon_2d, alat_2d, sun, UT, plot_dir, plot_name='PyIRI_B_F2_bot_min_max.png'): """Plot thickness of F2 bottom side for solar min and max. Parameters ---------- F2 : dict Dictionary output of IRI_monthly_mean_parameters. aUT : array-like Array of universal times in hours used in PyIRI alon : array-like Flattened array of geo longitudes in degrees. alat : array-like Flattened array of geo latitudes in degrees. alon_2d : array-like 2-D array of geo longitudes in degrees. alat_2d : array-like 2-D array of geo latitudes in degrees. sun : dict Dictionary output of IRI_monthly_mean_parameters. UT : float UT time frame from array aUT to plot. plot_dir : str Direction where to save the figure. plot_name : str Name for the output figure, without directory (default='PyIRI_B_F2_bot_min_max.png') """ ind_time = np.where(aUT == UT) ind_grid = np.where(np.isfinite(alon)) figname = os.path.join(plot_dir, plot_name) fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3), constrained_layout=True) plt.xlim([-180, 180]) plt.ylim([-90, 90]) plt.xticks(np.arange(-180, 180 + 45, 90)) plt.yticks(np.arange(-90, 90 + 45, 45)) abc = ['(a)', '(b)'] atitle = ['Solar Min', 'Solar Max'] for isol in range(0, 2): ax[isol].set_facecolor('grey') ax[isol].set_xlabel('Geo Lon (°)') ax[isol].set_ylabel('Geo Lat (°)') if isol == 1: ax[1].set_ylabel(' ') z = np.reshape(F2['B_bot'][ind_time, ind_grid, isol], alon_2d.shape) mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z) cbar = fig.colorbar(mesh, ax=ax[isol]) ax[isol].text(140, 70, abc[isol], c='white') ax[isol].title.set_text(atitle[isol]) ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red', s=20, edgecolors="black", linewidths=0.5) cbar.set_label('$B^{F2}_{bot}$ (km)') plt.savefig(figname, format='pdf', bbox_inches='tight') return ``` -------------------------------- ### PyIRI.main_library.IRI_density_1day Source: https://pyiri.readthedocs.io/en/latest/api.html Outputs ionospheric parameters for a particular day. ```APIDOC ## PyIRI.main_library.IRI_density_1day ### Description Output ionospheric parameters for a particular day. ### Parameters #### Path Parameters - **year** (int) - Required - Year. - **mth** (int) - Required - Month of year. - **day** (int) - Required - Day of month. - **aUT** (array-like) - Required - Array of universal time (UT) in hours. Must be Numpy array of any size [N_T]. - **alon** (array-like) - Required - Flattened array of geographic longitudes in degrees. Must be Numpy array of any size [N_G]. - **alat** (array-like) - Required - Flattened array of geographic latitudes in degrees. Must be Numpy array of any size [N_G]. - **aalt** (array-like) - Required - Array of altitudes in km. Must be Numpy array of any size [N_V]. - **F107** (float) - Required - User provided F10.7 solar flux index in SFU. - **coeff_dir** (str) - Required - Place where coefficients are located. - **ccir_or_ursi** (int) - Optional - If 0 is given CCIR will be used for F2 critical frequency. If 1 then URSI coefficients. (default=0) ### Returns #### Success Response - **F2** (dict) - ‘Nm’ is peak density of F2 region in m-3. ‘fo’ is critical frequency of F2 region in MHz. ‘M3000’ is the obliquity factor for a distance of 3,000 km. Defined as refracted in the ionosphere, can be received at a distance of 3,000 km, unitless. ‘hm’ is height of the F2 peak in km. ‘B_topi is top thickness of the F2 region in km. ‘B_bot’ is bottom thickness of the F2 region in km. Shape [N_T, N_G, 2]. - **F1** (dict) - ``` -------------------------------- ### Run IRI for Monthly Mean Density Profiles Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/sh_library.html Calculates monthly mean ionospheric density profiles on a regular grid. Allows selection of F2 region coefficients and models, and coordinate systems. ```python from PyIRI.sh_library import run_seas_iri_reg_grid # Example usage: alon, alat, alon_2d, alat_2d, aalt, aUT = run_seas_iri_reg_grid( year=2023, month=1, hr_res=1, lat_res=1, lon_res=1, alt_res=10, alt_min=0, alt_max=700, foF2_coeff='URSI', hmF2_model='SHU2015', coord='GEO' ) ``` -------------------------------- ### Run IRI for Monthly Mean Parameters Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/edp_update.html Calculates monthly mean ionospheric parameters on a regular grid. Requires year, month, and grid resolutions. Outputs include various ionospheric characteristics for min/max solar activity. ```python def run_seas_iri_reg_grid(year, month, hr_res=1, lat_res=1, lon_res=1, alt_res=10, alt_min=0, alt_max=700, ccir_or_ursi=0): """Run IRI for monthly mean parameters on a regular grid. Parameters ---------- year : int Four digit year in C.E. month : int Integer month (range 1-12) f107 : int or float F10.7 index for the given day hr_res : int or float Time resolution in hours (default=1) lat_res : int or float Latitude resolution in degrees (default=1) lon_res : int or float Longitude resolution in degrees (default=1) alt_res : int or float Altitude resolution in km (default=10) alt_min : int or float Altitude minimum in km (default=0) alt_max : int or float Altitude maximum in km (default=700) ccir_or_ursi : int If 0 use CCIR coefficients, if 1 use URSI coefficients Returns ------- alon : array-like 1D longitude grid alat : array-like 1D latitude grid alon_2d : array-like 2D longitude grid alat_2d : array-like 2D latitude grid aalt : array-like Altitude grid ahr : array-like UT grid f2 : array-like F2 peak f1 : array-like F1 peak epeak : array-like E peak es_peak : array-like Sporadic E (Es) peak sun : array-like Solar zenith angle in degrees mag : array-like Magnetic inclination in degrees edens_prof : array-like Electron density profile in per cubic m See Also -------- create_reg_grid """ # Define the grids alon, alat, alon_2d, alat_2d, aalt, ahr = main.create_reg_grid( hr_res=hr_res, lat_res=lat_res, lon_res=lon_res, alt_res=alt_res, alt_min=alt_min, alt_max=alt_max) # ------------------------------------------------------------------------- # Monthly mean ionospheric parameters for min and max of solar activity: # ------------------------------------------------------------------------- # This is how PyIRI needs to be called to find monthly mean values for all # ionospheric parameters, for min and max conditions of solar activity: # year and month should be integers, and ahr and alon, alat should be 1-D # NumPy arrays. alon and alat should have the same size. coeff_dir is the # coefficient directory. Matrix size for all the output parameters is # [N_T, N_G, 2], where 2 indicates min and max of the solar activity that ``` -------------------------------- ### Run IRI for a Single Day Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/edp_update.html Calculates ionospheric parameters for a specific day using IRI model. Requires date, time, location grids, and solar activity index. ```python def run_iri_1day(year, month, day, hr_res=1, lat_res=1, lon_res=1, alt_res=10, alt_min=0, alt_max=700, ccir_or_ursi=0): """Run IRI for a single day. Parameters ---------- year : int Four digit year in C.E. month : int Integer month (range 1-12) day : int Integer day (range 1-31) f107 : int or float F10.7 index for the given day hr_res : int or float Time resolution in hours (default=1) lat_res : int or float Latitude resolution in degrees (default=1) lon_res : int or float Longitude resolution in degrees (default=1) alt_res : int or float Altitude resolution in km (default=10) alt_min : int or float Altitude minimum in km (default=0) alt_max : int or float Altitude maximum in km (default=700) ccir_or_ursi : int If 0 use CCIR coefficients, if 1 use URSI coefficients Returns ------- alon : array-like 1D longitude grid alat : array-like 1D latitude grid alon_2d : array-like 2D longitude grid alat_2d : array-like 2D latitude grid aalt : array-like Altitude grid ahr : array-like UT grid f2 : array-like F2 peak f1 : array-like F1 peak epeak : array-like E peak es_peak : array-like Sporadic E (Es) peak sun : array-like Solar zenith angle in degrees mag : array-like Magnetic inclination in degrees edens_prof : array-like Electron density profile in per cubic m See Also -------- create_reg_grid """ # Define the grids alon, alat, alon_2d, alat_2d, aalt, ahr = main.create_reg_grid( hr_res=hr_res, lat_res=lat_res, lon_res=lon_res, alt_res=alt_res, alt_min=alt_min, alt_max=alt_max) # ------------------------------------------------------------------------- # Monthly mean density for min and max of solar activity: # ------------------------------------------------------------------------- # The original IRI model further interpolates between 2 levels of solar # activity to estimate density for a particular level of F10.7. # Additionally, it interpolates between 2 consecutive months to make a # smooth seasonal transition. Here is an example of how this interpolation # can be done. If you need to run IRI for a particular day, you can just # use this function f2, f1, epeak, es_peak, sun, mag, edens_prof = IRI_density_1day( year, month, day, ahr, alon, alat, aalt, f107, PyIRI.coeff_dir, ccir_or_ursi) return (alon, alat, alon_2d, alat_2d, aalt, ahr, f2, f1, epeak, es_peak, sun, mag, edens_prof) ``` -------------------------------- ### Run IRI Model on Regular Grid Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/main_library.html Executes the IRI model for a specified date, solar activity level, and grid parameters. It returns various ionospheric parameters and electron density profiles. ```python def run_iri_reg_grid(year, month, day, f107, hr_res=1, lat_res=1, lon_res=1, alt_res=10, alt_min=0, alt_max=700, ccir_or_ursi=0): """Run IRI for a single day on a regular grid. Parameters ---------- year : int Four digit year in C.E. month : int Integer month (range 1-12) day : int Integer day of month (range 1-31) f107 : int or float F10.7 index for the given day hr_res : int or float Time resolution in hours (default=1) lat_res : int or float Latitude resolution in degrees (default=1) lon_res : int or float Longitude resolution in degrees (default=1) alt_res : int or float Altitude resolution in km (default=10) alt_min : int or float Altitude minimum in km (default=0) alt_max : int or float Altitude maximum in km (default=700) ccir_or_ursi : int If 0 use CCIR coefficients, if 1 use URSI coefficients Returns ------- alon : array-like 1D longitude grid alat : array-like 1D latitude grid alon_2d : array-like 2D longitude grid alat_2d : array-like 2D latitude grid aalt : array-like Altitude grid ahr : array-like UT grid f2 : array-like F2 peak f1 : array-like F1 peak epeak : array-like E peak es_peak : array-like Sporadic E (Es) peak sun : array-like Solar zenith angle in degrees mag : array-like Magnetic inclination in degrees edens_prof : array-like Electron density profile in per cubic m See Also -------- create_reg_grid """ # Define the grids alon, alat, alon_2d, alat_2d, aalt, ahr = create_reg_grid( hr_res=hr_res, lat_res=lat_res, lon_res=lon_res, alt_res=alt_res, alt_min=alt_min, alt_max=alt_max) # ------------------------------------------------------------------------- # Monthly mean density for min and max of solar activity: # ------------------------------------------------------------------------- ``` -------------------------------- ### Create Regular Geographic Grid Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/main_library.html Generates 1D and 2D longitude and latitude grids, along with altitude and UT grids, based on specified resolutions. Useful for setting up simulation domains. ```python def create_reg_grid(hr_res=1, lat_res=1, lon_res=1, alt_res=10, alt_min=0, alt_max=700): """Run IRI for a single day on a regular grid. Parameters ---------- hr_res : int or float Time resolution in hours (default=1) lat_res : int or float Latitude resolution in degrees (default=1) lon_res : int or float Longitude resolution in degrees (default=1) alt_res : int or float Altitude resolution in km (default=10) alt_min : int or float Altitude minimum in km (default=0) alt_max : int or float Altitude maximum in km (default=700) Returns ------- alon : array-like 1D longitude grid alat : array-like 1D latitude grid alon_2d : array-like 2D longitude grid alat_2d : array-like 2D latitude grid aalt : array-like Altitude grid ahr : array-like UT grid Notes ----- This function creates a regular global grid in Geographic coordinates using given spatial resolution lon_res, lat_res. In case you want to run IRI in magnetic coordinates, you can obtain a regular grid in magnetic coordinates, then convert it to geographic coordinates using your own methods, and then use these 1-D alon and alat arrays. Similarly, if you are interested in regional grid, then use your own alon and alat 1-D arrays. alon and alat can also be irregular arrays. In case you need to run IRI for 1 grid point, define alon and alat as NumPy arrays that have only 1 element. Size of alon and alat is [N_G]. This function creates creates an array of altitudes for the vertical dimension of electron density profiles. Any 1-D Numpy array in [km] would work, regularly or irregularly spaced. This function also creates time array aUT using a given temporal resolution hr_res in hours. E.g. if hr_res = 0.25 it will lead to 15-minutes time resolution. You can define aUT your own way, just keep it 1-D and expressed in hours. It can be regularly or irregularly spaced array. If you want to run PyIRI for just 1 time frame, then define aUT as NumPy arrays that have only 1 element. Size of aUT is [N_T]. """ alon, alat, alon_2d, alat_2d = set_geo_grid(lon_res, lat_res) aalt = np.arange(alt_min, alt_max, alt_res) ahr, _, _, _, _ = set_temporal_array(hr_res) return alon, alat, alon_2d, alat_2d, aalt, ahr ``` -------------------------------- ### PyIRI.plotting.PyIRI_EDP_sample Source: https://pyiri.readthedocs.io/en/latest/api.html Plots the Electron Density Profile (EDP) for a single location, comparing solar minimum and maximum conditions. ```APIDOC ## PyIRI.plotting.PyIRI_EDP_sample ### Description Plot EDP for one location for solar min and max. ### Method Not applicable (Python function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **EDP** (array-like) - 3-D electron density array output of IRI_monthly_mean_parameters. - **aUT** (array-like) - Array of universal times in hours used in PyIRI - **alon** (array-like) - Flattened array of geo longitudes in degrees. - **alat** (array-like) - Flattened array of geo latitudes in degrees. - **lon_plot** (float) - Longitude location for EDP. - **lat_plot** (array-like) - Latitude location for EDP. - **sun** (dict) - Dictionary output of IRI_monthly_mean_parameters. - **UT** (float) - UT time frame from array aUT to plot. - **plot_dir** (str) - Direction where to save the figure. - **plot_name** (str) - Name for the output figure, without directory (default=’PyIRI_EDP_sample.png’) ``` -------------------------------- ### Create Local Development Branch Source: https://pyiri.readthedocs.io/en/latest/develop_guide/contributing.html Create a new branch for your bug fix or feature development. ```bash git checkout -b name-of-your-bugfix-or-feature ``` -------------------------------- ### Organize F2 Layer Parameters Source: https://pyiri.readthedocs.io/en/latest/_modules/PyIRI/edp_update.html Collects F2 layer parameters into a dictionary. ```python F2 = {'Nm': NmF2, 'fo': foF2, 'M3000': M3000, 'hm': hmF2, 'B_top': B_F2_top, 'B_bot': B_F2_bot} ```