cmaqsatproc.readers.tropomi package

Module contents

class cmaqsatproc.readers.tropomi.S5P_L2__CH4___[source]

Bases: TropOMI

TropOMICH4 satellite processor. * bbox subsets the scanline dimensions * valid = qa_value >= threshold (default 0.75)

classmethod cmaq_process(qf, l3, key='CH4')[source]

Process CMAQ as though it were observed by TropOMI, which is simply based on the overpass time.

Parameters:
  • qf (xarray.Dataset) – CMAQ file that has composition (e.g., ECH4)

  • l3 (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

Returns:

overf – An overpass file with satellite-like CMAQ.

Return type:

xr.DataArray

Thin wrapper around satellite.cmr_links where concept_id is set to “C2087216530-GES_DISC”, which is the HiR v2 product. The HiR product started 2018-04-30.

Parameters:

method (str) – ‘opendap’, ‘download’, or ‘s3’.

Returns:

links – List of links for download or OpenDAP

Return type:

list

class cmaqsatproc.readers.tropomi.S5P_L2__CO____[source]

Bases: TropOMI

TropOMICO satellite processor. * bbox subsets the scanline dimensions * valid = qa_value >= threshold (default 0.75)

classmethod cmaq_process(qf, l3, key='CO')[source]

Process CMAQ as though it were observed by TropOMI, which is simply based on the overpass time.

Parameters:
  • qf (xarray.Dataset) – CMAQ file that has composition (e.g., CO)

  • l3 (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

Returns:

overf – An overpass file with satellite-like CMAQ.

Return type:

xr.DataArray

Thin wrapper around satellite.cmr_links where concept_id is set to “C2087132178-GES_DISC”, which is the HiR product v2. The HiR v2 product starts 2018-04-30.

Parameters:

method (str) – ‘opendap’, ‘download’, or ‘s3’.

Returns:

links – List of links for download or OpenDAP

Return type:

list

class cmaqsatproc.readers.tropomi.S5P_L2__HCHO__[source]

Bases: TropOMI

TropOMIHCHO satellite processor. * bbox subsets the scanline dimensions * valid = qa_value >= threshold (default 0.75)

classmethod cmaq_ak(overf, satl3f)[source]

Calculate an averaging kernel (AK) that would process CMAQ as though it were observed by the satellite. In this case, the averaging kernel is the scattering weights divided by the tropospheric air mass factor.

Parameters:
  • overf (xarray.Dataset) – Must have PRES variable with LAY dimension that describes the vertical coordinate.

  • satl3f (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

Returns:

q_ak – Averaging kernel on the CMAQ grid

Return type:

xr.DataArray

classmethod cmaq_amf(overf, satl3f, amfkey='formaldehyde_tropospheric_air_mass_factor', key='FORM_PER_M2')[source]

Calculate an alternative Air Mass Factor (AMF) using satellite scattering weights and the CMAQ vertical profile as a partial column density.

Parameters:
  • overf (xarray.Dataset) – Must have PRES variable with LAY dimension that describes the vertical coordinate.

  • satl3f (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

  • amfkey (str) – Key of the total air mass factor

  • key (str) – Key of the partial column density variable from CMAQ, which must have a LAY dimension that describes teh vertical coordinate.

Returns:

cmaqamf – Air Mass Factor on the CMAQ grid

Return type:

xr.DataArray

classmethod cmaq_process(qf, satl3f, key='FORM')[source]

Process CMAQ as though it were observed by OMI and recalculate TropOMI tropospheric columns with the CMAQ AMF. This process relies on cmaq_ak and cmaq_amf.

Parameters:
  • qf (xarray.Dataset) – CMAQ file that has composition (e.g., FORM), PRES, DENS, and ZF variables with a LAY dimension describing the vertical coordinate.

  • satl3f (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

  • key (str) – Composition key

Returns:

overf – An overpass file with satellite-like CMAQ and CMAQ-like satellite.

Return type:

xr.DataArray

classmethod cmaq_sw(overf, satl3f, amfkey='formaldehyde_tropospheric_air_mass_factor')[source]

Calculate scattering weights as averaging kernel multiplied by the total air mass factor. Then, interpolate to CMAQ vertical grid, based on PRES (pressure in Pa). The scattering weights are set to 0 above the tropopause.

Parameters:
  • overf (xarray.Dataset) – Must have PRES variable with LAY dimension that describes the vertical coordinate.

  • satl3f (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

  • amfkey (str) – Key for the total air mass factor.

Returns:

q_sw_trop – Tropospheric scattering Weights on the CMAQ grid

Return type:

xr.DataArray

Thin wrapper around satellite.cmr_links where concept_id is set to “C1918210023-GES_DISC”, which is the HiR v2 product. The HiR v2 product starts in 2018-05-07.

Parameters:

method (str) – ‘opendap’, ‘download’, or ‘s3’.

Returns:

links – List of links for download or OpenDAP

Return type:

list

class cmaqsatproc.readers.tropomi.S5P_L2__NO2___[source]

Bases: TropOMI

TropOMINO2 satellite processor. * bbox subsets the scanline dimensions * valid = qa_value >= threshold (default 0.75)

classmethod cmaq_ak(overf, satl3f, amfkey='air_mass_factor_total')[source]

Calculate an averaging kernel (AK) that would process CMAQ as though it were observed by the satellite. In this case, the averaging kernel is the scattering weights divided by the tropospheric air mass factor.

Parameters:
  • overf (xarray.Dataset) – Must have PRES variable with LAY dimension that describes the vertical coordinate.

  • satl3f (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

Returns:

q_ak – Averaging kernel on the CMAQ grid

Return type:

xr.DataArray

classmethod cmaq_amf(overf, satl3f, amfkey='air_mass_factor_total', key='NO2_PER_M2')[source]

Calculate an alternative Air Mass Factor (AMF) using satellite scattering weights and the CMAQ vertical profile as a partial column density.

Parameters:
  • overf (xarray.Dataset) – Must have PRES variable with LAY dimension that describes the vertical coordinate.

  • satl3f (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

  • amfkey (str) – Key of the total air mass factor

  • key (str) – Key of the partial column density variable from CMAQ, which must have a LAY dimension that describes teh vertical coordinate.

Returns:

cmaqamf – Air Mass Factor on the CMAQ grid

Return type:

xr.DataArray

classmethod cmaq_process(qf, satl3f, key='NO2')[source]

Process CMAQ as though it were observed by TropOMI and recalculate TropOMI tropospheric columns with the CMAQ AMF. This process relies on cmaq_ak and cmaq_amf.

Parameters:
  • qf (xarray.Dataset) – CMAQ file that has composition (e.g., NO2), PRES, DENS, and ZF variables with a LAY dimension describing the vertical coordinate.

  • satl3f (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

  • key (str) – Composition key

Returns:

overf – An overpass file with satellite-like CMAQ and CMAQ-like satellite.

Return type:

xr.DataArray

classmethod cmaq_sw(overf, satl3f, amfkey='air_mass_factor_total', tropopausekey='tm5_tropopause_layer_index')[source]

Calculate scattering weights as averaging kernel multiplied by the total air mass factor. Then, interpolate to CMAQ vertical grid, based on PRES (pressure in Pa). The scattering weights are set to 0 above the tropopause.

Parameters:
  • overf (xarray.Dataset) – Must have PRES variable with LAY dimension that describes the vertical coordinate.

  • satl3f (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

  • amfkey (str) – Key for the total air mass factor.

  • tropopausekey (str) – Key for the tropopause index.

Returns:

q_sw_trop – Tropospheric scattering Weights on the CMAQ grid

Return type:

xr.DataArray

Thin wrapper around satellite.cmr_links where concept_id is set to “C2089270961-GES_DISC”, which is the HiR v2 product. The HiR v2 product starts 2018-05-01.

Parameters:

method (str) – ‘opendap’, ‘download’, or ‘s3’.

Returns:

links – List of links for download or OpenDAP

Return type:

list

class cmaqsatproc.readers.tropomi.TropOMI[source]

Bases: satellite

Default TropOMI satellite processor. * bbox subsets the scanline dimensions

classmethod cmaq_amf(overf, satl3f, amfkey, key)[source]

Calculate an alternative Air Mass Factor (AMF) using satellite scattering weights and the CMAQ vertical profile as a partial column density.

Parameters:
  • overf (xarray.Dataset) – Must have PRES variable with LAY dimension that describes the vertical coordinate.

  • satl3f (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

  • amfkey (str) – Key of the total air mass factor

  • key (str) – Key of the partial column density variable from CMAQ, which must have a LAY dimension that describes teh vertical coordinate.

Returns:

cmaqamf – Air Mass Factor on the CMAQ grid

Return type:

xr.DataArray

classmethod cmaq_sw(overf, satl3f, amfkey, tropopausekey=None)[source]

Calculate scattering weights as averaging kernel multiplied by the total air mass factor. Then, interpolate to CMAQ vertical grid, based on PRES (pressure in Pa). The scattering weights are set to 0 above the tropopause.

Parameters:
  • overf (xarray.Dataset) – Must have PRES variable with LAY dimension that describes the vertical coordinate.

  • satl3f (xarray.Dataset) – Output from to_level3, paths_to_level3, or cmr_to_level3 with as_dataset=True (the default).

  • amfkey (str) – Key for the total air mass factor.

  • tropopauskey (str) – Key for the tropopause when available. Otherwise, use None.

Returns:

q_sw_trop – Tropospheric scattering Weights on the CMAQ grid

Return type:

xr.DataArray

classmethod open_dataset(path, bbox=None, isvalid=0.75, **kwargs)[source]
Parameters:
  • path (str) – Path to a TropOMI OpenDAP-style file

  • bbox (iterable) – swlon, swlat, nelon, nelat in decimal degrees East and North of 0, 0

  • isvalid (float) – Value of qa_value to use for valid pixels

  • kwargs (mappable) – Passed to xarray.open_dataset

Returns:

sat – Satellite processing instance

Return type:

TropOMI

classmethod prep_dataset(ds, bbox=None, isvalid=0.75, path=None)[source]

Defines pixels as valid when they are within bbox and interpolates latitude and longitude from pixel centers to corners.

Parameters:
  • ds (xarray.Dataset) – Satellite dataset

  • bbox (iterable) – swlon, swlat, nelon, nelat in decimal degrees East and North

  • isvalid (float) – When qa_value is greater than isvalid, the pixel is valid.

  • path (str) – Unused.

Returns:

ds

Return type:

xarray.Dataset

classmethod shorten_name(key)[source]

Provide a short name for long keys. This is useful for renaming variables to fit IOAPI 16 character restrictions.

Parameters:

key (str) – Original variable name.

Returns:

shortkey – Shortened key

Return type:

str