datagovsg.environment¶
Client for interacting with the Environment APIs.
Example usage:
# get the 24-hour weather forecast
from datagovsg import Environment
environment = Environment()
forecast = environment.twenty_four_hour_weather_forecast()
Methods¶
-
class
datagovsg.environment.client.
Client
¶ Bases:
datagovsg.client.__Client
Interact with the environment-related endpoints.
-
air_temperature
(date_time=None, dt=None)¶ Get air temperature readings across Singapore.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone. If both dt and date_time are specified, then date_time is used.
dt (date) – (optional) Specific date to retrieve the readings. If both dt and date_time are specified, then dt is NOT used.
- Returns
(dict) Readings of air temperature by station.
References
-
four_day_weather_forecast
(date_time=None, dt=None)¶ Retrieve the latest 4 day weather forecast.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone. If both dt and date_time are specified, then date_time is used.
dt (date) – (optional) Specific date to retrieve the readings. If both dt and date_time are specified, then dt is NOT used.
- Returns
(dict) Weather forecast for the next 4 days by area.
References
https://data.gov.sg/dataset/weather-forecast?resource_id=4df6d890-f23e-47f0-add1-fd6d580447d1
-
pm25
(date_time=None, dt=None)¶ Retrieve the latest PM2.5 information in Singapore.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone. If both dt and date_time are specified, then date_time is used.
dt (date) – (optional) Specific date to retrieve the readings. If both dt and date_time are specified, then dt is NOT used.
- Returns
(dict) Readings of PM2.5 by region.
References
-
psi
(date_time=None, dt=None)¶ Retrieve the latest PSI information in Singapore.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone. If both dt and date_time are specified, then date_time is used.
dt (date) – (optional) Specific date to retrieve the readings. If both dt and date_time are specified, then dt is NOT used.
- Returns
(dict) Readings of PSI by region.
References
-
rainfall
(date_time=None, dt=None)¶ Get rainfall readings across Singapore.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone. If both dt and date_time are specified, then date_time is used.
dt (date) – (optional) Specific date to retrieve the readings. If both dt and date_time are specified, then dt is NOT used.
- Returns
(dict) Readings of rainfall by station.
References
-
relative_humidity
(date_time=None, dt=None)¶ Get relative humidity readings across Singapore.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone. If both dt and date_time are specified, then date_time is used.
dt (date) – (optional) Specific date to retrieve the readings. If both dt and date_time are specified, then dt is NOT used.
- Returns
(dict) Readings of relative humidity by station.
References
-
twenty_four_hour_weather_forecast
(date_time=None, dt=None)¶ Retrieve the latest 24 hour weather forecast across Singapore.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone. If both dt and date_time are specified, then date_time is used.
dt (date) – (optional) Specific date to retrieve the readings. If both dt and date_time are specified, then dt is NOT used.
- Returns
(dict) Weather forecast for the next 24 hours by area.
References
https://data.gov.sg/dataset/weather-forecast?resource_id=9a8bd97e-0e38-46b7-bc39-9a2cb4a53a62
-
two_hour_weather_forecast
(date_time=None, dt=None)¶ Retrieve the latest two hour weather forecast across Singapore.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone. If both dt and date_time are specified, then date_time is used.
dt (date) – (optional) Specific date to retrieve the readings. If both dt and date_time are specified, then dt is NOT used.
- Returns
(dict) Weather forecast for the next 2 hours by area.
References
https://data.gov.sg/dataset/weather-forecast?resource_id=571ef5fb-ed31-48b2-85c9-61677de42ca9
-
uv_index
(date_time=None)¶ Retrieve the latest UV index information in Singapore.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone.
- Returns
(dict) Readings of UV Index by station.
References
-
wind_direction
(date_time=None, dt=None)¶ Get wind direction readings across Singapore.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone. If both dt and date_time are specified, then date_time is used.
dt (date) – (optional) Specific date to retrieve the readings. If both dt and date_time are specified, then dt is NOT used.
- Returns
(dict) Readings of wind direction by station.
References
-
wind_speed
(date_time=None, dt=None)¶ Get wind speed readings across Singapore.
- Parameters
date_time (datetime) – (optional) Specific date-time to retrieve the readings. Will be standardised to SGT timezone. If both dt and date_time are specified, then date_time is used.
dt (date) – (optional) Specific date to retrieve the readings. If both dt and date_time are specified, then dt is NOT used.
- Returns
(dict) Readings of wind speed by station.
References
-