Skip to content

omnilab/swpc API reference

Floor
Provider · Omnilab
Version
1.x
Conformance suite
not wired
Verified for real
Its README does not say
Licence
MIT
composer require omnilab/swpc:1.x-dev

Read from the package's own PHP files at the commit 4be949028883: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Omnilab\Swpc

  • Alert class

    A message of the Space Weather Prediction Center: an alert, a warning, a watch or a summary, as issued.

    1 method · 7 properties

  • SwpcSource class

    NOAA's Space Weather Prediction Center, through its public JSON files (services.swpc.noaa.gov): the probability of seeing an aurora overhead at a point (OVATION's nowcast) as a series - the one thing of space weather that is at a place on the Earth - and, outside the contract (a core Series is at a place), the planetary Kp index observed and predicted, the solar wind at L1 (speed, density, temperature, the magnetic field's strength and Bz), the alerts, warnings and watches, and the NOAA scales of today.

    8 methods · 2 constants

  • SwpcSourceFactory class

    NOAA's Space Weather Prediction Center: the aurora at a point as a series; the Kp index, the solar wind, the alerts and the scales outside the contract - no key.

    2 options

  • Timeline class

    A variable of space weather over time - the planetary Kp index, the solar wind's speed at L1 - which the core's Series cannot hold, a Series being at a place on the Earth. Points in time order, a value null where none; $forecastFrom is the first predicted point's time (null when every point is observed or estimated).

    7 methods · 6 properties

Omnilab\Swpc

Alert class

final readonly class Alert Alert.php:9

A message of the Space Weather Prediction Center: an alert, a warning, a watch or a summary, as issued.

public string $product

the product id of the list (K04W, XM5S...)

public \DateTimeImmutable $issued
public ?string $code

the message's code (WARK04, SUMXM5...)

public ?int $serial
public ?string $kind

ALERT, WARNING, WATCH, SUMMARY, EXTENDED WARNING, CANCEL WATCH...

public ?string $title

its first line after the issue time: "WARNING: Geomagnetic K-index of 4 expected"

public string $message

Alert::__construct()

public function __construct(public string $product, public \DateTimeImmutable $issued, public ?string $code, public ?int $serial, public ?string $kind, public ?string $title, public string $message)
$product

the product id of the list (K04W, XM5S...)

$code

the message's code (WARK04, SUMXM5...)

$kind

ALERT, WARNING, WATCH, SUMMARY, EXTENDED WARNING, CANCEL WATCH...

$title

its first line after the issue time: "WARNING: Geomagnetic K-index of 4 expected"

SwpcSource class

final class SwpcSource extends HttpSource SwpcSource.php:27

NOAA's Space Weather Prediction Center, through its public JSON files (services.swpc.noaa.gov): the probability of seeing an aurora overhead at a point (OVATION's nowcast) as a series - the one thing of space weather that is at a place on the Earth - and, outside the contract (a core Series is at a place), the planetary Kp index observed and predicted, the solar wind at L1 (speed, density, temperature, the magnetic field's strength and Bz), the alerts, warnings and watches, and the NOAA scales of today.

No key. Each file is the service's latest: the Kp index of the last seven days and the next three, a day of solar wind, the alerts of about two weeks, the last aurora nowcast.

const BASE_URI = 'https://services.swpc.noaa.gov/'
const SOLAR_WIND = ['speed' => ['json/rtsw/rtsw_wind_1m.json', 'proton_speed', 'km/s', 'Solar wind speed'], 'density' => ['json/rtsw/rtsw_wind_1m.json', 'proton_density', 'cm⁻³…

The solar wind's variables: the file, its field, the unit, the label.

SwpcSource::__construct()

public function __construct(HttpClientInterface $http, string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 0.0)

SwpcSource::getName()

public function getName(): string

SwpcSource::capabilities()

public function capabilities(): array

SwpcSource::series()

public function series(SeriesQuery $query): array

"aurora": the probability, in percent, of an aurora seen overhead at the point, from OVATION's latest nowcast (one point, at its forecast time, about half an hour to an hour ahead; the nearest cell of its one-degree grid). Only the latest is published: a period that does not hold its time answers a series without points.

SwpcSource::kp()

public function kp(): Timeline

The planetary Kp index, every three hours, from seven days back to three days ahead: the observed and estimated values, then the predicted ones (from forecastFrom). Outside the contract: the Kp index is the whole Earth's.

SwpcSource::solarWind()

public function solarWind(string ...$variables): array

The solar wind at L1, minute by minute over the last day, from the spacecraft SWPC uses at the time (its "active" rows): one Timeline per variable asked (SOLAR_WIND: speed, density, temperature, bt, bz).

Outside the contract: the solar wind is not at a place on the Earth.

SwpcSource::alerts()

public function alerts(): array

The alerts, warnings, watches and summaries SWPC issued, the latest first.

SwpcSource::scales()

public function scales(): array

The NOAA space weather scales - R (radio blackouts), S (solar radiation storms), G (geomagnetic storms), each 0 to 5 - as SWPC's file gives them, in its order: the day before and the latest observed (their scales), then today and the next two days (the probabilities of R minor and major and of S, in percent, and the G scale predicted). A row: [time, R, S, G, R minor %, R major %, S %].

SwpcSourceFactory class

final class SwpcSourceFactory extends SourceFactory SwpcSourceFactory.php:20

NOAA's Space Weather Prediction Center: the aurora at a point as a series; the Kp index, the solar wind, the alerts and the scales outside the contract - no key.

options: mailto: 'support@glitchr.io' # in the User-Agent throttle: 0 # seconds between two calls: SWPC publishes no figure base_uri: 'https://services.swpc.noaa.gov/'

Options

OptionDefault
throttle0.0
base_uriSwpcSource::BASE_URI

Timeline class

final readonly class Timeline implements IteratorAggregate, Countable Timeline.php:14

A variable of space weather over time - the planetary Kp index, the solar wind's speed at L1 - which the core's Series cannot hold, a Series being at a place on the Earth. Points in time order, a value null where none; $forecastFrom is the first predicted point's time (null when every point is observed or estimated).

public string $variable
public ?string $unit
public array $points
public ?string $label
public ?\DateTimeImmutable $forecastFrom
public string $source

Timeline::__construct()

public function __construct(public string $variable, public ?string $unit, public array $points, public ?string $label = null, public ?\DateTimeImmutable $forecastFrom = null, public string $source = 'swpc')

Timeline::values()

public function values(): array

Timeline::times()

public function times(): array

Timeline::max()

public function max(): int|float|null

Timeline::min()

public function min(): int|float|null

Timeline::getIterator()

public function getIterator(): \ArrayIterator

Timeline::count()

public function count(): int