Constructor
new Monitor(meta, data)
Constructs a new Monitor instance with 'meta' and 'data' tables.
Parameters:
| Name | Type | Description |
|---|---|---|
meta |
aq.Table | Metadata table with one row per deviceDeploymentID. |
data |
aq.Table | Time series data table with a |
- Source:
Methods
collapse(deviceID, FUN, FUN_argopt) → {Monitor}
Collapses data from all time series into a single time series using the
function provided in the FUN argument (typically 'mean'). The single time
series result will be located at the mean longitude and latitude.
When FUN = "quantile", the FUN_arg argument specifies the quantile
probability.
Available function names are those defined at:
https://uwdata.github.io/arquero/api/op#aggregate-functions with the
"op." removed.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
deviceID |
string | New deviceDeploymentID for the collapsed series. |
|
FUN |
string | Name of an aggregation function (e.g., "mean", "max"). |
|
FUN_arg |
any |
<optional> |
Optional argument to pass to FUN. |
- Source:
Returns:
New Monitor with a single time series.
- Type
- Monitor
combine(monitor) → {Monitor}
Combines this Monitor object with another, dropping duplicate deviceDeploymentIDs from the second monitor to avoid collisions.
Parameters:
| Name | Type | Description |
|---|---|---|
monitor |
Monitor | Another Monitor instance to combine with this one. |
- Source:
Returns:
New Monitor with combined time series.
- Type
- Monitor
count() → {number}
Returns the number of individual time series found in a Monitor object.
- Source:
Returns:
Number of metadata rows.
- Type
- number
createGeoJSON() → {Object}
Returns a GeoJSON FeatureCollection representing deployment locations.
- Source:
Returns:
GeoJSON FeatureCollection.
- Type
- Object
dropEmpty() → {Monitor}
Drops time series from the monitor that contain only missing values.
A value is considered missing if it is null, undefined, NaN, or an invalid string (e.g. 'NA'). The resulting monitor object includes only the deviceDeploymentIDs with at least one valid observation.
- Source:
Returns:
New Monitor with empty time series removed.
- Type
- Monitor
filterByValue(column, value) → {Monitor}
Filters time series based on matching values in the 'meta' dataframe. The returned Monitor object will contain only those records where monitor.meta.columnName === "value".
Parameters:
| Name | Type | Description |
|---|---|---|
column |
string | Name of the column used for filtering. |
value |
string | number | Value to match. |
- Source:
Returns:
New Monitor with filtered time series.
- Type
- Monitor
filterDatetime(startdate, enddate, timezoneopt) → {Monitor}
Filter time series to an explicit datetime range.
The returned Monitor object will contain only those records whose
datetime values fall within the requested range when interpreted in
the specified timezone.
Internally, startdate and enddate are interpreted in timezone
and compared against the UTC data.datetime column.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
startdate |
string | Date | Inclusive start of the time range, interpreted in |
|
enddate |
string | Date | Inclusive end of the time range, interpreted in |
|
timezone |
string |
<optional> |
IANA timezone (e.g. |
- Source:
Returns:
New Monitor with meta unchanged and data restricted to the specified range.
- Type
- Monitor
getCurrentStatus() → {aq.Table}
Augments and returns 'meta' with current status information derived from 'data'.
- Source:
Returns:
An enhanced version of monitor.meta.
- Type
- aq.Table
getDailyStats(id) → {Object}
Calculates daily statistics for the time series identified by id after the
time series has been trimmed to local-time day boundaries. The starting
hour of each local time day and statistics derived from that day's data
are returned in an object with datetime, count, min, mean and max
properties.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The deviceDeploymentID of the time series to select. |
- Source:
Returns:
Object with datetime, count, min, mean and max properties.
- Type
- Object
getDatetime() → {Array.<Date>}
Returns the array of date objects that define this Monitor object's time axis.
- Source:
Returns:
Array of Date objects.
- Type
- Array.<Date>
getDiurnalStats(id, dayCount) → {Object}
Calculates hour-of-day statistics for the time series identified by id after
the time series has been trimmed to local-time day boundaries. An array of
local time hours and hour-of-day statistics derived from recent data
are returned in an object with hour, count, min, mean and max
properties.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The deviceDeploymentID of the time series to select. |
dayCount |
number | Number of most recent days to use. |
- Source:
Returns:
Object with hour, count, min, mean and max properties.
- Type
- Object
getIDs() → {Array.<string>}
Returns an array of unique identifiers (deviceDeploymentIDs) found in a Monitor object.
- Source:
Returns:
Array of deviceDeploymentIDs.
- Type
- Array.<string>
getMetaObject(id) → {Object}
Returns all metadata properties for the time series identified by id.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | Array.<string> | The deviceDeploymentID. |
- Source:
Throws:
-
If id is not a valid single string or not found.
- Type
- Error
Returns:
Object with all metadata properties.
- Type
- Object
getMetadata(id, fieldName) → {string|number}
Returns the named metadata field for the time series identified by id.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | Array.<string> | The deviceDeploymentID. |
fieldName |
string | Name of the metadata field to retrieve. |
- Source:
Throws:
-
If id is not a valid single string or not found.
- Type
- Error
Returns:
The value of the metadata field.
- Type
- string | number
getNowcast(id) → {number}
Returns the NowCast PM2.5 value for the specified device.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The deviceDeploymentID of the time series to select. |
- Source:
Returns:
NowCast value.
- Type
- number
getPM25(id) → {Array.<number>}
Returns the PM2.5 time series for the specified device.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The deviceDeploymentID of the time series to select. |
- Source:
Throws:
-
If the device ID is not found.
- Type
- Error
Returns:
PM2.5 values.
- Type
- Array.<number>
getTimezone(id) → {string}
Returns the timezone for the specified device.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The deviceDeploymentID of the time series to select. |
- Source:
Returns:
Olson timezone.
- Type
- string
(async) loadAnnual(year, baseUrl) → {Promise.<Monitor>}
Asynchronously loads 'annual' Monitor objects from USFS AirFire repositories for 'airnow', 'airsis' or 'wrcc' data.
This function replaces the 'meta' and 'data' properties of 'this' monitor object with the latest available data. Data cover an entire year or year-to-date. Current year data are updated daily.
Parameters:
| Name | Type | Description |
|---|---|---|
year |
string | Year of interest. |
baseUrl |
string | Base URL for monitoring v2 data files. |
- Source:
Throws:
-
If there's an issue loading the data.
- Type
- Error
Returns:
A promise that resolves to a new Monitor instance with the loaded data.
- Type
- Promise.<Monitor>
(async) loadCustom(baseName, baseUrl, useAllColumns) → {Promise.<Monitor>}
Asynchronously loads custom monitoring data.
Two files will be loaded from
_data.csv _meta.csv
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
baseName |
string | File name base. |
|
baseUrl |
string | URL path under which data files are found. |
|
useAllColumns |
boolean | true | Whether to retain all available columns in the metadata. |
- Source:
Throws:
-
If there's an issue loading the data.
- Type
- Error
Returns:
A promise that resolves to a new Monitor instance with the loaded data.
- Type
- Promise.<Monitor>
(async) loadDaily(provider, baseUrl) → {Promise.<Monitor>}
Asynchronously loads 'daily' Monitor objects from USFS AirFire repositories for 'airnow', 'airsis' or 'wrcc' data.
This function replaces the 'meta' and 'data' properties of 'this' monitor object with the latest available data. Data cover the most recent 45 days and are updated once per day around 10:00 UTC (2am US Pacific Time).
Parameters:
| Name | Type | Description |
|---|---|---|
provider |
string | One of "airnow|airsis|wrcc". |
baseUrl |
string | Base URL for monitoring v2 data files. |
- Source:
Throws:
-
If there's an issue loading the data.
- Type
- Error
Returns:
A promise that resolves to a new Monitor instance with the loaded data.
- Type
- Promise.<Monitor>
(async) loadLatest(provider, baseUrl) → {Promise.<Monitor>}
Asynchronously loads 'latest' Monitor objects from USFS AirFire repositories for 'airnow', 'airsis' or 'wrcc' data.
This function replaces the 'meta' and 'data' properties of 'this' monitor object with the latest available data. Data cover the most recent 10 days and are updated every few minutes.
Parameters:
| Name | Type | Description |
|---|---|---|
provider |
string | One of "airnow|airsis|wrcc" |
baseUrl |
string | Base URL for monitoring v2 data files. |
- Source:
Throws:
-
If there's an issue loading the data.
- Type
- Error
Returns:
A promise that resolves to a new Monitor instance with the loaded data.
- Type
- Promise.<Monitor>
select(ids) → {Monitor}
Subset and reorder time series within the Monitor.
Parameters:
| Name | Type | Description |
|---|---|---|
ids |
string | Array.<string> | Single ID or array of IDs to select. |
- Source:
Returns:
New Monitor with selected/reordered time series.
- Type
- Monitor
trimDate(timezone) → {Monitor}
Returns a modified Monitor object with the records trimmed to full local time days. Any partial days are discarded.
Parameters:
| Name | Type | Description |
|---|---|---|
timezone |
string | Olson timezone identifier (e.g., "America/Los_Angeles"). |
- Source:
Returns:
New Monitor with data trimmed by timezone-aware ranges.
- Type
- Monitor