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

bomradar

v0.1.1

Published

BOM Radar Component

Downloads

5

Readme

Built With Stencil

BOM Radar

This is weather radar viewer based on the data from the Australian Bureau of Meteorology.

It was motivated by wanting to build the BOM radar into small dedicated displays, e.g. as Raspberry Pi and a little LCD, without all of the extraneous cruft of the BOM website radar viewer. It is not intended to be used on public web sites. I don't work for the BOM.

The web component may be integrated into any web view regardless of JavaScript frameworks. Unlike the BOM's 1990s-tech viewer, it does not rely on refreshing and a server side scripts to provide a list of frames. It calculates when the next frame will be available and fetches continuously. It supports loops of a longer length than the BOM viewer. A Canvas is used to render the animated images and the component supports resizing.

Using this component

Script tag

  • Put a script tag similar to this <script src='dist/bomradar.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Attributes

  • width = width of radar image in px (native is 512 x 512, only use this to scale if necessary)
  • height = as above
  • product = product id for the particular weather radar
  • imagecount = number of images to loop
  • disable-copyright = boolean flag, removes strap at the top.
  • disable-text = boolean flag, removes time/location text at bottom (you will also lose some radar data)
<bomradar-component width="480" height="480" product="IDR632" imagecount="15" disable-text></bomradar-component>

Product is the only thing you really need to specify. Unless you want a radar of Darwin. To get product id, find the radar web page such as http://www.bom.gov.au/products/IDR632.loop.shtml The URL shows the id, here 'IDR632'.

The component will try and load as many images as specified in imagecount attribute, but usually the BOM only keeps ten. However if you set imagecount to be larger than 10, it will keep adding future images to the loop until it is of length imagecount.

API

There is a small API for the component.

  • setOverlays(string[])
  • stop()
  • play()
  • setFPS(number) for animation FPS, default = 5
  • setPauseTime(number) for pause after each loop in seconds, default = 1

By default, bomradar displays the background and locations overlays. However you can also specify any of 'background', 'locations', 'waterways', 'topography' with setOverlays by passing an array of overlay names.

The stop() function stops the animation and stops fetching additional frames. This is useful for devices going into sleep mode etc.

The play() function re-starts the compnent, re-initializing the radar images and re-starting the animation. Returns a promise which resolves when the component has initialized.

The following is an example of using the web component API.

let bomradar = document.querySelector('bomradar-component')
bomradar.componentOnReady().then(() => {
  bomradar.setOverlays(['background', 'locations'])
  bomradar.setFPS(5)
})

Demo

Just clone it, npm i, npm start. bish bash bosh.

To-Do

  • Tidy up and publish to NPM for easy distribution
  • Add the observations overlay (this changes over time)

Future

  • Do optical flow analysis and then morph between frames - lol, right.

Seriously, something basic to indicate impending rain would be nice, since that's what we use the radar for anyway.

Changes

0.1.1: Added switches for disabling the copyright and text straps. Added API. Added play/stop functionality and setting animation times and inter loop pause times.

Shoutz

Darwin Hackerspace aaaaaaaiiiiiiiiggggggghhht! http://darwinhackerspace.net/