Skip to content

Software binary program for Windows, Linux, macOSX to parse real-time NEA Weather Forecast, PSI Readings and Air Temperature. Data from Singapore Govtech API GW.

License

Notifications You must be signed in to change notification settings

maxng07/SG_Weather_GO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Singapore Weather Forecast, Air Quality and Air Temperature Readings

This is a complete rewrite of the application sg-WhatsApp-Weather-DirectAPI using Golang. Application can be compiled into binaries to run on Windows/EXE, Linux, Mac OSX and be executed locally to obtain the Weather Forecast, PSI and Temperature readings across Singapore.

The Core Golang engine can also be deployed as a Serverless function in the Cloud (AWS/GCP/Twilio) replacing the Nodejs in sg-WhatsApp-Weather-DirectAPI to GET and parse the real-time Weather forecast published by the Meteorological Service Singapore (MSS) under National Environment Agency (NEA).

The MSS Weather Forecast JSON data retrieve from Govtech API Gateway are nested in arrays and objects. The code parse these in golang struct and matches it with the user's input to provide the weather forecast value.

The application will prompt the User for input, inputs are not case-sensitive and valid inputs are
1. Town-name
2. "All" keyword to print out all weather forecast
3. "Area" keyword to print out all town-name.

For the definition of Singapore Meteorological terminalogy used in the Weather Forecast, please refer to Weather Descriptor and Definition used in forecast.

Release 1.0

In Release 1.0, PSI readings are added. The application now accepts additional User Input, "PSI" or "psi" will extract PSI data from NEA and present PM2.5 Hourly and PSI Hourly Readings. The MSS PSI raw data has more datasets and more details can be included in the output. Reference can be looked up at https://www.haze.gov.sg for meaning of PSI values and PM2.5 Air Quality values. Datasets of MSS PSI is on https://data.gov.sg/dataset/psi

Release 2.0

In Release 2.0, near Real-time Air Temperature Readings across Singapore are added. The data are retrieve from MSS Real Time Weather Forecast across Singapore , the API end points maintained by GovTech. The Air Temperature readings in degreeC are taken on 5 minute time interval from the Weather Stations distributed across Singapore. To read this, a new User Input is supported, "Temp" or "temp" will extract JSON data for Air Temperature Readings. Here is the google map of the locations on the Weather Stations

The application logic is also re-written for easier maintenance for any future feature add-on.

Release 2.1

In Release 2.1, a correlation is done to display near real-time Rain Fall readings from Rain Gauge Station within the pre-defined radius distance. This provided a better ground view. More details in the Wiki Page
To compute distance between Weather Forecast Station and Rain Gauge Stations, see Calculating distance with Coordinates using Haversine

Correlated results will be display when you query for Weather Forecast in Town Area.

Usage - User Input

Run the application program either by executing it in Command Prompt/Terminal Window or clicking from Finder Window. Application will prompt you for input. These are

Weather Forecast

  1. "Town-name"
  2. "All" keyword to print out all weather forecast
  3. "Area" keyword to print out all town-name.

Air Quality - PSI
4. "PSI" keyword to print PSI PM2.5 and PSI Aggregate readings across 5 Regions in Singapore

Real Time Air Temperature
5. "Temp" keyword to print out 5min interval Real-time Air temperature across Weather Stations in Singapore

Near Real-Time Rainfall measurement
6. "Rainfall" keyword will print all measurement of Readings from Rain Gauge Stations.
7. Correlation of Weather Forecast with Rain Gauge Readings are automatically included when you query for Town Area (in 1). Stations.json will configure the Correlated Stations. See Calculating distance with Coordinates using Haversine

Demonstration

The animated gif will show the output of the Weather App . All features are showcased.

The core Golang engine can be used as webhook on Cloud Communication Provider such as Twilio, Nexmo, Messagebird and others and send the weather forecast data as SMS, Voice, WhatsApp, LINE, Google Assistant.

Installation

Get the latest version for Windows and macOSX version here

All Weather Data are from Data.gov.sg
More Weather info on Meteorological Service Singapore (MSS)

About

Software binary program for Windows, Linux, macOSX to parse real-time NEA Weather Forecast, PSI Readings and Air Temperature. Data from Singapore Govtech API GW.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published