Skip to content

sample_concentration

Bruno Beloff edited this page Apr 9, 2024 · 15 revisions

docs > software repositories > scs_analysis > commands > filtering and aggregating data


DESCRIPTION

The sample_concentration utility is used to inject a gas concentration value, based on a given density (micrograms per cubic metre), temperature and pressure (kPa). The reported value is in parts per billion.

Density and temperature must be supplied from the input JSON document. Atmospheric pressure may be supplied from the input JSON document. Alternatively, a pressure estimate may be supplied on the command line. In both cases, pressure should be indicated in kilopascals (kPa). If no pressure value is supplied, the standard pressure of 101.3 kPa is used.

Recognised gases are:

Gas Molar mass
CO2 44.0100
NO 30.0100
NO2 46.0055
O3 48.0000
SO2 64.0660

The path for the node in the output document indicating concentration is based on the path for the node in the input document indicating density. For example, if the input path is SUB-PATH.dns, the output path is SUB-PATH.cnc. If a SUB-PATH.cnc field exists in the input document, it is overwritten.

SYNOPSIS

sample_concentration.py [-v] GAS DENSITY_PATH T_PATH [{P_PATH | -p PRESSURE}]

Options
--version show program's version number and exit
-h, --help show this help message and exit
-p PRESSURE, --pressure=PRESSURE assume constant atmospheric pressure in kPA (default 101.3)
-v, --verbose report narrative to stderr

EXAMPLES

csv_reader.py joined_2019-02.csv | sample_concentration.py -v NO2 ref.val.NO2.dns praxis.val.sht.tmp

DOCUMENT EXAMPLE - INPUT

{"rec": "2019-02-12T13:00:00Z", "praxis": {"val": {"NO2": {"weV": 0.300059, "cnc": 23.4, "aeV": 0.302339, "weC": -0.002793}, "sht": {"hmd": 67.6, "tmp": 13.1}}}, "ref": {"val": {"NO2": {"units": "ugm-3", "dns": 51}}}}

DOCUMENT EXAMPLE - OUTPUT

{"rec": "2019-02-12T13:00:00Z", "praxis": {"val": {"NO2": {"weV": 0.300059, "cnc": 23.4, "aeV": 0.302339, "weC": -0.002793}, "sht": {"hmd": 67.6, "tmp": 13.1}}}, "ref": {"val": {"NO2": {"units": "ugm-3", "dns": 51, "cnc": 26.0}}}}

RESOURCES

Data formats

scs_core/src/scs_core/gas/gas.py
http://www.apis.ac.uk/unit-conversion