carmapy.Results#
- class carmapy.Results(carma, read_diag=False)#
An object which stores the results of a CARMA simulation.
- Parameters:
carma (Carma) – The carma simulation to load results from
read_diag (boolean, optional) – If true reads in the microphysical rates and core mass fraction. Defaults to False.
Notes
The
results.cloudsdictionary is indexed by names of the cloud species (seeresults.group_names) and stores the following values:results.clouds['r']is a 1D numpy array of length NBIN which stores the radii of the cloud particle bins in cmresults.clouds['rmass']is a 1D numpy array of length NBIN which stores the mass of the cloud particle bins in gresults.clouds['numden']is a 3D numpy array of shape (NZ, NBIN, NT) which stores the number density of each cloud species in each size bin at each time step in units of cm⁻³results.clouds['coremass_frac']is a 3D numpy array ofshape (NZ, NBIN, NT) which stores the fraction of mass in each bin stored in the particle core. Only stored if
read_diag=True.
results.clouds['nuc_gain_rate']is a 3D numpy array ofshape (NZ, NBIN, NT) which stores the rate at which particles are added to the bin via nucleation [particles/s/cm³]. Only stored if
read_diag=True.
results.clouds['nuc_loss_rate']is a 3D numpy array of shape (NZ, NBIN, NT) which stores the rate at which particles are removed from a bin due to nucleation [particles/s/cm³]. Only stored ifread_diag=True.
results.clouds['grow_gain_rate']is a 3D numpy array ofshape (NZ, NBIN, NT) which stores the rate at which particles are added to a bin due to condensational growth [particles/s/cm³]. Only stored if
read_diag=True.
results.clouds['grow_loss_rate']is a 3D numpy array ofshape (NZ, NBIN, NT) which stores the rate at which particles are removed from a bin due to condensational growth [particles/s/cm³]. Only stored if
read_diag=True.
results.clouds['evap_gain_rate']is a 3D numpy array ofshape (NZ, NBIN, NT) which stores the rate at which particles are added to a bin due to evaporation [particles/s/cm³] . Only stored if
read_diag=True.
results.clouds['evap_loss_rate']is a 3D numpy array ofshape (NZ, NBIN, NT) which stores the rate at which particles are removed from a bin due to evaporation [particles/s/cm³]. Only stored if
read_diag=True.
- In a 2-D CARMApy run two additional items are saved:
results.gases_2dstores the same info asresults.gasesbut stores (NZ, NLONGITUDE) arrays instead of (NZ, NT) arraysresults.longitude_maptakes in a 3-D array of shape (NZ, NBIN, NT) and transforms it to an array of shape (NZ, NBIN, NLONGITUDE) where each longitude bin in the average of all timesteps corresponding to that longitude. This function is designed to work on theresults.clouds["numden"]array as well as any of the microphysical rates arrays inresults.clouds.
Methods
Generates an atmosphere file for use in picaso.
Generate cloud opacity tables for use in picaso.
Plots condensation curves for each gas species in the CARMA model overlaid on the model's P-T profile.
plot_numdens(…)Interactively plots the number densities of the cloud species.
plot_toa_gas(…)Plots the gas abundances at the top of the atmosphere.
Attributes
carmaThe carma simulation that generated these results
cloudsA dictionary storing results for each cloud species (see notes)
dt_timestepThe length of time between each output [s]
gas_namesThe name of each of the simulated gases
gasesThe number mixing ratio for each of the gases
gases_2dThe number mixing ratio for each of the gases by longitude
group_namesThe name of each of the simulated groups
longitude_mapA function to transform arrays to be by longitude (see notes)
PPressure centers alias [barye] (NZ)
pathThe path to the CARMA output files
sat_vpThe saturation mixing ratios of the gases (NZ, NGAS, NT, [NLONG])
TTemperature centers alias [K] (NZ, [NLONG])
tsTime elapsed since start of simulation at each step [s] (NT)
ZAltitude centers alias [cm] (NZ)
- Results.gen_picaso_atm_file(file_path=None)#
Generates an atmosphere file for use in picaso. Picaso is a python package which can calculate spectra and is available at natashabatalha/picaso.
- Parameters:
file_path (
str) – The path to save the file to. If not provided, creates a file located in the directory storing the carma simulation.- Return type:
None
- Results.gen_picaso_cloud_file(wavelengths, file_path=None, mie_table_path=None, skip_groups=[])#
Generate cloud opacity tables for use in picaso. Picaso is a python package which can calculate spectra and is available at natashabatalha/picaso.
- Parameters:
wavelengths (
ndarray) – The wavelengths at which to calculate to opacities [cm]file_path (
str) – The path to save the file to. If not provided, creates a file located in the directory storing the carma simulation.mie_table_path (
str) – The directory in which the mie tables of the species are located. It is assumed that each cloud species used has a .dat file in that directory named with the name of the cloud species (ie ‘Mg2SiO4 on TiO2.dat’), the first row of the table is a header row, and the columns are radius[cm], wavelength[cm], extinction efficiency (Q_ext), scattering efficiency (Q_sca), and asymmetry factor (g). The columns must be in that order and separated by whitespace. If no path is provided, the carma default tables will be used but these might be less accurate, even for the same species, as they might not be calculated at the same particle size and wavelengths.skip_groups (list, optional) – The indices of any cloud groups to exclude from the opacity calculation, by default None
- Results.plot_condensation_curves(ax=None, t_step=-1, skip_gases=None, **kwargs)#
Plots condensation curves for each gas species in the CARMA model overlaid on the model’s P-T profile.
For each gas the condensation curve is the locus of (T, P) points at which the gas partial pressure equals its saturation vapour pressure (i.e. saturation ratio = 1). The curve is computed analytically from the vapour-pressure coefficients stored in
constants.gas_dictusing the deep-atmosphere gas mixing ratio from the simulation. Species whose vapour-pressure formula does not have a temperature coefficient (e.g. H2O, which uses a custom Fortran routine) are plotted using the saturation vapour pressures stored directly inresults.sat_vp.- Parameters:
ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created when None.
t_step (int, optional) – Time-step index used to read gas abundances, by default
-1(last recorded step).skip_gases (list[int], optional) – List of gas indices to exclude. Defaults to
[](plot all species).**kwargs – Extra keyword arguments forwarded to
ax.plotfor the P-T profile line only.
- Returns:
fig (matplotlib.figure.Figure)
ax (matplotlib.axes.Axes)
- Results.plot_numdens(nlevels=11, min_order=-10, **kwargs)#
Interactively plots the number densities of the cloud species. Densities are normalized to the peak number density in the plot. Interactivly change the cloud species which is plotted and the timestep using the sliders
Note
If in a notebook, requires
%matplotlib ipymplto have been invoked- Parameters:
nlevels (int, optional) – The number of contours to plot, by default 11
min_order (int, optional) – The number of orders of magnitude below the peak density to show, by default -10
- Return type:
None
- Results.plot_toa_gas(skip_gases=[0], burn_in=20, **kwargs)#
Plots the gas abundances at the top of the atmosphere. Useful for determining whether or not the simulation has converged.
**kwargsare passed to pyplot- Parameters:
skip_gases (list, optional) – A list of gases, by index, to skip plotting, by default [0] (H2O)
burn_in (int, optional) – The number of timesteps to exclude from the start of the simulation, by default 20