Skip to content

dergudzon/wind-js-server

 
 

Repository files navigation

wind-js-server NPM version NPM Downloads

Simple demo rest service to expose GRIB2 wind forecast data (1 degree, 6 hourly from NOAA) as JSON.

Consumed in leaflet-velocity. Contains a pre-packaged copy of grib2json for conversion.

Data Vis demo here: http://danwild.github.io/leaflet-velocity

Note that this is intended as a crude demonstration, not intended for production use. To get to production; you should improve upon this or build your own.

Running with Docker Compose (recommended)

Requires Docker with Compose plugin.

# copy and edit config (CORS whitelist, retention, etc.)
cp .env.example .env

# build and start
docker compose up -d

# view logs
docker compose logs -f

# stop
docker compose down

The json-data/ folder is mounted as a host volume — wind data persists across container restarts and rebuilds. Files older than RETENTION_DAYS (default: 30) are removed automatically on startup and once per day.

Configuration

Copy .env.example to .env and adjust as needed:

Variable Default Description
PORT 7000 Server port
CORS_WHITELIST localhost origins Comma-separated allowed origins
RETENTION_DAYS 30 Days of JSON data to keep
NOAA_BASE_URL NOMADS GFS filter URL Override NOAA data source
HARVEST_DEPTH_DAYS 7 Days back to search for data
REQUEST_DELAY_MS 2000 Delay between NOAA requests (ms)

install, run (without Docker):

Requires Node.js, npm, and Java JRE (for grib2json conversion).

# from project root:
cp .env.example .env
npm install
npm start

endpoints

  • /latest returns the most up to date JSON data available
  • /nearest returns JSON data nearest to requested
    • $GET params:
      • timeIso an ISO timestamp for temporal target
      • searchLimit number of days to search beyond the timeIso (will search backwards, then forwards)
  • /alive health check url, returns simple message

License

MIT License (MIT)

About

Service to expose Grib2 wind forecast data as JSON

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 61.5%
  • Python 28.1%
  • Dockerfile 7.9%
  • Shell 1.4%
  • Batchfile 1.1%