How-to guides¶
Quickstart¶
The main interface of Joseki is its make method. This method creates the atmospheric profile corresponding to a given identifier. For example, make the so-called AFGL US Standard atmospheric profile from Anderson et al (1986) with:
Display the available identifiers with:
Use the to_dataset
method to save the dataset to the disk as a
netCDF file:
For other formats, refer to the xarray IO documentation.
Saving to CSV file
Note that one drawback of saving to a CSV file in the above manner is that the information on the quantity units is lost.
Open the dataset again using
xarray.open_dataset
:
The datasets format is described here.
Altitude grid¶
You can specify the altitude grid for your atmospheric profile. If the source atmospheric profile is based on tabulated data, it is going to be interpolated on the specified altitude grid.
Example
During interpolation, the column number densities associated to the different
atmospheric constituents are likely going to be changed.
In the example above, the ozone column number density is increased to
346.60 Dobson units compared to the atmospheric profile with the original
altitude grid, which has an ozone column number density of 345.75 Dobson units.
To ensure column densities are conserved during interpolation, set the
conserve_column
parameter to True
.
Example
Cells representation¶
To make an atmospheric profile where data variables are given in altitude cells
instead of at altitude levels, set the parameter represent_in_cells
to
True
:
The resulting dataset has a coordinate variable z
that corresponds to
the altitude cells center and a data variable z_bounds
that indicate the
altitude bounds of each altitude cell, i.e. atmospheric layer.
Note that moving a profile from the nodes-representation to the cells-representation is achieved by interpolating the nodes-represented profile. As a result, column densities are likely to be different in the cells-represented profile.
Similarly to when specifying the altitude grid, you can
ensure that column densities are conserved with the conserve_column
parameter.
Advanced options¶
The collection of atmospheric profiles defined by
Anderson et al (1986) includes volume mixing
ratio data for 28 molecules, where molecules 8-28 are described as additional.
By default, these additional molecules are included in the atmospheric profile.
To discard these additional molecules, set the additional_molecules
parameter to False
:
ds = joseki.make(
identifier="afgl_1986-us_standard",
represent_in_cells=True,
additional_molecules=False,
)
The resulting dataset now includes only 7 molecules, instead of 28.
Derived quantities¶
You can compute various derived quantities from a thermophysical properties
dataset produced by joseki
, as illustrated by the examples below.
Column number density
For further details on these methods, refer to the API reference.
Rescaling¶
You can modify the amount of a given set of molecules in your thermophysical properties dataset by applying a rescale transformation.
Example
In the example above, the amount of water vapor is halfed whereas the amount of
carbon dioxide and methane is increased by 150% and 110%, respectively.
When a rescale transformation has been applied to a dataset, its history
attribute is updated to indicate what scaling factors were applied to what
molecules.
Plotting¶
Note
For plotting, you will need to install the matplotlib library.
You can easily make a plot of any of the variables of a dataset, i.e.,
air pressure (p
), air temperature (t
), air number density (n
) or
volume fraction (x_*
):
Pressure plot
import matplotlib.pyplot as plt
ds = joseki.make(
identifier="afgl_1986-us_standard",
additional_molecules=False
)
ds.p.plot(
figsize=(4, 8),
ls="dotted",
marker=".",
y="z",
xscale="log",
)
plt.show()