sensortoolkit.reference._ref_api_query.query_periods
- query_periods(query_type=None, month_starts=[], month_ends=[])[source]
Generate a dictionary with consecutive monthly intervals to query where dates are formatted a little differently depending on the API to query.
API date formatting:
- AirNow API: Expects dates in format
'YYYY-MM-DDTHH'
Example:
'2019-08-01T00'
- AirNow API: Expects dates in format
- AQS API: Expects dates in format
'YYYYMMDD'
Example:
'20190801'
- AQS API: Expects dates in format
- Parameters
query_type (str) – The name of the API to query (either ‘AirNow’ or ‘AQS’).
month_starts (pandas datetimeindex) – An array of monthly start dates generated by Date_Range_Selector
month_ends (pandas datetimeindex) – An array of monthly end dates generated by Date_Range_Selector
- Returns
Dictionary with monthly beginning and end dates formatted to the scheme expected by the API to be queried.
- Return type
monthly_periods (dict)