weather-prism

A node module for retrieving PRISM daily weather data for an arbitrary location (lat-lon) over the Regional Climate Centers (RCC) Applied Climate Information System (ACIS) API.

## Installation

```console
$ npm install weather-prism 
```

## Usage
Require the module:

```js
const weather = require('weather-prism')
```

### fetch
Return the weather data associated with a particular latitude+longitude position. Defaults to 20 years of data unless an array `years` is specified (see below).
```
  let wthr = await weather.fetch({
    lat: 40.48343343339606,
    lon: -86.97950005531311
  })
```
##### Sample Output
```
{
  "1992-01-01": {
    pcpn: 0,
    maxt: 37,
    mint: 31,
    avgt: 33.9,
    time: '1992-01-01T00:00:00-05:00'
  },
  ...
}
```

### fetch with specific years
```
  let wthr = await weather.fetch({
    lat: 40.48343343339606,
    lon: -86.97950005531311,
    years: [2015, 2016, 2017, 2018],
  })
```

### Generate report of missing data
```
  let wthr = await weather.fetch({
    lat: 40.48343343339606,
    lon: -86.97950005531311
  })

  let interval = 24*3600*1000; // time in ms
  let missing = await missingDataReport(wthr, interval);
  console.log({missing});

  await toCsv(wthr, 'rcc-outputs.csv');
```


This package leverages the PRISM Gridded product API.
See <https://www.rcc-acis.org/docs_gridded.html> for additional details.
