arso-rainfall-intensity
- This project is written in typescript 3.9, but you can use its transpiled javascript built which targets ES2015.
- Built includes typings and declaration map (for debugging), so if your IDE is good enough you'll get module type hints working with JS.
Documentation by example:
const fs = ; const ArsoHttpApi ArsoProjection = ; // returns snapshots from oldest to newest (moving window 2 hours span, with sample rate of 5 mins) const latestSnapshots = await ArsoHttpApi; const mostRecentSnapshot = latestSnapshotslatestSnapshotslength - 1; console; // fetch the radar image const radarImageBuffer = await mostRecentSnapshot; // for debug view we can save it on disk fs; const projection = ; // initialize the projection from buffer, striping all unknown pixel colors seen in image. // developer must ensure that the image buffer is from the arso api (if he's not using the given api wrapper in this module). projection; // loadImageFromBuffer strips all unknown pixels and sets them to 0,0,0,0 - rgba (For example: removing the red border around the borders of radar image) fs; // returns rgba pixel values at given location in picture // Note 0,0 is top left of the picture. projection; // returns result object that inteprets pixel values // * result.value = integer value of dBZ (range of 0 - 57) - decibel relative to Z https://en.wikipedia.org/wiki/DBZ_(meteorology) // * result.group = integer range of 0 - 4, gruping by near values of .value [0 dBZ = 0, 15-24 dBZ = 1, 27-36 dBZ = 2, 39-48 dBZ = 3, 51-57 dBZ = 4] // * result.pixel = rgb value of the pixel (ignoring alpha) projection; // because radar image is bad at the bounds (preprocessing is removing all pixels outside) // you can check if point is inside the boundings. projection; // instead of using the above method, bounds can be accessed from the following property. projectioninterestPixelBounds // Given lng lat, returns the pixel position in radar image. projection; // Given lng lat, returns meter position projection; // Given pixel location, returns the lng lat postion projection; // Given pixel location, returns the meter postion projection; // Given meter location, returns the pixel position projection; // Given meter locatiom, returns the lng lat position projection;