Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Algorithms used in air quality data processing

License

NotificationsYou must be signed in to change notification settings

MazamaScience/air-monitor-algorithms

Repository files navigation

Algorithms for processing hourly time series data, with an initial focus onair quality monitoring applications.

This package supports theair-monitor ecosystem, whichworks with air quality monitoring data archives hosted by the US ForestService.

Note: All time series data are assumed to be on a regular hourly axiswith no gaps. Missing values should be represented asnull.

🚨 Important: All timestamp inputs must beLuxonDateTime objects in the UTC timezone.All timestamp outputs are also returned asDateTime objects in UTC.

Features

High-level analysis functions:

  • dailyStats(datetime, x, timezone)Returns local-time daily statistics (min, max, mean, count) from hourly data.

  • diurnalStats(datetime, x, timezone, dayCount)Returns local-time hourly averages from the most recentdayCount days.

  • pm_nowcast(pm)Calculates EPA-style NowCast values from hourly PM2.5 or PM10 data.

  • trimDate(datetime, x, timezone)Trims input to full local-time days (midnight to midnight).

Array utility functions:

  • arrayCount(x) — Count of non-missing (!= null) values
  • arraySum(x) — Sum of valid values
  • arrayMin(x) — Minimum valid value
  • arrayMean(x) — Mean of valid values
  • arrayMax(x) — Maximum valid value

Installation

To install the latest stable release fromnpm:

npm install air-monitor-algorithms

To install the latest development version directly from GitHub:

npm install github:MazamaScience/air-monitor-algorithms

Usage

This ES module can be used in modern JavaScript projects, including Svelteand Vue apps. You must use LuxonDateTime objects in UTC as input timestamps.

import {  dailyStats,  pm_nowcast} from "air-monitor-algorithms";import { DateTime } from "luxon";// Generate fake hourly data for 3 daysconst datetime = [];const x = [];const start = DateTime.fromISO("2023-07-01T00:00:00Z"); // UTCfor (let i = 0; i < 72; i++) {  datetime.push(start.plus({ hours: i }));       // UTC Luxon DateTime  x.push(50 + Math.sin(i / 3) * 10);             // sinusoidal variation}// Calculate daily statistics in the 'America/Los_Angeles' timezoneconst daily = dailyStats(datetime, x, "America/Los_Angeles");console.log(daily.mean); // → [meanDay1, meanDay2, meanDay3]// Apply NowCast to the hourly dataconst nowcast = pm_nowcast(x);console.log(nowcast.slice(-5)); // → last 5 hourly NowCast values

Related Packages

License

GPL-3.0-or-later© 2024–2025 Jonathan Callahan / USFS AirFire

About

Algorithms used in air quality data processing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp