Documentation Index
Fetch the complete documentation index at: https://mintlify.com/NASAARSET/PM2.5_AQ_Online_2026/llms.txt
Use this file to discover all available pages before exploring further.
F_compute_metrics calculates a comprehensive suite of standard performance
metrics that quantify how well a satellite or model PM2.5 estimate agrees with
collocated ground-based measurements. Given a merged DataFrame containing both
measured and estimated values at the same locations and times, the function
returns a dictionary of scalar statistics — including bias, normalised bias,
RMSE, normalised RMSE, the coefficient of determination (R²), and both spatial
and temporal Pearson correlation coefficients — and optionally prints a
formatted summary to the notebook output.
Use this function as the final evaluation step of the ARSET PM2.5 validation
workflow, after merging the satellite product (from F_subset_and_combine)
with ground observations (from F_get_OpenAQ_from_API or
F_get_SINCA_from_web) into a single DataFrame. The returned dictionary can
also be stored and compared across products, regions, or time periods to
support the homework exercises.
Parameters
A
pandas.DataFrame containing both measured and estimated PM2.5 values.
The DataFrame must have a three-level MultiIndex corresponding to
latitude, longitude, and time (in that order). This is the native format
returned by F_get_OpenAQ_from_API and F_get_SINCA_from_web after a
merge with collocated satellite data.Name of the time index level in the three-level
(lat, lon, time)
MultiIndex. This is used to identify unique time steps for temporal
correlation and for grouping data by time period. The default
'time_month_start' matches the time index level name used in the
case-study data-processing workflow.Name of the column containing the measured (ground-truth) values.
Default is
'Average', which is the column name assigned to the averaged
OpenAQ or SINCA measurements in the merged DataFrame. Change to 'PM2.5'
if working directly with the raw observation DataFrame.Name of the column containing the estimated (satellite or model) values.
Default is
'SatPM'. Adjust this to match the variable name used when
merging the satellite dataset into the DataFrame (e.g., 'MERRA2_CNN').If
True, all computed metrics are printed to standard output in a
human-readable table. Set to False when calling the function in a loop
(e.g., iterating over multiple years or regions) to suppress verbose output.Return Value
A dictionary of computed metric values. Keys and their definitions:
| Key | Description |
|---|---|
'Estimated Mean' | Mean of the satellite/model estimates (µg/m³) |
'Measured Mean' | Mean of the ground observations (µg/m³) |
'Bias' | Mean difference: mean(estimate) − mean(observed) (µg/m³) |
'Mean Normalized Bias' | Bias normalised by the measured mean (dimensionless) |
'RMSE' | Root-mean-square error (µg/m³) |
'Mean Normalized RMSE' | RMSE normalised by the measured mean (dimensionless) |
'R²' | Coefficient of determination (overall fit) |
'Spatial Correlation (median)' | Median Pearson r across locations, computed per time step |
'Spatial Correlation (min)' | Minimum spatial Pearson r across all time steps |
'Spatial Correlation (max)' | Maximum spatial Pearson r across all time steps |
'Temporal Correlation (median)' | Median Pearson r across time, computed per location |
'Temporal Correlation (min)' | Minimum temporal Pearson r across all locations |
'Temporal Correlation (max)' | Maximum temporal Pearson r across all locations |
Usage Example
The following example follows the complete validation workflow for the Biobío case study: load satellite data, retrieve ground observations, merge them, then compute metrics.Comparing two satellite products
Three-level MultiIndex requirement. The
f_data DataFrame must have
exactly three index levels (latitude, longitude, time). If your DataFrame
was constructed differently, use df.set_index(['lat', 'lon', 'time'])
before calling this function.Spatial and temporal correlation statistics are reported as median, min, and
max rather than a single scalar in order to capture the variability of
correlations across locations (temporal) and time steps (spatial). A low
minimum alongside a high median indicates that performance degrades at
specific sites or seasons — a useful diagnostic for further investigation.
Related
- Performance Metrics Guide — theoretical background on each metric and recommended interpretation thresholds.
F_subset_and_combine— load and clip the satellite data that provides thes_estimatecolumn.F_get_OpenAQ_from_API— retrieve the ground observations that provide thes_valuecolumn.F_get_SINCA_from_web— alternative ground-observation source for Chilean monitors.F_plot_map— visualise the spatial distribution of bias or RMSE by plotting per-site metrics as point data.
