Atmospheric Toolbox

Extracting S5p SO2 variables

I would like to extract variables from the Sentinel 5p SO2 product using HARP. The variables are listed in different locations: under PRODUCT, under PRODUCT/SUPPORT_DATA/DETAILED_RESULTS, etc.

I’ve used the following code unsuccessfully:

harpconvert -a ‘latitude > 1 [degree_north]; latitude < 7 [degree_north]; longitude > 92 [degree_east]; longitude < 98 [degree_east];bin_spatial(333,1,0.02,333,93,0.02); derive(latitude {latitude}); derive(longitude {longitude}); keep(PRODUCT/sulfurdioxide_total_vertical_column, PRODUCT/sulfurdioxide_total_vertical_column_precision, PRODUCT/qa_value, PRODUCT/SUPPORT_DATA/INPUT_DATA/surface_classification, PRODUCT/SUPPORT_DATA/DETAILED_RESULTS/sulfurdioxide_total_vertical_column_15km,PRODUCT/SUPPORT_DATA/DETAILED_RESULTS/sulfurdioxide_total_vertical_column_15km_precision, PRODUCT/SUPPORT_DATA/DETAILED_RESULTS/sulfurdioxide_total_vertical_column_1km, PRODUCT/SUPPORT_DATA/DETAILED_RESULTS/sulfurdioxide_total_vertical_column_1km_precision, PRODUCT/SUPPORT_DATA/DETAILED_RESULTS/sulfurdioxide_total_vertical_column_7km, PRODUCT/SUPPORT_DATA/DETAILED_RESULTS/sulfurdioxide_total_vertical_column_7km_precision, PRODUCT/SUPPORT_DATA/INPUT_DATA/aerosol_index_340_380,PRODUCT/SUPPORT_DATA/INPUT_DATA/PROCESSOR/surface_classification,PRODUCT/longitude, PRODUCT/latitude)’

Using just the names of the variables in the keep syntax (e.g. qa_value instead of PRODUCT/qa_value) also doesn’t work. If I use only the first part of the code, excluding the keep part, the code works, but the result does not contain all the variables of the initial netcdf file.

Could anyone advise?

Thank you very much,


Please have a look at About the HARP category - #15 by svniemeijer
The mapping description for SO2 is provided here.

Thank you very much, the mapping link was very helpful!

For other users, the following line worked:
harpconvert -o so2_column=1km -a ‘SO2_column_number_density_validity>50;keep(SO2_column_number_density, absorbing_aerosol_index, surface_albedo, surface_altitude, latitude, longitude); latitude >= 0 [degree_north]; latitude <= 8 [degree_north]; longitude >= 92 [degree_east]; longitude <= 100 [degree_east];derive(SO2_column_number_density [DU]); bin_spatial(444,0,0.02,444,92,0.02); derive(latitude {latitude}); derive(longitude {longitude}); exclude(latitude_bounds_weight,longitude_bounds_weight,count,weight)’

Just a clarification: It wasn’t possible to derive SO2_column_number_density_validity, SO2_column_number_density_uncertainty_random . I tried to derive them simultaneously, as in the line below, as well as for each one of them separately. I also experimented with different sequence of operations. The variables were still not included in the output nc.
harpconvert -o so2_column=1km -a ‘keep(SO2_column_number_density,SO2_column_number_density_validity, SO2_column_number_density_uncertainty_random, absorbing_aerosol_index, surface_albedo, surface_altitude, latitude, longitude); latitude > 1 [degree_north]; latitude < 7 [degree_north]; longitude > 92 [degree_east]; longitude < 98 [degree_east];derive(SO2_column_number_density [DU]); derive(SO2_column_number_density_validity);derive(SO2_column_number_density_uncertainty_random);bin_spatial(333,1,0.02,333,93,0.02); derive(latitude {latitude}); derive(longitude {longitude})’

Why would this be the case? The processor is new and the options are set correctly, do you think there could be an issue with binning? or the units?

Thanks again,


The case for validity was also answered here. You can’t average validity flags.

For the uncertainty, HARP only propagates the total uncertainty (the variable without _random or _systematic postfix). So you would first have to perform a derive(SO2_column_number_density_uncertainty {time}) and then perform your binning.

Top, thank you very much!!