npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

arso-rainfall-intensity

v1.4.2

Published

!!!Only for slovenia!!! Provides simple api for fetching radar images of rainfall intensity and parsing from pixels and converting pixel coordinates to pairs of latitude and longitude or vice versa.

Downloads

6

Readme

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 = require('fs');
    const { ArsoHttpApi, ArsoProjection } = require('arso-rainfall-intensity');
    
    // returns snapshots from oldest to newest (moving window 2 hours span, with sample rate of 5 mins) 
    const latestSnapshots = await ArsoHttpApi.fetchLatestRadarSnapshotsTimeline();
    const mostRecentSnapshot = latestSnapshots[latestSnapshots.length - 1];
    console.log('snapshot time:', mostRecentSnapshot.dateTime);
    // fetch the radar image
    const radarImageBuffer = await mostRecentSnapshot.fetchRadarImageBuffer();
    // for debug view we can save it on disk
    fs.writeFileSync('latest.png', radarImageBuffer);

    const projection = new ArsoProjection();
    // 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(radarImageBuffer);

    // 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.writeFileSync('latest-processed.png', projection.getImageBuffer());

    // returns rgba pixel values at given location in picture 
    // Note 0,0 is top left of the picture.
    projection.getPixelInfo({ x: 69, y: 69 });

    // 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.getPixelRadarValue({ x: 69, y: 69 });

    // because radar image is bad at the bounds (preprocessing is removing all pixels outside)
    // you can check if point is inside the boundings.
    projection.isPixelInInterestBounds({ x: 69, y: 69 });
    // instead of using the above method, bounds can be accessed from the following property.
    projection.interestPixelBounds

    // Given lng lat, returns the pixel position in radar image.
    projection.projectDegreeUnitToImagePixel({ x: LNG_VALUE, y: LAT_VALUE });

    // Given lng lat, returns meter position
    projection.projectDegrees2MeterUnits({ x: LNG_VALUE, y: LAT_VALUE });

    // Given pixel location, returns the lng lat postion
    projection.projectImagePixelToDegreeUnit({ x: 69, y: 69 });

    // Given pixel location, returns the meter postion
    projection.projectImagePixelToMeterUnit({ x: 69, y: 69 });

    // Given meter location, returns the pixel position
    projection.projectMeterUnitToImagePixel({ x: METER_LNG_VALUE, y: METER_LAT_VALUE });

    // Given meter locatiom, returns the lng lat position
    projection.projectMetersToDegreeUnits({ x: METER_LNG_VALUE, y: METER_LAT_VALUE });