Derivations during harp import product | S5P NO2

Dear Sander, dear all,

I seem to have hit a bit of a snag with deriving either altitude or pressure from the S5P NO2 datasets. I tried to derive during the import of the product,

try:
product = harp.import_product(infile,operations = ‘tropospheric_NO2_column_number_density_validity>75;point_distance(40.6335,22.9563,20[km]);\ derive(NO2_slant_column_number_density[Pmolec/cm2]);derive(NO2_slant_column_number_density_uncertainty[Pmolec/cm2]);\ derive(tropospheric_NO2_column_number_density[Pmolec/cm2]);derive(tropospheric_NO2_column_number_density_uncertainty[Pmolec/cm2]);
derive(pressure[Pa]);
keep(latitude, longitude, latitude_bounds,longitude_bounds,solar_zenith_angle,sensor_zenith_angle,scan_subindex,\ pressure_bounds,surface_pressure,surface_meridional_wind_velocity,surface_zonal_wind_velocity,
cloud_fraction,cloud_pressure, orbit_index,datetime_start,datetime_length,\ NO2_slant_column_number_density,NO2_slant_column_number_density_uncertainty,\ tropospheric_NO2_column_number_density_amf,tropospheric_NO2_column_number_density_avk,\ tropospheric_NO2_column_number_density,tropospheric_NO2_column_number_density_uncertainty,
tropospheric_NO2_column_number_density_validity,pressure)’)

But I get nothing in return, even though the pressure from pressure bounds is included in the relevant section as available, pressure derivations — HARP 1.17 documentation (stcorp.github.io)

Needless to say, I do get a product ingested when the pressure-related sections are not there in the ingest command.

To be honest, when I am interested is in the altitude [i.e. in m]. Altitude from pressure derivation exists, so I was thinking of a double-derivation, pressure bounds to pressure and pressure to altitude. The necessary fields exist in the S5P NO2 file, I think, altitude derivations — HARP 1.17 documentation (stcorp.github.io)

Am using Harp 1.16, on python 3.8

Many thanks as always,
MariLiza

Apologies, I of course tried,
derive(altitude {time, vertical} [m]);
derive(pressure {time, vertical} [Pa]);
:slight_smile:

Deriving pressure is possible, but deriving altitude not. You will need a total air molar mass and a temperature profile for this.

To allow deriving a pressure profile, you need to make sure that you don’t throw away the pressure_bounds variable.

You can use harpdump --list-derivations to see what derivations are possible.

For instance:

% harpdump --list-derivations -t altitude S5P_OFFL_L2__NO2____20190908T134839_20190908T153008_09863_01_010302_20190914T163328.nc
altitude {time} [m] (double) from
  sensor_altitude {time} [m] (double)

% harpdump --list-derivations -t pressure -a 'tropospheric_NO2_column_number_density_validity>75' S5P_OFFL_L2__NO2____20190908T134839_20190908T153008_09863_01_010302_20190914T163328.nc
pressure {time,vertical} [Pa] (double) from
  pressure_bounds {time,vertical,independent(2)} [Pa] (double)

% harpdump -a 'derive(pressure {time, vertical} [Pa]);keep(pressure)' S5P_OFFL_L2__NO2____20190908T134839_20190908T153008_09863_01_010302_20190914T163328.nc
dimensions:
    time = 1877400
    vertical = 34

attributes:
    source_product = "S5P_OFFL_L2__NO2____20190908T134839_20190908T153008_09863_01_010302_20190914T163328.nc"
    history = "2022-12-14T08:53:50Z [harp-1.17] harpdump -a 'derive(pressure {time, vertical} [Pa]);keep(pressure)' S5P_OFFL_L2__NO2____20190908T134839_20190908T153008_09863_01_010302_20190914T163328.nc"

variables:
    double pressure {time = 1877400, vertical = 34} [Pa]
1 Like

Indeed, I saw all the number_densities per species being ingested but didn’t notice that the total number density is not there in the file… let’s say that we can calculate it ad hoc, we would still need the appropriate temperature profile. Which we need in any case, also for the P-to-height conversion. Dear me, that one is tough.

Pressure is getting derived, indeed. Thanks!

I’ll think about it.

MariLiza

You would either need a total air number density profile or a temperature profile, because with the available pressure profile you can calculate one from the other.

1 Like

Yes, true, however for the next step, i.e. the z calculation we need the molar mass, which can be derived from the number density using the density, molar mass derivations — HARP 1.17 documentation (stcorp.github.io)

Are you suggested we use a generic density profile?

You could provide a total air density profile, but what is more commonly done is to provide information on the amount of H2O. The molar mass of dry air is considered fixed, so the only thing that is needed is to scale the dry air molar mass based on the amount of H2O that is in the air.