# metoffice-datapoint

> JavaScript API for Met Office DataPoint API

Latest version **1.7.0** (published 2022-01-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install metoffice-datapoint
pnpm add metoffice-datapoint
yarn add metoffice-datapoint
bun add metoffice-datapoint
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.7.0 |
| Published | 2022-01-01 |
| First published | 2021-08-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.6 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Owen Cox |
| Maintainers | oncox |

## Links

- npm: https://www.npmjs.com/package/metoffice-datapoint
- Repository: https://github.com/oncox/DataPoint-Meteorology
- Homepage: https://github.com/oncox/DataPoint-Meteorology#readme
- Issues: https://github.com/oncox/DataPoint-Meteorology/issues
- npm.io page: https://npm.io/package/metoffice-datapoint

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.21.1

## Recent versions

- 1.7.0 (latest) — 2022-01-01
- 1.6.0 — 2022-01-01
- 1.5.0 — 2022-01-01
- 1.4.0 — 2021-12-29
- 1.3.0 — 2021-12-29
- 1.2.2 — 2021-08-31
- 1.2.1 — 2021-08-31
- 1.2.0 — 2021-08-29
- 1.1.1 — 2021-08-29
- 1.1.0 — 2021-08-29
- 1.0.4 — 2021-08-29
- 1.0.3 — 2021-08-29
- 1.0.2 — 2021-08-28
- 1.0.0 — 2021-08-27
- 1.0.0-beta.1 — 2021-08-26

## README

# Met Office Datapoint
A JavaScript module for accessing weather data via the [Met Office](http://www.metoffice.gov.uk/)'s legacy open data API known as [DataPoint](http://www.metoffice.gov.uk/datapoint).

**Disclaimer: This module is in no way part of the DataPoint service or otherwise affiliated with the Met Office in any way**

## Features

* Retrieve a list of sites providing observations 
* Retrieve a list of timesteps that observations are available for
* Retrieve observation data for site(s) 
* Retrieve a list of sites that forecast data is avaialble for 
* Retrieve a list of timesteps that forecast data is available for
* Retrieve forecast data for site(s) 



## Installation

The module can be directly installed via npm or yarn, e.g.

```bash
npm install metoffice-datapoint
```



## Usage

The module needs to be instantiated with an API key from [Met Office DataPoint](https://register.metoffice.gov.uk/WaveRegistrationClient/public/register.do?service=datapoint).  

```javascript
const datapoint = require('metoffice-datapoint')
const apiKey = '01234567-89ab-cdef-ghij-klmnopqrstuv' // API Key
{Observations, Forecasts} = datapoint(apiKey)
```

The module can additionally be instantiated with a logging object to produce logging messages.  The logging object is expected to contain methods for error, warn, info, trace, and debug (i.e. winston, log4js, ...)

```javascript
const winston = require('winston')
logger = winston.createLogger({
  transports: [new winston.transports.Console()]
})

{Observations, Forecast} = datapoint(apiKey, logger)
```

 ### Observations

#### Sitelist

```javascript
Observations.sitelist()
.then((sites) => {
	console.log(sites)
})
```

#### Capabilities

```javascript
Observations.capabilities()
.then((timestep) => {
	console.log(timestep) // Timesteps are Date objects
})
```

#### Values

```javascript
Observations.values()
.then((reports) => {
	console.log(reports)
})
```



### Forecasts

#### Sitelist

```javascript
Forecast.sitelist()
.then((sites) => {
	console.log(sites)
})
```

#### Capabilities

```javascript
Forecast.capabilities()
.then((timestep) => {
	console.log(timestep) // Timesteps are Date objects
})
```

#### Values

```javascript
Forecast.values()
.then((reports) => {
	console.log(reports)
})
```

---
_Source: https://npm.io/package/metoffice-datapoint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
