melodies_monet.util.sat_l2_swath_utility_tropomi
Python utility for TROPOMI use.
Functions
|
Applies the averaging kernel and calculates the column |
|
Applies the averaging kernel for TROPOMI total column CO and calculates the column. |
|
Applies the averaging kernel for TROPOMI HCHO and calculates the column. |
|
Applies the averaging kernel for TROPOMI NO2 and calculates the column |
|
Reformats the output dictionary to a structured grid. |
|
Subselects the observations depending on the model domain. |
|
Interpolates model horizontally to satellite |
|
Interpolates model vertical layers to TROPOMI vertical layers |
|
Regrids and applies AK to multiple swaths. |
|
Selects the swaths overlapping with the model domain. |
|
Converts column data from mol/m2 to molec/cm2 |
|
Checks if any of the observations are within the model domain. |
- melodies_monet.util.sat_l2_swath_utility_tropomi.apply_averaging_kernel(modobj, obsobj, sat_type, varname=None, averaging_kernel_params=None)
Applies the averaging kernel and calculates the column
- Parameters:
modobj (
xr.Dataset) – DataArray containing the model information. It has to be previously regridded to satellite space.obsobj (
xr.Dataset) – Dataset containing all the observational data, including the variables related to the averaging kernel.sat_type (
str) – string of satellite type. Currently, tropomi_l2_no2, tropomi_l2_hcho and tropomi_l2_co are supportedaveraging_kernel_params (
dict[str,str]) – dictionary containing the keys “averaging_kernel” and “tropospheric_averaging_kernel_calc” plus, optionally, “airmass_factor_total” and “airmass_factor_troposphere”.
- Returns:
xr.DataArray– DataArray containing the model columns after applying the averaging kernel.
- melodies_monet.util.sat_l2_swath_utility_tropomi.apply_averaging_kernel_co(mod_p_cols, obsobj, varname=None, averaging_kernel_params=None)
Applies the averaging kernel for TROPOMI total column CO and calculates the column. It is in the User Guide.
- Parameters:
mod_p_cols (
xr.DataArray) – DataArray containing the model HCHO partial columns. It has to be previously regridded to satellite space.obsobj (
xr.Dataset) – Dataset containing all the observational data, including the variables related to the averaging kernel.averaging_kernel_params (
dict[str,str]) – Dict containing the averaging kernel params
- Returns:
xr.DataArray– DataArray containing the model columns after applying the averaging kernel.
- melodies_monet.util.sat_l2_swath_utility_tropomi.apply_averaging_kernel_hcho(mod_p_cols, obsobj, varname=None, averaging_kernel_params=None)
Applies the averaging kernel for TROPOMI HCHO and calculates the column. It is in the ATBD documentation, instead of the user guide.
- Parameters:
mod_p_cols (
xr.DataArray) – DataArray containing the model HCHO partial columns. It has to be previously regridded to satellite space.obsobj (
xr.Dataset) – Dataset containing all the observational data, including the variables related to the averaging kernel.averaging_kernel_params (
dict[str,str]) – dictionary containing the keys “averaging_kernel” and “tropospheric_averaging_kernel_calc” plus, optionally, “airmass_factor_total” and “airmass_factor_troposphere”.
- Returns:
xr.DataArray– DataArray containing the model columns after applying the averaging kernel.
- melodies_monet.util.sat_l2_swath_utility_tropomi.apply_averaging_kernel_no2(mod_p_cols, obsobj, averaging_kernel_params=None)
Applies the averaging kernel for TROPOMI NO2 and calculates the column
- Parameters:
mod_p_cols (
xr.DataArray) – DataArray containing the model NO2 partial columns. It has to be previously regridded to satellite space.obsobj (
xr.Dataset) – Dataset containing all the observational data, including the variables related to the averaging kernel.averaging_kernel_params (
dict[str,str]) – dictionary containing the keys “averaging_kernel” and “tropospheric_averaging_kernel_calc” plus, optionally, “airmass_factor_total” and “airmass_factor_troposphere”.
- Returns:
xr.DataArray– DataArray containing the model columns after applying the averaging kernel.
- melodies_monet.util.sat_l2_swath_utility_tropomi.back_to_structured_grid(paired_object, target_grid, is_global=False)
Reformats the output dictionary to a structured grid.
- Parameters:
paired_object (
dict[str,xr.Dataset]) – Dictionary containing the same keys as the obs, and the model data in satellite space after applying the ak as valuestarget_grid (
xr.Dataset) – Dataset containing the target grid information.is_global (
bool) – Whether periodic=True should be applied to the data
- Returns:
xr.Dataset– Dataset containing the paired data in the structured grid.
- melodies_monet.util.sat_l2_swath_utility_tropomi.crop_obsobj(obsobj, modobj)
Subselects the observations depending on the model domain.
- Parameters:
obsobj (
xr.Dataset) – Dataset containing all the observational data.modobj (
xr.Dataset) – Model dataset, as read in by MELODIES-MONET.
- Returns:
xr.Dataset | None– Dataset with the observations outside the bounds discarded. If no observations are within the model domain, None is returned.
- melodies_monet.util.sat_l2_swath_utility_tropomi.interp_horizontal_mod2sat(obsobj, modobj, method='bilinear', is_global=False, **kwargs)
Interpolates model horizontally to satellite
- Parameters:
obsobj (
xr.Dataset) – xr.Dataset with a granule of the obsobj.modobj (
xr.Dataset) – Dataset with satellite data as formatted by monetio, already interpolated to correct time.method (
str) – Method of regridding, any method supported by xesmf should work.is_global (
bool) – Whether the model is global. If True, xe.Regridder will be set to periodic=True**kwargs – Extra arguments to pass to xe.Regridder
- Returns:
dict[np.datetime64,xr.Dataset]– Dictionary with model data in obsobj grid.
- melodies_monet.util.sat_l2_swath_utility_tropomi.interp_vertical_mod2swath(obsobj, modobj, variables='NO2_col')
Interpolates model vertical layers to TROPOMI vertical layers
- Parameters:
modobj (
xr.Dataset) – Model data (as provided by MONETIO)obsobj (
xr.Dataset) – TROPOMI data (as provided by the reader). Must include pressure.variables (
str | list[str]) – Variables to interpolate.
- Returns:
xr.Dataset– Model data (interpolated to TROPOMI vertical layers)
- melodies_monet.util.sat_l2_swath_utility_tropomi.regrid_and_apply_ak(obsobj_dict, modobj, start_time, end_time, mod_var='NO2', sat_var='nitrogendioxide_tropospheric_column', sat_type='tropomi_l2_no2', is_global=False)
Regrids and applies AK to multiple swaths.
- Parameters:
obsobj_dict (
dict[np.datetime64,xr.Dataset]) – Dictionary containing observationsmodobj (
xr.Dataset) – model dataset, as read in by MELODIES-MONET. Model should be already at overpass time
- Returns:
dict[str,xr.Dataset]– Dictionary containing the same keys as the obs, and the model data in satellite space after applying the ak as values
- melodies_monet.util.sat_l2_swath_utility_tropomi.select_swaths_overlapping_model(obsobj, modobj)
Selects the swaths overlapping with the model domain.
- Parameters:
obsobj (
dict[str,xr.Dataset]) – Dictionary containing observationsmodobj (
xr.Dataset) – Model dataset, as read in by MELODIES-MONET.
- Returns:
dict[np.datetime64,xr.Dataset]– Dictionary containing the same keys as the obs, and the observations within the model domain as values.
- melodies_monet.util.sat_l2_swath_utility_tropomi.tropomi_mol_m2_to_molec_cm2(column_data)
Converts column data from mol/m2 to molec/cm2
- Parameters:
column_data (
xr.DataArray) – DataArray containing the column data in mol/m2- Returns:
xr.DataArray– DataArray containing the column data in molec/cm2
- melodies_monet.util.sat_l2_swath_utility_tropomi.within_model_domain(obsobj, bounds)
Checks if any of the observations are within the model domain.
- Parameters:
obsobj (
xr.Dataset) – Dataset containing all the observational data.bounds (
list[float]) – List containing the bounds in the order [min_lon, max_lon, min_lat, max_lat].
- Returns:
bool– True if all observations are within the model domain, False otherwise.