Parsing Multiple NEMESIS Cores

And similarly, we can use eleos.results to load all the cores in a directory as a list of eleos.results.NemesisResult

 1import matplotlib.pyplot as plt
 2from eleos import results
 3
 4
 5# Load all the cores - use raise_errors=False to silently skip any failed retrievals
 6res = results.load_multiple_cores("multiple_example/", raise_errors=False)
 7
 8# Loop over all the NemesisResult objects
 9for r in res:
10
11    # Extract the AerosolProfile that was used to represent the haze
12    haze = r.profiles["Haze"]
13
14    # Print out the prior and retrieved opacities, and the chi squared value of the fit
15    print(haze.opacity, haze.retrieved_opacity, r.chi_sq)
16
17    # Plot the model spectrum
18    plt.plot(r.retrieved_spectrum.wavelength, r.retrieved_Spectrum.model, label=f"Haze opacity={haze.opacity}")
19
20# Plot the data for comparison
21plt.plot(res[0].retrieved_spectrum.wavelength, res[0].retrieved_spectrum.measured, label="Data")
22plt.legend()
23plt.show()