tropomi_ut_no2

Process and apply the cloud-slicing approach to partial columns of NO2 from S5P/TROPOMI for June 2019 to May 2020.

The default is to obtain seasonal means at 1x1 for partial columns above clouds with cloud fraction >=0.7 and within the cloud top pressure range of 450-180 hPa.

Options are available to use cloud information from either the FRESCO-S or ROCINN-CAL cloud product, to obtain seasonal means at 2x2.5 or 4x5, and to use a cloud fraction threshold of 0.8, 0.9, or 1.0.

usage:
       [-h] [--trop_dir TROP_DIR] [--out_dir OUT_DIR] [--season SEASON]
       [--start_date START_DATE] [--end_date END_DATE] [--grid_res GRID_RES]
       [--cloud_product CLOUD_PRODUCT] [--cloud_threshold CLOUD_THRESHOLD]
       [--pmin PMIN] [--pmax PMAX]

optional arguments:
  -h, --help            show this help message and exit
  --trop_dir TROP_DIR   Directory containing tropomi data
  --out_dir OUT_DIR     Directory to contain finished netcdf4
  --season SEASON       Can be jja, son, djf, mam
  --start_date START_DATE
                        Start date of processing window (yyyy-mm-dd)
  --end_date END_DATE   End date of processing window (yyyy-mm-dd)
  --grid_res GRID_RES   Can be 1x1, 2x25, 4x5
  --cloud_product CLOUD_PRODUCT
                        can be fresco or dlr-ocra
  --cloud_threshold CLOUD_THRESHOLD
                        recommended value is 07. Can also test 08, 09, 10
  --pmin PMIN           Lower bound on cloud height. Defaults to 180.
  --pmax PMAX           Upper bound on cloud height. Defaults to 450.
exception uptrop.tropomi_ut_no2.CloudFileDateMismatch
exception uptrop.tropomi_ut_no2.UnequalColumnException
class uptrop.tropomi_ut_no2.CloudData(file_path, data_type)

Class for containing the data for cloud filtering and analysis.

__init__(file_path, data_type)

Reads either the tropomi file (if data_type = ‘fresco’) or the ocra file (if data_type = ‘dlr-ocra’) at file_path and returns an instance of CloudData. Calls either read_fresco_file or read_ocra_file.

Parameters
  • file_path (str) – Path to the file containing cloud_data

  • data_type (str) – Can be ‘fresco’ or ‘dlr-ocra’

read_fresco_file(file_path)

Reads and filters the fresco data in a s5p file

Pixels are dropped if
  • they have type 255 (ocean)

  • they have type 252 (coastline; ATBD treats as ‘suspect’)

  • they have less thant 1% cover

  • there is a potential misclassification of snow/ice as cloud

Parameters

file_path (str) – The path to the fresco file

read_ocra_file(file_path)

Reads, filters and preprocesses the data in a dlr-ocra file.

uptrop.height_pressure_converter is called to convert ocra cloud-top heights to pressure values for cross-compatability with fresco data.

Pixels are dropped if
  • They are over snow/ice scenes

  • They have quality less than 0.5

Parameters

file_path (str) – The path to the ocra data

class uptrop.tropomi_ut_no2.GridAggregator(dellat, dellon)

A class for aggregating higher-resolution data into grid squares

__init__(dellat, dellon)

Creates a grid aggregator across the entire world of resolution dellon, dellat

Parameters
  • dellat (float) – vertical size of the aggregation grid in decimal degrees

  • dellon (float) – Horizontal size of the aggregation grid in decimal degrees

Returns

A GridAggregator object

Return type

GridAggregator

add_slice(i, j, t_cld, t_col_no2)

Extracts the upper troposphere gc_data, gc_data error and mean cloud pressure for grid square [i,j]

This method uses the cloud-slicing function uptrop.cloud_slice_ut_no2.cldslice Once calculated, the a weighting is derived from cloud pressure. The weighted upper tropospheric gc_data and error is added to the rolling total for this season. If the cloud slicing fails, then the reason is added to loss_count for the end report.

Parameters
  • i (int) – X-index of grid square

  • j (int) – Y-index of grid square

  • t_cld (list of floats) – A list of cloud pressures

  • t_col_no2 (list of floats) – A list of gc_data values, of same length as t_cld

apply_cloud_slice(n_slices=40)

Applies the cloud slicing algorithm to each square in the populated grid.

This method walks over every gridsquare in gno2/gstrat/gcldp. After sanity checks and conversion to hPa, that pixel’s data is split into [len(pixel)/n_slices] subsets, each of n_slices length. The split is alternating, so in the cast of three subsets pixel_data[0] goes to subset 0, pixel_data[1] to subset 1, pixel_data[2] to subset 2, pixel_data[3] to subset 0, pixel_data[4] to subset 1 and so on. Each subset then has apply_slice applied to it. If a pixel has less than 100 data points in it, subsetting is skipped and apply_slice is run on the pixel’s entire dataset.

Parameters

n_slices (int) – The number of pixels to apply to each subset

calc_seasonal_means()

Calculates the mean no2 mixing ratio using Gaussian weights or counts. This is to be applied at the end of processing to get the final data that will be saved and plotted.

grid_trop_data(trop_data)

Allocates the strat, gc_data and cloud pressure in trop_data into the gno2, gstrat and gcldp grid

Parameters

trop_data (uptrop.tropomi_ut.gc_data.TropomiData) – an instance of TropomiData

initalise_grid()

Zeros the gno2, gstrat, gcldp and cntloop members with empty appendable lists

plot_data()

Plots the seasonal_means to screen.

print_report()

Prints a report of useful data and reasons for data loss.

save_to_netcdf(out_file)

Saves the seasonal_means to out_file as a netcdf4

Call after calling calc_seasonal_means at least once.

Parameters

out_file (str) – Location to save the netcdf4.

class uptrop.tropomi_ut_no2.TropomiData(file_path)

A class for extracting, preprocessing and containing data from a s5p tropomi file.

__init__(file_path)

Reads the tropomi file at file_path and prepares it for processing.

Parameters

file_path (str) – Path to the netcdf4 file containing the tropomi data

calc_geo_column()

Calculates the geometric AMF and tropospheric vertical column of this data. Includes application of a bias correction to the stratospheric and tropospheric columns. These are obtaind from comparing TROPOMI to Pandora surface observations.

The correction addresses an underestimate in TROPOMI stratospheric NO2 variance and a factor of 2 overestimate in TROPOMI tropospheric NO2.

cloud_filter_and_preprocess(cloud_data, cldthld, pmax, pmin)

Filters this tropomi data using the cloud information in cloud_data

Removes data where
  • There is no cloud data

  • The fraction of cloud is less than the specified cloud threshold

  • Cloud heights are not in the range pmin-pmax

  • Quality value is greater than 0.45

Parameters
  • cloud_data (uptrop.tropomi_ut_no2.CloudData) – Instance of CloudData

  • cldthld (float) – The cloud fraction threshold to be used

  • pmax (float) – The maximum cloud height to be used in processing

  • pmin (float) – The minimum cloud height to be used in processing

read_trop_file(file_path)

Reads the data at file_path into this object. Called by the constructor.

Parameters

file_path (str) – Path to the netcdf4 file containing the tropomi data