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.
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.
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.
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
- "Town-name"
- "All" keyword to print out all weather forecast
- "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
More Weather info on Meteorological Service Singapore (MSS)