Methods
arrayCount(x) → {number}
Return the count of valid values an array, ignoring any non-numeric values
such as NaN
or null
.
Parameters:
Name | Type | Description |
---|---|---|
x |
Array.<number> | Array of values. |
Returns:
Count of numeric values.
- Type
- number
arrayMax(x) → {number|null}
Return the maximum value in an array, ignoring any non-numeric values such as
NaN
or null
. If all values are non-numeric, null
is returned.
Parameters:
Name | Type | Description |
---|---|---|
x |
Array.<number> | Array of values. |
Returns:
Maximum numeric value or null.
- Type
- number | null
arrayMean(x) → {number|null}
Return the mean of an array, ignoring any non-numeric values such as
NaN
or null
. If all values are non-numeric, null
is returned.
Parameters:
Name | Type | Description |
---|---|---|
x |
Array.<number> | Array of values. |
Returns:
Mean of numeric values or null.
- Type
- number | null
arrayMin(x) → {number|null}
Return the minimum value in an array, ignoring any non-numeric values such as
NaN
or null
. If all values are non-numeric, null
is returned.
Parameters:
Name | Type | Description |
---|---|---|
x |
Array.<number> | Array of values. |
Returns:
Minimum numeric value or null.
- Type
- number | null
arraySum(x) → {number|null}
Return the sum of an array, ignoring any non-numeric values such as
NaN
or null
. If all values are non-numeric, null
is returned.
Parameters:
Name | Type | Description |
---|---|---|
x |
Array.<number> | Array of values. |
Returns:
Sum of numeric values or null.
- Type
- number | null
dailyStats(datetime, x, timezone) → {object}
Calculates daily statistics for the time series specified by datetime
and x
.
The returned object contains five properties:
- datetime -- Array of date objects specifying the starting hour of each day.
- count -- Array of daily counts of non-missing values.
- min -- Array of daily minimum values.
- mean -- Array of daily mean values.
- max -- Array of daily maximum values.
Parameters:
Name | Type | Description |
---|---|---|
datetime |
Array.<Date> | Regular hourly axis (no missing hours) representing the time associated with each measurement. |
x |
Array.<number> | Array of hourly measurements. |
timezone |
string | Olson time zone to use as "local time". |
- Source:
Returns:
An object with datetime
, count
, min
, mean
and max
properties.
- Type
- object
diurnalStats(datetime, x, timezone, dayCount) → {object}
Calculates diurnal averages for the time series specified by datetime
and x
.
The returned object contains two properties:
- hour -- Array of local time hours [0-24].
- count -- Array of hour-of-day counts of non-missing values.
- min -- Array of hour-of-day minimum values.
- mean -- Array of hour-of-day mean values.
- max -- Array of hour-of-day maximum values
By default, statistics are calculated using data from the most recent 7 days
in the datetime
array.
Parameters:
Name | Type | Description |
---|---|---|
datetime |
Array.<Date> | Regular hourly axis (no missing hours) representing the time associated with each measurement. |
x |
Array.<number> | Array of hourly measurements. |
timezone |
string | Olson time zone to use as "local time". |
dayCount |
number | Number of most recent days to use. |
- Source:
Returns:
Object with hour
, count
, min
, mean
and max
properties.
- Type
- object
pm_nowcast(pm) → {Array.<number>}
Returns an array of NowCast values derived from the incoming time series.
NOTE: Incoming data must be on an hourly axis with no gaps. Missing values should be represented by 'null'.
Parameters:
Name | Type | Description |
---|---|---|
pm |
Array.<number> | Array of hourly PM2.5 or PM10 measurements. |
- Source:
Returns:
Array of NowCast values.
- Type
- Array.<number>
roundAndUseNull(x, digits) → {Array.<number>}
Convert an array of values to an array rounded to digits
decimal places
and using null
as the default missing value. Missing values are
any members of x
with values of undefined
, NaN
or null
.
Parameters:
Name | Type | Description |
---|---|---|
x |
Array.<number> | Array of values. |
digits |
number | Number of digits to retain after the decimal point. |
Returns:
Array of values.
- Type
- Array.<number>
trimDate(datetime, x, timezone) → {object}
Returns an object trimmed to full local time days. Any partial days are discarded. The returned object contains two properties:
- datetime -- the original datetime array trimmed to full days
- x -- the original x array trimmed to full days
Parameters:
Name | Type | Description |
---|---|---|
datetime |
Array.<Date> | Regular hourly axis representing the time associated with each measurement. |
x |
Array.<number> | Array of hourly measurements. |
timezone |
string | Olson time zone to use as "local time". |
- Source:
Returns:
Object with datetime
and x
properties.
- Type
- object
useNull(x) → {Array.<number>}
Convert an array of values to an array where all values of undefined
or
NaN
have been replaced by null
.
Parameters:
Name | Type | Description |
---|---|---|
x |
Array.<number> | Array of values. |
Returns:
Array of values.
- Type
- Array.<number>