Post Processing Functions
gcmprocpy provides a range of functions for post processing the data. Below are the key plotting routines along with their detailed parameters and usage examples.
Emissions Plots
gcmprocpy provides the ablity for plotting emissions data. Below are the variable names that can be used in the plot functions for emissions calculation.
Emissions Long Name |
Variable Name |
Requirements |
---|---|---|
5.3 micron NO emission |
NO53 |
Temperature, Atomic Oxygen, and NO data |
15 micron CO2 emission |
CO215 |
Temperature, Atomic Oxygen, and CO2 data |
OH emission for the v(8,3) band |
OH83 |
Temperature, Atomic Oxygen, Molecular Oxygen and Molecular Nitrogen data |
Note
Currently only Latitude vs Longitude contour plots are supported for emissions data.
Example 1: Plotting 5.3 micron NO emission
datasets = gy.load_datasets(directory, dataset_filter)
variable_name = 'NO53'
time = '2022-01-01T12:00:00'
pressure_level = 4.0
plot = gy.plt_lat_lon(datasets, variable_name, time=time, level=pressure_level)
Example 2: Plotting 15 micron CO2 emission
datasets = gy.load_datasets(directory, dataset_filter)
variable_name = 'CO215'
time = '2022-01-01T12:00:00'
pressure_level = 4.0
plot = gy.plt_lat_lon(datasets, variable_name, time=time, level=pressure_level)
Example 3: Plotting OH emission for the v(8,3) band
datasets = gy.load_datasets(directory, dataset_filter)
variable_name = 'OH83'
time = '2022-01-01T12:00:00'
pressure_level = 4.0
plot = gy.plt_lat_lon(datasets, variable_name, time=time, level=pressure_level)
Emissions Xarrays
5.3 micron NO emission
This function processes the given datasets to generate an array of 5.3-micron NO emissions based on temperature, O1, and NO data.
- gcmprocpy.data_emissions.arr_mkeno53(datasets, variable_name, time, selected_lev_ilev=None, selected_unit=None, plot_mode=False)[source]
Generate 5.3-micron NO emission array from datasets. This function processes the given datasets to generate an array of 5.3-micron NO emissions based on temperature, O1, and NO data.
Requires the following variables: - TN or T: Temperature - O1 or O: Oxygen - NO: Nitric oxide concentration
- Parameters:
datasets (list) – List of datasets to process.
variable_name (str) – Name of the variable to process.
time (datetime) – Specific time for which data is to be processed.
selected_lev_ilev (int, optional) – Selected level or ilev. Defaults to None.
selected_unit (str, optional) – Unit of the variable. Defaults to None.
plot_mode (bool, optional) – Flag to indicate if plot mode is enabled. Defaults to False.
- Returns:
If plot_mode is False, returns an numpy array containing 5.3-micron NO emissions for the specified time and level. If plot_mode is True, returns a tuple containing: - NO_emission (ndarray): Array of 5.3-micron NO emissions. - level (ndarray): Array of levels. - unique_lats (ndarray): Array of unique latitudes. - unique_lons (ndarray): Array of unique longitudes. - str: Empty string placeholder. - str: Description of the emission (“5.3-micron NO”). - selected_mtime (datetime): Selected time. - filename (str): Name of the file processed.
- Return type:
Union[xarray.DataArray, tuple]
15 micron CO2 emission
This function processes the given datasets to generate an array of 15-micron CO2 emissions based on temperature, O1, and CO2 data.
- gcmprocpy.data_emissions.arr_mkeco215(datasets, variable_name, time, selected_lev_ilev=None, selected_unit=None, plot_mode=False)[source]
Generate CO2 emissions using the mkeco215 model based on temperature, oxygen, and CO2 data.
Requires the following variables: - TN or T: Temperature - O1 or O: Oxygen - CO2: CO2 concentration
- Parameters:
datasets (list) – List of datasets to be used for extracting variables.
variable_name (str) – Name of the variable to be processed.
time (datetime) – Specific time for which the data is to be processed.
selected_lev_ilev (int, optional) – Specific level or ilevel to be selected. Defaults to None.
selected_unit (str, optional) – Unit to which the data should be converted. Defaults to None.
plot_mode (bool, optional) – If True, additional plotting information is returned. Defaults to False.
- Returns:
If plot_mode is False, returns an numpy array containing CO2 emissions for the specified time and level. If plot_mode is True, returns a tuple containing: - CO2_emission (numpy.ndarray): CO2 emissions calculated by the mkeco215 model. - level (int): Selected level or ilevel. - unique_lats (numpy.ndarray): Unique latitudes. - unique_lons (numpy.ndarray): Unique longitudes. - str: Placeholder string. - str: Long name for the 15-micron CO2 emission. - datetime: Selected time. - str: Filename of the dataset.
- Return type:
Union[xarray.DataArray, tuple]
OH emission for the v(8,3) band
This function processes the given datasets to generate an array of OH emissions for the v(8,3) band based on temperature, O1, and OH data.
- gcmprocpy.data_emissions.arr_mkeoh83(datasets, variable_name, time, selected_lev_ilev=None, selected_unit=None, plot_mode=False)[source]
Generate OH emissions using the mkeoh83 model based on temperature, oxygen, and nitrogen data.
Requires the following variables: - TN or T: Temperature - O1 or O: Oxygen - O2: Molecular oxygen - N2: Molecular nitrogen
- Parameters:
datasets (list) – List of datasets to be used for extracting variables.
variable_name (str) – Name of the variable to be processed.
time (datetime) – Specific time for which the data is to be processed.
selected_lev_ilev (int, optional) – Specific level or ilevel to be selected. Defaults to None.
selected_unit (str, optional) – Unit to which the data should be converted. Defaults to None.
plot_mode (bool, optional) – If True, additional plotting information is returned. Defaults to False.
- Returns:
If plot_mode is False, returns a numpy array containing OH emissions for the specified time and level. If plot_mode is True, returns a tuple containing: - OH_emission (numpy.ndarray): OH emissions calculated by the mkeoh83 model. - level (int): Selected level or ilevel. - unique_lats (numpy.ndarray): Unique latitudes. - unique_lons (numpy.ndarray): Unique longitudes. - str: Placeholder string. - str: Long name for the OH v(8,3) emission. - datetime: Selected time. - str: Filename of the dataset.
- Return type:
Union[numpy.ndarray, tuple]
Emissions Calculation
5.3 micron NO emission
This function calcuates 5.3 micron NO emission (from John Wise).
- gcmprocpy.data_emissions.mkeno53(arr_temp, arr_o, arr_no)[source]
Calucates 5.3 micron NO emission (from John Wise). The formula used is:
- N(5.3 mic) = (2.63E-22) * exp[-2715 / Tk] * [O] * [NO]
(4 * Pi) * (10.78 + 6.5E-11 * [O])
Where:
[O] is the oxygen concentration.
[NO] is the nitric oxide concentration.
Tk is the temperature in Kelvin.
\[N(5.3 \, \mu m) = \frac{2.63 \times 10^{-22} \cdot \exp\left(-\frac{2715}{T_k}\right) \cdot [O] \cdot [NO]}{4 \pi \cdot \left(10.78 + 6.5 \times 10^{-11} \cdot [O]\right)}\]- Parameters:
arr_temp (numpy.ndarray) – Array of temperatures in Kelvin.
arr_o (numpy.ndarray) – Array of oxygen concentrations.
arr_no (numpy.ndarray) – Array of nitric oxide concentrations.
- Returns:
Calculated NO emission at 5.3 microns.
- Return type:
numpy.ndarray
15 micron CO2 emission
This function calcuates 15 micron CO2 emission (from John Wise).
- gcmprocpy.data_emissions.mkeco215(arr_temp, arr_o, arr_co2)[source]
Calucates 15 micron CO2 emission (from John Wise).
The formula used is:
- N(15 mic) = (5.94E-26) * sqrt(Tk) * exp[-960 / Tk] * [O] * [CO2]
(4 * Pi) * (1.28 + 3.5E-13 * sqrt(Tk) * [O])
Where:
[O] is the oxygen concentration.
[CO2] is the carbon dioxide concentration.
Tk is the temperature in Kelvin.
The 15 micron term is only the O-CO2 collisional component, but it accounts for at least 80% of the radiance above 110 km.
\[N(15 \, \mu m) = \frac{5.94 \times 10^{-26} \cdot \sqrt{T_k} \cdot \exp\left(-\frac{960}{T_k}\right) \cdot [O] \cdot [CO_2]}{4 \pi \cdot \left(1.28 + 3.5 \times 10^{-13} \cdot \sqrt{T_k} \cdot [O]\right)}\]- Parameters:
arr_temp (numpy.ndarray) – Array of temperatures (Tk).
arr_o (numpy.ndarray) – Array of oxygen concentrations [O].
arr_co2 (numpy.ndarray) – Array of CO2 concentrations [CO2].
- Returns:
Calculated 15 micron CO2 emission.
- Return type:
numpy.ndarray
OH emission for the v(8,3) band
This function calcuates OH emission for the v(8,3) band.
- gcmprocpy.data_emissions.mkeoh83(arr_temp, arr_o, arr_o2, arr_n2)[source]
Calculate OH emission for the v(8,3) band.
- Parameters:
arr_temp (numpy.ndarray) – Array of temperatures (K).
arr_o (numpy.ndarray) – Array of atomic oxygen densities (cm^-3).
arr_o2 (numpy.ndarray) – Array of molecular oxygen densities (cm^-3).
arr_n2 (numpy.ndarray) – Array of molecular nitrogen densities (cm^-3).
- Returns:
Calculated OH emission for the v(8,3) band.
- Return type:
numpy.ndarray