Skip to content

omnilab/tides API reference

Floor
Provider · Omnilab
Version
1.x
Conformance suite
not wired
Verified for real
Verified in part
Licence
MIT
composer require omnilab/tides:1.x-dev

Read from the package's own PHP files at the commit cdc0207d7e62: 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\Tides

  • TidesSource class

    NOAA's tides and water levels, from the Center for Operational Oceanographic Products and Services (CO-OPS, Tides and Currents): the water level observed at a station every six minutes, the verified hourly heights and highs and lows, the tide predictions (every six minutes, hourly, or the highs and lows), the water and air temperature, through its Data API (api.tidesandcurrents.noaa.gov/api/prod/datagetter); a station itself through its Metadata API.

    5 methods · 3 constants

  • TidesSourceFactory class

    NOAA CO-OPS (Tides and Currents): a station's water levels, tide predictions and water temperature as series, the station itself - no key.

    6 options

Omnilab\Tides

TidesSource class

final class TidesSource extends HttpSource TidesSource.php:32

NOAA's tides and water levels, from the Center for Operational Oceanographic Products and Services (CO-OPS, Tides and Currents): the water level observed at a station every six minutes, the verified hourly heights and highs and lows, the tide predictions (every six minutes, hourly, or the highs and lows), the water and air temperature, through its Data API (api.tidesandcurrents.noaa.gov/api/prod/datagetter); a station itself through its Metadata API.

No key. The API asks its callers to space their calls: half a second between two by default. A request is cut to the API's length limits (a month of six-minute values, a year of hourly ones or of highs and lows).

const DATA_URI = 'https://api.tidesandcurrents.noaa.gov/api/prod/datagetter'
const METADATA_URI = 'https://api.tidesandcurrents.noaa.gov/mdapi/prod/webapi/'
const VARIABLES = ['water_level' => ['water_level', null, 'm', 31, false, false], 'hourly_height' => ['hourly_height', null, 'm', 365, false, false], 'high_low' => ['high_low'…

The variables series() serves: the API's product, its interval, its unit in metric, the days a request may cover, whether a prediction, whether its points are irregular (highs and lows).

TidesSource::__construct()

public function __construct(HttpClientInterface $http, readonly string $datum = 'MLLW', readonly float $radius = 50.0, readonly string $application = 'omnilab', readonly string $metadataUri = self::METADATA_URI, string $baseUri = self::DATA_URI, array $headers = [], float $throttle = 0.5)
$datum

the datum of the water levels: MLLW (the charts'), MSL, MHHW, NAVD, STND...

$radius

how far from a Point the nearest station is looked for, in kilometres

TidesSource::getName()

public function getName(): string

TidesSource::capabilities()

public function capabilities(): array

TidesSource::entity()

public function entity(Identifier|string $id): ?Entity

A station (coops.station:8518750, coops:8518750, its page): its name, place, state, time zone, tide type. One call; null when unknown.

TidesSource::series()

public function series(SeriesQuery $query): array

The series of a station named (coops.station) or of the nearest water level station of a Point, one per variable asked (VARIABLES), in UTC: the six-minute products on the step's grid (the value at each step's start, or the step's MAX, MIN, MEAN or SUM; PT6M gives them all), the hourly ones likewise, the highs and lows as they come (irregular). The period defaults to today; a date without a time is the whole day, in the query's time zone (UTC by default). A product the station does not have: a series without points.

TidesSourceFactory class

final class TidesSourceFactory extends SourceFactory TidesSourceFactory.php:23

NOAA CO-OPS (Tides and Currents): a station's water levels, tide predictions and water temperature as series, the station itself - no key.

options: mailto: 'support@glitchr.io' # in the User-Agent datum: MLLW # the water levels' datum: MLLW, MSL, MHHW, MLW, NAVD, STND... radius_km: 50 # how far from a Point the nearest station is looked for application: omnilab # the name the API logs the calls under throttle: 0.5 # seconds between two calls: the API asks its callers to space them base_uri: 'https://api.tidesandcurrents.noaa.gov/api/prod/datagetter' metadata_uri: 'https://api.tidesandcurrents.noaa.gov/mdapi/prod/webapi/'

Options

OptionDefault
datum'MLLW'
radius_km50.0
application'omnilab'
throttle0.5
base_uriTidesSource::DATA_URI
metadata_uriTidesSource::METADATA_URI