Skip to content

Commit

Permalink
Implemented marking Vance et al. (2021) models on inductogram plots
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmoosh committed Jun 20, 2022
1 parent 7ef32bd commit f91b346
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 25 deletions.
1 change: 0 additions & 1 deletion PlanetProfile/MagneticInduction/Moments.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def SetComps(self, inductOtype):
self.comps = np.unique(self.compsList)



class ExcitationsList:
def __init__(self):
self.nprmMax = 1
Expand Down
9 changes: 7 additions & 2 deletions PlanetProfile/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,14 @@ def ReloadInductOgram(bodyname, Params, fNameOverride=None):
bodydir = bodyname
Planet = importlib.import_module(f'{bodydir}.PP{loadname}InductOgram').Planet
Params.DataFiles, Params.FigureFiles = SetupFilenames(Planet, Params)
reload = loadmat(Params.DataFiles.inductOgramFile)
loadFile = Params.DataFiles.inductOgramFile
else:
reload = loadmat(fNameOverride)
loadFile = fNameOverride
if os.path.isfile(loadFile):
reload = loadmat(loadFile)
else:
raise FileNotFoundError(f'Attempted to reload inductogram, but {loadFile} was not found. ' +
'Re-run with Params.CALC_NEW_INDUCT = True in configPP.py.')

Induction = InductionResults
Induction.bodyname = reload['bodyname'][0]
Expand Down
62 changes: 52 additions & 10 deletions PlanetProfile/Plotting/ProfilePlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ def PlotInductOgram(Induction, Params):

for z, name, fLabel in zip(comboData, comboTitles, comboLabels):
ax = axes[coords[fLabel]]
ax.title.set_text(name)
ax.set_title(name)
zContours = [ax.contour(Induction.sigmaMean_Sm, Induction.D_km, z[i, ...],
colors=Color.Induction[T], linestyles=Style.LS_Induction[T],
linewidths=Style.LW_Induction[T], levels=IndParams.GetClevels(fLabel, T))
Expand All @@ -1118,6 +1118,9 @@ def PlotInductOgram(Induction, Params):
fontsize=FigMisc.cLabelSize, inline_spacing=FigMisc.cLabelPad)
for i, T in enumerate(Induction.Texc_hr.keys())]

if FigMisc.PLOT_V2021 and Induction.bodyname in ['Europa', 'Ganymede', 'Callisto']:
AddV2021points(Params.Induct, Induction.bodyname, 'sigma', allAxes)

if Params.LEGEND:
lines = np.array([contour.legend_elements()[0][0] for contour in zContours])
axes[1,1].legend(lines[iSort], FigLbl.legendTexc[iSort], framealpha=FigMisc.cLegendOpacity)
Expand Down Expand Up @@ -1150,7 +1153,7 @@ def PlotInductOgram(Induction, Params):

for z, name, fLabel in zip(comboData, comboTitles, comboLabels):
ax = axes[coords[fLabel]]
ax.title.set_text(name)
ax.set_title(name)
zContours = [ax.contour(Induction.x, Induction.y, z[i, ...],
colors=Color.Induction[T], linestyles=Style.LS_Induction[T],
linewidths=Style.LW_Induction[T],
Expand All @@ -1160,6 +1163,9 @@ def PlotInductOgram(Induction, Params):
fontsize=FigMisc.cLabelSize, inline_spacing=FigMisc.cLabelPad)
for i, T in enumerate(Induction.Texc_hr.keys())]

if FigMisc.PLOT_V2021 and Induction.bodyname in ['Europa', 'Ganymede', 'Callisto']:
AddV2021points(Params.Induct, Induction.bodyname, Params.Induct.inductOtype, allAxes)

if Params.LEGEND:
lines = np.array([contour.legend_elements()[0][0] for contour in zContours])
axes[1,1].legend(lines[iSort], FigLbl.legendTexc[iSort], framealpha=FigMisc.cLegendOpacity)
Expand Down Expand Up @@ -1192,10 +1198,10 @@ def PlotInductOgram(Induction, Params):
[ax.set_xlim(FigLbl.sigLims) for ax in axes[1,:]]
[ax.set_ylim(FigLbl.Dlims) for ax in axes[1,:]]

axes[0,0].title.set_text(comboTitles[0])
axes[1,0].title.set_text(comboTitles[0])
axes[0,1].title.set_text(comboTitles[-1])
axes[1,1].title.set_text(comboTitles[-1])
axes[0,0].set_title(comboTitles[0])
axes[1,0].set_title(comboTitles[0])
axes[0,1].set_title(comboTitles[-1])
axes[1,1].set_title(comboTitles[-1])
zContours = [axes[0,0].contour(Induction.x, Induction.y, comboData[0][i, ...],
colors=Color.Induction[T], linestyles=Style.LS_Induction[T],
linewidths=Style.LW_Induction[T],
Expand Down Expand Up @@ -1223,6 +1229,10 @@ def PlotInductOgram(Induction, Params):
fontsize=FigMisc.cLabelSize, inline_spacing=FigMisc.cLabelPad)
for i, T in enumerate(Induction.Texc_hr.keys())]

