Pre-processing#

The second component provides pre-processing of the data, which includes plume detection, conversion between coordinate systems, unit conversions, and estimation of the background field.

Plume detection algorithms#

The plume detection uses the function ddeq.dplume.detect_plumes for detecting plumes in the remote sensing image and ddeq.plume_coords.compute_plume_line_and_coords for computing the center curve and computing along- and across-plume coordinates.

ddeq.dplume.detect_plumes(data, sources, variable='NO2', variable_std='NO2_std', var_sys=0.0, filter_type='gaussian', filter_size=0.5, q=0.99, min_plume_size=0, background='median')#

Detects plumes inside remote sensing data and assigns them to given sources.

Parameters:
  • data (xr.Dataset) – Dataset of remote sensing data read, for example, by ddeq.smartcarb.read_level2

  • sources (xr.Dataset) – Dataset with source locations read, for example, by ddeq.misc.read_point_sources.

  • variable (str, optional) – Name of data array in data with the trace gas columns that is used for plume detection.

  • variable_str (str, optional) – Name of data array in data with the uncertainty of the trace gas columns.

  • var_sys (float, optional) – Systematic uncertainty of the trace gas field that is not reduced by spatial averaging. Standard values used in the SMARTCARB and CoCO2 project were (0.2 ppm)**2 for CO2 and (0.5e15 cm-2 = 8.3e-6 mol/m²)**2 for NO2.

  • filter_type (str, optional) – Name of filter used for computing the local mean can be “gaussian” (default), “uniform” or “neighborhood” (see ddeq.dplume.local_mean for details).

  • filter_size (number, optional) – Size of filter user for computing the locam mean in pixels. Needs to be an integer for “uniform” and “neighborhood”.

  • q (float, optional) – probability for threshold z(q) that a pixel is significantly enhanced above the background used for the statistical z-test.

  • min_plume_size (integer, optional) – Minimum size of connected pixels that are considered a plume (default: 0).

  • background (float or string, optional) – If number, the background used for the plume detection. The default value is “median”, which computes the background field using a median filter of 100 by 100 pixels.

Returns:

Returns data with added variables (e.g., detected_plumes) that contain the results from the plume detection algorithm.

Return type:

xr.Dataset

ddeq.plume_coords.compute_plume_line_and_coords(data, crs, radius=25000.0, do_coords=True, plume_area='area', reject_overlapping_sources=True)#

Compute plume center line and coordinates in the plume coordinate system using arc length (x-direction) and distance from center line (y-direction).

Parameters:
  • data (xr.Dataset) – Satellite data with detected plume for sources.

  • crs (cartopy.crs) – Coordinate reference system used for computing local easting and northing from longitude and latitude.

  • radius (float, optional) – Radius for an area around the detected plume that is included when fitting the center line used if plume_area == ‘area’). Default: 25e3 meters.

  • do_coords (boolean, optional) – If True compute the plume coordinates.

  • plume_area (str, optional) – if ‘area’ compute plume area using radius and pixel size if ‘hull’ compute plume area as convex hull of detected pixels

  • reject_overlapping_sources (boolean) – Don’t compute line and coords for plume detection overlapping several sources.

Returns:

data with added variables and dictionary of curves for each source by name.

Return type:

xr.Dataset, dict

Prepare data#

The data can be prepared for emission quantification with ddeq.emissions.prepare_data function, which estimates the background field (using ddeq.background.estimate), computes the local enhancement above the background (plume signal) and converts units to mass column densities (in kg m-2).

ddeq.emissions.prepare_data(data, gas='CO2')#

The functions prepares data for emission quantification with includes estimating the background field, computing the local enhancement above the background (plume signal) and converting units to mass column densities (in kg m-2).

Parameters:
  • data (xr.Dataset) – Remote sensing dataset with trace gas variable.

  • gas (str, optional) – Name of trace gas in in data.

Returns:

The dataset data with added background fields and variables with gas fields in mass column densities denoted with the “_mass” suffix.

Return type:

xr.Dataset

ddeq.background.estimate(data, variable, sigma=10.0, mask_hits=True, extra_dilation=None)#

Estimate smooth varible background using normalized convolution. Returns data with added dataarray ‘{variable}_estimated_background’.

Parameters:
  • data (xr.Dataset) – Remote sensing data containg variable as well as is_hit and plume_area.

  • variable (str) – Name of variable for background calculation.

  • sigma (number, optional) – Size of Gaussian kernel used for normalized convolution in pixels (default: 10 pixels).

  • mask_hits (boolean, optional) – If True, all significantly enhanced values found by the plume detection algoritm are masked otherwise only the plume area is masked.

  • extra_dilation (number, optional) – If not None add extra dilation of masked pixels using a disk with given radius given by extra_dilation.

Returns:

Remote sensing dataset with added estimated background field.

Return type:

xr.Dataset