sensortoolkit.reference._ref_api_query.parse_sample_data

parse_sample_data(sample_data, get_monitor_info, param_list, **kwargs)[source]

Helper function for ingesting AQS 'sampleData' queries.

The parser searches for data matching the specified 'sample_duration' (default '1 HOUR'). Metadata columns are added to the passed dataset indicating site and reference monitor attributes.

Parameters
  • sample_data (pandas DataFrame) – Data returned by the AQS API for a query with type 'sampleData'.

  • get_monitor_info (bool) – If True, a secondary AQS query will be submitted for adding reference monitor and site metadata to the dataset returned by this method.

  • param_list (list) – A list of parameters for which the user wishes to query the AQS API.

Keyword Arguments:

Parameters
  • data_period (list) – List with two elements, the first is the start date and time for the query and the second is the end date and time for the query. The API is sequentially queried in monthly intervals, so the start date will usually be something like ‘20210101’ and the end date will follow as ‘20210131’.

  • aqs_id (dict) – The AQS site ID for the air monitoring site from which reference measurements will be returned by the API.

  • username (str) – AQS API username assigned to the user during API registration.

  • key (str) – User key for API authentication.

  • sample_duration (str) – The duration of recorded reference data the user wishes to retreive.

Returns

Modified API query dataset.

Return type

sample_data (pandas DataFrame)