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

hongkong-weather

v1.0.0

Published

Simple Node.js module to get in depth weather data from the Hong Kong Observatory.

Downloads

14

Readme

Hong Kong Weather API

What is this for?

Weather in Hong Kong varies greatly day by day and has a huge impact on the life of the average Hongkonger. Normal weather services are not accurate for this region. Luckily the Hong Kong Observatory has really great reporting employing over 300 secientists to carefully monitor weather, storms and typhoons.

The Hong Kong Observatory provide an official website an app. As part of the governments open data initiative they also offer RSS feeds for the data.

I've found that the official feed is lacking a lot of detail, so as well as using that, I looked at the unofficial JSON feeds that the mobile app uses and created a helpful node module to parse those.

This module uses a combination of both of these to generate useful and reliable data.

Install

npm install --save hongkong-weather

Usage

You can create the instance using the following

var HongKongWeather = require('hongkong-weather');

var hkWeather = HongKongWeather();

hkWeather.getForecast().then(function(forecast){
    console.log(forecast);
});

Supported Methods

Example data

All methods return JSON, please see the examples linked above for more info on how to call each method.

hkWeather.getForecast()
  .then(function(forecast) {
    var prettyJSON = JSON.stringify(forecast,null,1);
    console.log(prettyJSON);
});

Gives this response

{
 "regional": {
  "title": "At 4 p.m. at the Hong Kong Observatory",
  "degrees_c": "29",
  "humidity_pct": "81",
  "uv_index": "4",
  "uv_index_at": "King's Park",
  "uv_intensity": "moderate",
  "warnings": [],
  "updated_on": "2016-06-08T08:11:00.000Z",
  "weather_condition": {
   "icon_url": "http://rss.weather.gov.hk/img/pic54.png"
  }
 },
 "temperatures": {
  "Hong Kong Observatory": "29",
  "King's Park": "29",
  "Wong Chuk Hang": "29",
  "Ta Kwu Ling": "29",
  "Lau Fau Shan": "29",
  "Tai Po": "27",
  "Sha Tin": "29",
  "Tuen Mun": "29",
  "Tseung Kwan O": "28",
  "Sai Kung": "28",
  "Cheung Chau": "27",
  "Chek Lap Kok": "30",
  "Tsing Yi": "29",
  "Shek Kong": "29",
  "Tsuen Wan Ho Koon": "28",
  "Tsuen Wan Shing Mun Valley": "29",
  "Hong Kong Park": "29",
  "Shau Kei Wan": "27",
  "Kowloon City": "29",
  "Happy Valley": "30",
  "Wong Tai Sin": "29",
  "Stanley": "27",
  "Kwun Tong": "29",
  "Sham Shui Po": "30",
  "Kai Tak Runway Park": "28",
  "Yuen Long Park": "30"
 },
 "rainfall": [
  {
   "station": "Yuen Long",
   "mm": "10"
  },
  {
   "station": "North District",
   "mm": "6"
  },
  {
   "station": "Tai Po",
   "mm": "1"
  }
 ]
}

Issues

I'm happy to fix any issues, but make sure to send a Gist of your XML or HTML content so I can recreate the problem. The government feeds are inconsistent so sometimes I might not be able to recreate the problem.

Other Handy Modules

Contributing

Feel free to submit any pull requests or add functionality, I'm usually pretty responsive.

If you like the module, please consider donating some bitcoin or litecoin.

Bitcoin

LNzdZksXcCF6qXbuiQpHPQ7LUeHuWa8dDW

LiteCoin

LNzdZksXcCF6qXbuiQpHPQ7LUeHuWa8dDW