Oyster Harvest Area Closure Analysis 0.1
Prediction and analysis of NSW oyster harvest area closures.
Loading...
Searching...
No Matches
precipitation.c File Reference
Include dependency graph for precipitation.c:

Functions

CURLcode WillyWeather_GetRainfallForecast (WW_Location_TypeDef *location, WW_RainfallForecast_TypeDef *rainfall_forecast)
 Gets the rainfall forecast (next 7 days inc today) for a location. More...
 
void WillyWeather_RainfallToDB (WW_Location_TypeDef *location, WW_RainfallForecast_TypeDef *forecast, PGconn *psql_conn)
 Rainfall to PostgreSQL table method. More...
 

Function Documentation

◆ WillyWeather_GetRainfallForecast()

CURLcode WillyWeather_GetRainfallForecast ( WW_Location_TypeDef location,
WW_RainfallForecast_TypeDef rainfall_forecast 
)

Gets the rainfall forecast (next 7 days inc today) for a location.

Get forecast precipitation data from Willy Weather.

Willy Weather provides forecast rainfall probability and amount as a range e.g. 10-15 mm 90 %. These data are provided for the past 2 days, the current day and the next 6 days (9 days in total). A location needs to be provided along with a daily rainfall struct to hold the responses.

// Get location by name
const char* search_location = "Batemans";
WW_Location_TypeDef location_info = {0};
WillyWeather_GetLocationByName(search_location, &location_info);
// Get rainfall for a location
WW_RainfallForecast_TypeDef rainfall_forecast = {0};
WillyWeather_GetRainfallForecast(&location_info, &rainfall_forecast);
CURLcode WillyWeather_GetLocationByName(char *name, WW_Location_TypeDef *location_info)
Get an ID describing a location from Willy Weather.
Definition: location.c:26
CURLcode WillyWeather_GetRainfallForecast(WW_Location_TypeDef *location, WW_RainfallForecast_TypeDef *rainfall_forecast)
Gets the rainfall forecast (next 7 days inc today) for a location.
Definition: precipitation.c:28
Location data from Willy Weather request.
Definition: location.h:24
Holds daily forecast rainfall information from Willy Weather.
Definition: precipitation.h:38
See also
https://www.willyweather.com.au/api/docs/v2.html#forecast-get-rainfall
Parameters
locationLocation struct (see location.h).
daily_rainfallDaily rainfall forecast struct to hold responses.
Returns
Curl code representing HTTP errors that may have occured.

◆ WillyWeather_RainfallToDB()

void WillyWeather_RainfallToDB ( WW_Location_TypeDef location,
WW_RainfallForecast_TypeDef forecast,
PGconn *  psql_conn 
)

Rainfall to PostgreSQL table method.

Write Willy Weather forecast for a particular location to PostgreSQL table.

The target table is called weather_ww.

Parameters
locationLocation information for Willy Weather dataset.
forecastWilly Weather weather forecast.
psql_connPostgreSQL connection handler.