IRENE (AP9 / AE9) including plasma energies
Model API name: irene
The International Radiation Environment Near Earth (IRENE) model.
Version: v1.57
Model developer:
Model provision:
External Input: trajectory
Trajectory data.
Input | Value |
---|---|
Model name |
sapre
sapre_upload
|
trajectory
|
Model result name | trajectory |
Quantity | trajectory |
Input group: irene / multiplicity: one
Input | Description | Valid values | Default | Quantity |
---|---|---|---|---|
includePlasmaEnergies | Include plasma energies |
false=False true=True |
false | number |
IRENE
Input | Description | Valid values | Default | Quantity |
---|---|---|---|---|
numberOfRuns |
Number of runs (for perturbed and Monte Carlo modes)
Used if mode==perturbed |
note: Positive integer min: 1 max: 999 |
20 | number |
protonEnergies | Proton energies array (length: 'numberProtonEnergies') in MeV. |
note: Array of doubles |
[0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 100.0, 150.0, 200.0, 300.0, 400.0, 500.0] | energy |
electronEnergies |
Electron energies.
Number of energies must equal numberElectronEnergies (NENERE). |
note: Array of doubles |
[0.04, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.25, 4.5, 4.75, 5.0, 5.5, 6.0, 6.5, 7.0] | energy |
protonPlasmaEnergies | Proton energies array (length: 'numberProtonEnergies') in MeV. |
note: Array of doubles |
[0.0015, 0.0021, 0.0037, 0.0065, 0.01155, 0.0204, 0.036, 0.06375, 0.085] | energy |
electronPlasmaEnergies |
Electron energies.
Number of energies must equal numberElectronEnergies (NENERE). |
note: Array of doubles |
[0.001, 0.0013, 0.0017, 0.0021, 0.0028, 0.0036, 0.0046, 0.0059, 0.0077, 0.01, 0.013, 0.016, 0.021, 0.027, 0.035] | energy |
aggregation | Aggregation method |
mean=Mean percentile=Percentile |
mean | text |
energies | Energies |
0=Default 1=Default AE9/Ap9 energies 2=user-defined |
0 | text |
percentiles | Percentile(s) |
note: Between 1 and 99 min: 1 max: 99 |
[] | number |
mode | Model mode |
mean_percentiles=Mean (and percentiles) perturbed=Perturbed montecarlo=Monte carlo |
mean_percentile | text |
|
None
import sys
import matplotlib.pyplot as plt
from nom_client.nom_client import NoMClient
plt.rcParams['figure.figsize'] = [15, 10]
plt.rc('font', size=18)
def plot(x_data, y_data, plot_types, line_types, xlabel, ylabel, labels, title):
if not isinstance(plot_types, list):
plot_types = [plot_types] * len(x_data)
if not isinstance(line_types, list):
line_types = [line_types] * len(x_data)
if not isinstance(labels, list):
labels = [labels] * len(x_data)
for data_index in range(len(x_data)):
if plot_types[data_index] == 'loglog':
plt.loglog(x_data[data_index], y_data[data_index], linestyle=line_types[data_index], linewidth=2.0,
markersize=12.0,
label=labels[data_index])
elif plot_types[data_index] == 'semilogy':
plt.semilogy(x_data[data_index], y_data[data_index], linestyle=line_types[data_index], linewidth=2.0,
markersize=12.0,
label=labels[data_index])
elif plot_types[data_index] == 'semilogx':
plt.semilogx(x_data[data_index], y_data[data_index], linestyle=line_types[data_index], linewidth=2.0,
markersize=12.0,
label=labels[data_index])
else:
plt.plot(x_data[data_index], y_data[data_index], linestyle=line_types[data_index], linewidth=2.0,
markersize=12.0,
label=labels[data_index])
plt.title(title, fontsize=18)
plt.grid(True)
plt.legend(bbox_to_anchor=(0.95, 0.95), loc=1, borderaxespad=0.,
fancybox=True, fontsize=18, shadow=True)
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.show()
nom_client = NoMClient("irene SPM example", default_server_id="local_server")
sapre_model = nom_client.get_model('sapre')
sapre_model.set_params(orbitType="GEN", apogeeAltitude=20000, perigeeAltitude=600,
orbitStartYear=2022, orbitStartMonth=1, orbitStartDay=1, missionDuration=10)
sapre_result = nom_client.run_model(sapre_model)
print(sapre_result)
trajectory_model = nom_client.get_model('trajectory')
trajectory_model.set_params(epoch="2022-01-01", orbitSpecificationCode=205, naifCode=399, apogeeAltitude=20000, perigeeAltitude=600)
trajectory_result = nom_client.run_model(trajectory_model)
print(trajectory_result)
traj_res = [sapre_result, trajectory_result]
for tr in traj_res:
print("Running Ax8 model")
ap8ae8_model = nom_client.get_model('ae8ap8')
ap8ae8_model.set_external_input(external_input_name="trajectory", external_input=tr)
ap8ae8_results = nom_client.run_model(ap8ae8_model)
print(ap8ae8_results)
print("Running IRENE model")
irene_model = nom_client.get_model('irene-spm')
irene_model.set_params(mode="mean_percentiles", percentiles=[90], includePlasmaEnergies="true")
irene_model.set_external_input(external_input_name="trajectory", external_input=tr)
irene_results = nom_client.run_model(irene_model)
print(irene_results)
energy_ax8 = ap8ae8_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="energy")
int_flux_ax8 = ap8ae8_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="integral_flux")
diff_flux_ax8 = ap8ae8_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="differential_flux")
energy_ax9 = irene_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="energy")
int_flux_ax9 = irene_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="integral_flux",
percentile=90)
diff_flux_ax9 = irene_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="differential_flux",
percentile=90)
print(int_flux_ax9)
# int_flux_ax9 = irene_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="integral_flux")
# diff_flux_ax9 = irene_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="differential_flux")
# plt.loglog(energy_ax9.T, int_flux_ax9.T, linewidth=2.0, markersize=12.0, label=['75%', '90%'])
plot(x_data=[energy_ax8.T, energy_ax9.T],
y_data=[diff_flux_ax8.T, diff_flux_ax9.T],
plot_types="loglog",line_types="solid",xlabel="Energy (MeV)",
ylabel=f"Differential flux ()",
labels=['AP8', 'IRENE 50%'], title="AP8 vs. IRENE")
import datetime as dt
import matplotlib.pyplot as plt
from nom_client.nom_client import NoMClient
plt.rcParams['figure.figsize'] = [15, 10]
plt.rc('font', size=18)
def mjd50_to_datetime(mjd):
dt1950 = dt.datetime(1950, 1, 1, 0, 0, 0, 0)
if hasattr(mjd, "__len__"):
rval = []
for m in mjd:
t = dt1950 + dt.timedelta(m)
rval.append(t)
else:
rval = dt1950 + dt.timedelta(mjd)
return rval
def plot(x_data, y_data, plot_types, line_types, xlabel, ylabel, labels, title):
if not isinstance(plot_types, list):
plot_types = [plot_types] * len(x_data)
if not isinstance(line_types, list):
line_types = [line_types] * len(x_data)
if not isinstance(labels, list):
labels = [labels] * len(x_data)
for data_index in range(len(x_data)):
if plot_types[data_index] == 'loglog':
plt.loglog(x_data[data_index], y_data[data_index], linestyle=line_types[data_index], linewidth=2.0,
markersize=12.0,
label=labels[data_index])
elif plot_types[data_index] == 'semilogy':
plt.semilogy(x_data[data_index], y_data[data_index], linestyle=line_types[data_index], linewidth=2.0,
markersize=12.0,
label=labels[data_index])
elif plot_types[data_index] == 'semilogx':
plt.semilogx(x_data[data_index], y_data[data_index], linestyle=line_types[data_index], linewidth=2.0,
markersize=12.0,
label=labels[data_index])
else:
plt.plot(x_data[data_index], y_data[data_index], linestyle=line_types[data_index], linewidth=2.0,
markersize=12.0,
label=labels[data_index])
plt.title(title, fontsize=18)
plt.grid(True)
plt.legend(bbox_to_anchor=(0.95, 0.95), loc=1, borderaxespad=0.,
fancybox=True, fontsize=18, shadow=True)
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.show()
nom_client = NoMClient("IRENE example", default_server_id="local_server")
trajectory_model = nom_client.get_model('trajectory')
trajectory_model.set_params(orbitSpecificationCode=205,
naifCode=399, apogeeAltitude=20000, perigeeAltitude=600,
missionDuration=0.25)
trajectory_result = nom_client.run_model(trajectory_model)
print(trajectory_result)
mjd = trajectory_result['trajectory'].get_variable_data(variable_name="MJD")
alt = trajectory_result['trajectory'].get_variable_data(variable_name="altitude")
plot(x_data=[mjd.T],
y_data=[alt.T],
plot_types="plot",line_types="solid",xlabel="MJD",
ylabel=f"Altitude (m)",
labels=[''], title="IRENE by percentile")
print("Running Ax8 model")
ap8ae8_model = nom_client.get_model('ae8ap8')
ap8ae8_model.set_external_input(external_input_name="trajectory", external_input=trajectory_result)
ap8ae8_results = nom_client.run_model(ap8ae8_model)
print(ap8ae8_results)
print("Running IRENE model")
irene_model = nom_client.get_model('irene')
irene_model.set_params(mode="mean_percentiles", percentiles=[75, 90], includePlasmaEnergies="true")
irene_model.set_external_input(external_input_name="trajectory", external_input=trajectory_result)
irene_results = nom_client.run_model(irene_model)
print(irene_results)
# Get Ax8 results
energy_ax8 = ap8ae8_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="energy")
int_flux_ax8 = ap8ae8_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="integral_flux")
diff_flux_ax8 = ap8ae8_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="differential_flux")
# Get Ax9 results
energy_ax9 = irene_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="energy")
energy_units = irene_results['orbit_averaged_proton_spectrum'].get_variable_metadata(
variable_name="energy")['units']
diff_flux_ax9 = irene_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="differential_flux",
percentile=50).squeeze()
diff_units = irene_results['orbit_averaged_proton_spectrum'].get_variable_metadata(
variable_name="differential_flux")['units']
plot(x_data=[energy_ax8.T, energy_ax9.T],
y_data=[diff_flux_ax8.T, diff_flux_ax9.T],
plot_types="loglog",line_types="solid",xlabel=f"Energy ({energy_units})",
ylabel=f"Differential flux ({diff_units})",
labels=['AP8', 'IRENE 50%'], title="AP8 vs. IRENE")
# Plot all percentiles
diff_flux_ax9_all_pc = irene_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="differential_flux")
int_flux_ax9_all_pc = irene_results['orbit_averaged_proton_spectrum'].get_variable_data(variable_name="integral_flux")
plot(x_data=[energy_ax9.T],
y_data=[diff_flux_ax9_all_pc.T],
plot_types="loglog",line_types="solid", xlabel=f"Energy ({energy_units})",
ylabel=f"Differential flux ({diff_units})",
labels=['50%, 75%, 90%'], title="IRENE by percentile")
plot(x_data=[energy_ax9.T],
y_data=[int_flux_ax9_all_pc.T],
plot_types="loglog",line_types="solid", xlabel=f"Energy ({energy_units})",
ylabel=f"Integral flux ({diff_units})",
labels=['50%, 75%, 90%'], title="IRENE by percentile")
#
#
# mjd_over_traj_ax9 = irene_results['proton_spectrum_over_trajectory'].get_variable_data(variable_name="mjd").squeeze()
# irene_diff_flux_timeseries = irene_results['proton_spectrum_over_trajectory']
#
# diff_flux_over_traj_ax9 = irene_diff_flux_timeseries.get_variable_data(variable_name="differential_flux")
#
#
# datetimes = mjd50_to_datetime(mjd.squeeze()[1::40])
#
# diff_flux_over_traj_ax9_50pc = diff_flux_over_traj_ax9[0]
#
# plot(x_data=[mjd_over_traj_ax9.T],
# y_data=[diff_flux_over_traj_ax9_50pc],
# plot_types="semilogy",line_types="solid",xlabel="MJD (hr)",
# ylabel=f"Differential flux ({diff_units})",
# labels=energy_ax9.squeeze().T, title="IRENE")
#
# plot(x_data=[energy_ax9.T],
# y_data=[diff_flux_over_traj_ax9_50pc[1::40].T],
# plot_types="loglog",line_types="solid",xlabel=f"Energy ({energy_units})",
# ylabel=f"Differential flux ({diff_units})",
# labels=[datetimes], title="IRENE")
No references