if FigMisc.PLOT_V2021 and Induction.bodyname in ['Europa', 'Ganymede', 'Callisto']:
AddV2021points(Params.Induct, Induction.bodyname, Params.Induct.inductOtype, axes[0,:])
AddV2021points(Params.Induct, Induction.bodyname, 'sigma', axes[1,:])

if Params.LEGEND:
lines = np.array([contour.legend_elements()[0][0] for contour in zContours])
axes[1,1].legend(lines[iSort], FigLbl.legendTexc[iSort], framealpha=FigMisc.cLegendOpacity)
Expand Down Expand Up @@ -1250,8 +1260,8 @@ def PlotInductOgram(Induction, Params):

# Labels and titles
fig.suptitle(FigLbl.inductionTitle)
axes[0].title.set_text(name)
axes[1].title.set_text(FigLbl.phaseTitle)
axes[0].set_title(name)
axes[1].set_title(FigLbl.phaseTitle)
[ax.set_xlabel(FigLbl.sigMeanLabel) for ax in axes]
[ax.set_ylabel(FigLbl.Dlabel) for ax in axes]
[ax.set_xlim(FigLbl.sigLims) for ax in axes]
Expand All @@ -1278,6 +1288,9 @@ def PlotInductOgram(Induction, Params):
else:
fNameSigma = Params.FigureFiles.sigma[fLabel]

if FigMisc.PLOT_V2021 and Induction.bodyname in ['Europa', 'Ganymede', 'Callisto']:
AddV2021points(Params.Induct, Induction.bodyname, 'sigma', axes)

if Params.LEGEND:
lines = np.array([contour.legend_elements()[0][0] for contour in phaseContours])
axes[1].legend(lines[iSort], FigLbl.legendTexc[iSort], framealpha=FigMisc.cLegendOpacity)
Expand All @@ -1297,8 +1310,8 @@ def PlotInductOgram(Induction, Params):

# Labels and titles
fig.suptitle(FigLbl.inductionTitle)
axes[0].title.set_text(name)
axes[1].title.set_text(FigLbl.phaseTitle)
axes[0].set_title(name)
axes[1].set_title(FigLbl.phaseTitle)
[ax.set_xscale(FigLbl.wScale) for ax in axes]
[ax.set_xlabel(FigLbl.wLabel) for ax in axes]
[ax.set_ylabel(FigLbl.yLabelInduct) for ax in axes]
Expand All @@ -1319,6 +1332,9 @@ def PlotInductOgram(Induction, Params):
fontsize=FigMisc.cLabelSize, inline_spacing=FigMisc.cLabelPad)
for i, T in enumerate(Induction.Texc_hr.keys())]

if FigMisc.PLOT_V2021 and Induction.bodyname in ['Europa', 'Ganymede', 'Callisto']:
AddV2021points(Params.Induct, Induction.bodyname, Params.Induct.inductOtype, axes)

if Params.LEGEND:
lines = np.array([contour.legend_elements()[0][0] for contour in phaseContours])
axes[1].legend(lines[iSort], FigLbl.legendTexc[iSort], framealpha=FigMisc.cLegendOpacity)
Expand All @@ -1331,6 +1347,32 @@ def PlotInductOgram(Induction, Params):
return


def AddV2021points(IndParams, bodyname, inductOtype, axes):
if inductOtype == 'sigma' or inductOtype == 'Tb':
log.debug('Adding Vance et al. (2021) markers to inductogram.')
if inductOtype == 'sigma':
xVals = IndParams.V2021_sigma_Sm[bodyname]
yVals = IndParams.V2021_D_km[bodyname]
else:
xVals = IndParams.V2021_w_ppt[bodyname]
yVals = IndParams.V2021_Tb_K[bodyname]
UP = IndParams.V2021_zb_km[bodyname] == np.min(IndParams.V2021_zb_km[bodyname])
DOWN = np.logical_not(UP)
[ax.scatter(xVals[UP], yVals[UP], marker=IndParams.V2021_MS[bodyname][UP][0],
facecolor=IndParams.V2021_FC[bodyname][UP],
edgecolor=IndParams.V2021_EC[bodyname][UP],
label=r'Vance et al.\ (2021) models') for ax in axes]
[ax.scatter(xVals[DOWN], yVals[DOWN], marker=IndParams.V2021_MS[bodyname][DOWN][0],
facecolor=IndParams.V2021_FC[bodyname][DOWN],
edgecolor=IndParams.V2021_EC[bodyname][DOWN]
) for ax in axes]
else:
log.warning(f'FigMisc.PLOT_V2021 is True but inductOtype "{inductOtype}" is '
'not supported. Skipping.')

return


