National Network of Regional Coastal Monitoring Programmes

CCO Real-Time Data API

The API gives the latest and recent wave, tide and meteorological observations, and tide predictions, from the stations of the National Network of Regional Coastal Monitoring Programmes (NNRCMP).

Contents

  1. Terms of use
  2. Authentication
  3. Endpoints and returned data
  4. Query options
  5. Quality control
  6. Test harness
  7. Errors
  8. Changes
  9. Contact

1. Terms of use

Data from the NNRCMP is made freely available under the terms of the Open Government Licence.

Web pages and other outputs which use real-time NNRCMP data must include the following attribution:

"Real time data displayed on this page are from the National Network of Regional Coastal Monitoring Programmes, made freely available under the terms of the Open Government Licence. Please note that data are not quality-controlled in real-time."

1.1 Acceptable use

Each API key is for the domain it was issued for. Please don't share your key or use it from other sites.

Please cache responses, and request data no more often than it is recorded (see section 3): every 30 minutes for waves, except Penarth at 10 minutes, and every 10 minutes for tides and met. A request covering all wave stations can use a 10-minute interval to include Penarth. For a longer period, use duration (section 4.1) rather than many single requests.

Data may arrive late and stations may stop reporting, so check each record's timestamp.

We may limit or disable keys that cause heavy load or ignore these terms, and we may limit request rates without notice to protect the service.

2. Authentication

An API key must be provided with every API request, either as an HTTP GET variable, key=YOUR_API_KEY, or in the custom request header X-API-Key: YOUR_API_KEY. If both are sent, the GET variable is used.

The Referer header must be a web address on the domain the key is issued for, or on a subdomain of it. For a key issued for yourdomain.com, pages on https://yourdomain.com/ and https://www.yourdomain.com/ qualify, and https://yourdomain.com.example.net/ does not. A web browser sends this header itself. Other programs, such as scripts run on a server, should send it themselves, for example Referer: https://www.yourdomain.com/. A domain on its own, without https://, is not recognised.

2.1 Obtaining an API key for your own service

This will be automated via a web interface on the CCO user management page. In the meantime, please fill in the form below:

Not registered?
e.g. www.mygraphapp.org
  Fields in red are required!

3. Endpoints and returned data

There are four groups of endpoints, one for each type of data: waves, tides, tidepredictions and met.

Wave measurements are normally recorded at 30-minute intervals, except Penarth, which records at 10-minute intervals. Water level and meteorological measurements are normally recorded at 10-minute intervals. Gaps and timestamp variations occur, and data can arrive late, so check each record's timestamp. A station that has stopped reporting may still return its last record.

Some entries are external sites, run by other organisations and included for reference. They have a link to the provider's page as their id, and no readings.

Fields common to all endpoints

FieldDescription
boundedBy, msGeometry, msGeometryOSGBThe position of the station in GML: a bounding box, a point in longitude and latitude (EPSG:4326) and a point in British National Grid eastings and northings (EPSG:27700). GeoJSON has the same three fields, always null, so that the field lists match. In GeoJSON, read the position from geometry (longitude, latitude). KML has none of these fields and gives the position as a Point.
idNumeric identifier for NNRCMP stations. For an external site, a link to the data provider's page.
sensorSite name
institutionThe organisation(s) that collected the data
dateThe timestamp of the record in GMT (UTC), as YYYYMMDD#hhmmss: date and time are separated by '#'
typeThe data type: waves, tides, tidepredictions or met. In KML, only the waves endpoint has this field.

KML responses also have a gml_id field, which is the data type and the id joined by a full stop.

3.1 Waves

FieldDescription
gps_latitudeThe latitude of the buoy in decimal degrees, from the buoy's own GPS. Empty for stations without one.
gps_longitudeThe longitude of the buoy in decimal degrees, from the buoy's own GPS. Empty for stations without one.
hsThe spectral significant wave height in metres
hmaxThe maximum wave height in metres
sstThe sea surface temperature, measured at 0.5 metres below the surface, in degrees Celsius
tpThe spectral peak wave period in seconds
tzThe spectral zero-upcrossing wave period in seconds
pdirThe spectral peak wave direction in degrees
valueA copy of pdir, kept for older applications. Please use pdir.
spreadThe spread of wave direction in degrees
teThe wave energy period in seconds
powerThe wave power in kW/m
QCflagThe quality-control flag, see section 5

3.2 Tides

FieldDescription
valueThe measured water level in metres above Chart Datum
hwThe elevation of the next predicted High Water in metres above Chart Datum
hw_timestampThe timestamp of the next predicted High Water in GMT (UTC), as YYYYMMDD#hhmmss
lwThe elevation of the next predicted Low Water in metres above Chart Datum
lw_timestampThe timestamp of the next predicted Low Water in GMT (UTC), as YYYYMMDD#hhmmss
prev_hwThe elevation of the previous predicted High Water in metres above Chart Datum
prev_hw_timestampThe timestamp of the previous predicted High Water in GMT (UTC), as YYYYMMDD#hhmmss
prev_lwThe elevation of the previous predicted Low Water in metres above Chart Datum
prev_lw_timestampThe timestamp of the previous predicted Low Water in GMT (UTC), as YYYYMMDD#hhmmss
QCflagThe quality-control flag, see section 5

3.3 Tide predictions