def PlotExploreOgram(ExplorationList, Params):
""" For plotting points showing the various models used in making
exploreogram plots.
Expand Down
2 changes: 1 addition & 1 deletion PlanetProfile/Plotting/defaultConfigPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
FigMisc.NORMALIZED_SALINITIES = False # Whether to normalize salinities to absolute concentrations relative to the saturation limit for each salt
FigMisc.NORMALIZED_TEMPERATURES = False # Whether to normalize ocean mean temperatures to specified maxima and minima for the colormap
# Inductograms
FigMisc.PLOT_V2021 = True # Mark the selected ocean/conductivity combos used in Vance et al. 2021
FigMisc.PLOT_V2021 = False # Mark the selected ocean/conductivity combos used in Vance et al. 2021
# Excitation spectra
FigMisc.MAG_SPECTRA_PERIODS = True # Plot against periods for magnetic spectra plots (or frequencies)
FigMisc.MARK_TEXC = True # Add lines marking the main excitation periods/frequencies on Ae1 plot
Expand Down
66 changes: 55 additions & 11 deletions PlanetProfile/Utilities/defineStructs.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,17 +611,61 @@ def __init__(self, inductOtype, cLevels, dftC, cFmt):
self.oceanInterpMethod = 'linear' # Interpolation method for determining ocean conductivities when REDUCED_INDUCT is True.
self.nIntL = 5 # Number of ocean layers to use when REDUCED_INDUCT = 1

# Plot settings to match inductograms from Vance et al. (2021): https://doi.org/10.1029/2020JE006418
self.V2021_D_km = [91, 117, 96, 124,
91, 117, 91, 119]
self.V2021_sigma_Sm = [0.4132, 0.4533, 3.3661, 3.7646,
0.3651, 0.3855, 2.8862, 3.0760]
self.V2021_faceColors = [None, None, 'b', 'm',
None, None, 'c', '#b000ff']
self.V2021_edgeColors = ['b', 'm', 'k', 'k',
'c', '#b000ff', 'k', 'k']
self.V2021_symbols = ['^', 'v', '^', 'v',
'^', 'v', '^', 'v']
# Plot settings to mark on inductograms after Vance et al. (2021): https://doi.org/10.1029/2020JE006418
self.V2021_zb_km = {
'Europa': np.array([5, 30, 5, 30,
5, 30, 5, 30]),
'Ganymede': np.array([25, 92, 25, 92]),
'Callisto': np.array([99, 128, 99, 128])
}
self.V2021_D_km = {
'Europa': np.array([117, 91, 124, 96,
117, 91, 119, 91]),
'Ganymede': np.array([442, 276, 458, 282]),
'Callisto': np.array([132, 21, 130, 21])
}
self.V2021_sigma_Sm = {
'Europa': np.array([0.4533, 0.4132, 3.7646, 3.3661,
0.3855, 0.3651, 3.0760, 2.8862]),
'Ganymede': np.array([0.5166, 0.3322, 4.0699, 2.3476]),
'Callisto': np.array([0.2307, 0.0895, 1.5256, 0.6025])
}
self.V2021_comp = {
'Europa': np.array(['MgSO4', 'MgSO4', 'MgSO4', 'MgSO4',
'Seawater', 'Seawater', 'Seawater', 'Seawater']),
'Ganymede': np.array(['MgSO4', 'MgSO4', 'MgSO4', 'MgSO4']),
'Callisto': np.array(['MgSO4', 'MgSO4', 'MgSO4', 'MgSO4'])
}
self.V2021_w_ppt = {
'Europa': np.array([10, 10, 100, 100,
3.5165, 3.5165, 35.165, 35.165]),
'Ganymede': np.array([10, 10, 100, 100]),
'Callisto': np.array([10, 10, 100, 100])
}
self.V2021_Tb_K = {
'Europa': np.array([273.1, 270.4, 272.7, 269.8,
272.5, 270.0, 270.8, 268.2]),
'Ganymede': np.array([270.7, 261.6, 270.2, 260.0]),
'Callisto': np.array([257.4, 250.8, 255.7, 250.8])
}
self.V2021_FC = {
'Europa': np.array(['None', 'None', 'm', 'b',
'None', 'None', '#b000ff', 'c']),
'Ganymede': np.array(['None', 'None', 'm', 'b']),
'Callisto': np.array(['None', 'None', 'm', 'b'])
}
self.V2021_EC = {
'Europa': np.array(['m', 'b', 'k', 'k',
'#b000ff', 'c', 'k', 'k']),
'Ganymede': np.array(['m', 'b', 'k', 'k']),
'Callisto': np.array(['m', 'b', 'k', 'k'])
}
self.V2021_MS = {
'Europa': np.array(['v', '^', 'v', '^',
'v', '^', 'v', '^']),
'Ganymede': np.array(['v', '^', 'v', '^']),
'Callisto': np.array(['v', '^', 'v', '^'])
}

def GetClevels(self, zName, Tname):
if self.bodyname is None:
Expand Down

0 comments on commit f91b346

Please sign in to comment.