Tide predictions are available at one-minute intervals up until the end of the current or next year. latest returns the prediction for the current minute. The fields are the same as for tides, without QCflag, and value is the predicted water level in metres above Chart Datum.

3.4 Met

FieldDescription
speedWind speed in metres per second
valueA copy of speed, kept for older applications. Please use speed.
dirMean wind direction in degrees, averaged over 10 minutes
tempAir temperature in degrees Celsius
gustGust speed in metres per second
pressureAtmospheric pressure in hectopascals
rainfallPrecipitation in millimetres
humidityRelative humidity as a percentage
QCflagThe quality-control flag, see section 5

Met responses in KML do not have dir or temp. Use GML or GeoJSON for those.

4. Query options

4.1 Time

All timestamps are in GMT (UTC). Each request names a time: either latest, which returns the most recent record, or a date and time as YYYYMMDDhhmmss. With a date and time, the API returns the most recent record at or before that time. today is not supported.

https://coastalmonitoring.org/observations/waves/latest?key=YOUR_API_KEY
https://coastalmonitoring.org/observations/tides/latest?key=YOUR_API_KEY
https://coastalmonitoring.org/observations/tidepredictions/20210123130000?key=YOUR_API_KEY
https://coastalmonitoring.org/observations/met/20210123130000?key=YOUR_API_KEY

For more than one record per site, add duration: the number of hours before latest or the given time. The maximum is 168 hours (one week) for all sites, or 8,760 hours (one year) for a single site. Larger values are reduced to the maximum. With a duration, tide predictions are given at 10-minute rather than one-minute intervals.

https://coastalmonitoring.org/observations/waves/latest?key=YOUR_API_KEY&duration=24
https://coastalmonitoring.org/observations/tides/20210123130000?key=YOUR_API_KEY&duration=1
https://coastalmonitoring.org/observations/tidepredictions/latest?key=YOUR_API_KEY&duration=6

4.2 Location

By default, the API returns records from all sites, in alphabetical order. For a single site, add sensor with the site name or its numeric id. A request without sensor lists every site with its name (sensor) and id.

https://coastalmonitoring.org/observations/waves/latest?key=YOUR_API_KEY&sensor=Dawlish
https://coastalmonitoring.org/observations/tides/20210123130000?key=YOUR_API_KEY&sensor=89
https://coastalmonitoring.org/observations/tidepredictions/20210123130000?key=YOUR_API_KEY&sensor=89&duration=24
https://coastalmonitoring.org/observations/met/latest?key=YOUR_API_KEY&sensor=Deal%20Pier&duration=6

The stations and their recent readings can also be browsed as plain web pages, with no key, at https://coastalmonitoring.org/observations/. Those pages are for people; programs should use the API.

4.3 Output format

Every endpoint is available as GML (a WFS document, which is XML with coordinates), KML (a Google Earth document, also XML) or GeoJSON. Choose the format with the Accept header:

application/xml for GML, application/vnd.google-earth.kml+xml for KML or application/json for GeoJSON

Without an Accept header, or with one that allows anything, the response is GML. Alternatively, add the format to the URL to override the Accept header:

https://coastalmonitoring.org/observations/waves/latest.gml?key=YOUR_API_KEY
https://coastalmonitoring.org/observations/tides/20210123130000.kml?key=YOUR_API_KEY
https://coastalmonitoring.org/observations/tidepredictions/latest.kml?key=YOUR_API_KEY&sensor=89
https://coastalmonitoring.org/observations/met/latest.geojson?key=YOUR_API_KEY&duration=24

5. Quality control

Data is not quality controlled in real-time. Wave, tide and met data are quality controlled monthly in arrears. Erroneous data is flagged rather than removed.

Until a record has been through quality control, it has no flag: QCflag is null in GeoJSON and empty in GML and KML. An empty flag does not mean that the data passed quality control. Tide predictions have no QCflag.

For a full description of the quality control procedure and the flags, please see the quality control handbooks.

6. Test harness

Try the API with the Swagger test page:

https://coastalmonitoring.org/swagger-ui-master/dist/

Use the development API key for the coastalmonitoring.org domain: 6cefd36d8e12a4dead4cf06d4dbd09c0

7. Errors

Errors are returned as plain text with one of these status codes:

  • 400 Bad Request: the date is today, which is not supported; use latest or a date and time such as 20210123130000.
  • 401 Unauthorized: the API key is missing or unknown.
  • 403 Forbidden: the Referer header does not name the domain the key is issued for.
  • 404 Not Found: the address is not an API endpoint.
  • 406 Not Acceptable: the URL has no format suffix and the Accept header allows none of the three formats.

8. Changes

DateVersionChanges
November 20261.8GPS survey stations removed from waves, Shanklin removed from met, and the Hinkley Point entry updated to the current WaveNet buoy
October 20261.7A missing or unknown key returns 401, and a Referer that does not match returns 403
August 20261.6Buoy positions from the buoys' own GPS (gps_latitude, gps_longitude) added to waves
March 20261.5GeoJSON returns null for every missing value
February 20261.4QCflag added for wave, tide and met data. Missing values are returned as null (GeoJSON) or empty (GML, KML) instead of "None"
13 September 20241.3The tidepredictions endpoint
23 September 20221.2Several records per site with duration
16 September 20221.1Filtering for a single site with sensor

9. Contact

For questions or comments on using the API, please use our feedback form or email us.