|
Oyster Harvest Area Closure Analysis 0.1
Prediction and analysis of NSW oyster harvest area closures.
|
#include "BOM/historical_weather.h"Functions | |
| static int8_t | BOM_ParseWeather (Utils_ReqData_TypeDef *stream, BOM_WeatherDataset_TypeDef *dataset, BOM_WeatherStation_TypeDef *station) |
| CURLcode | BOM_GetWeather (BOM_WeatherDataset_TypeDef *dataset, BOM_WeatherStation_TypeDef *station, const char *year_month) |
| Get historical weather for a particular BOM weather station. More... | |
| int8_t | BOM_LoadWeatherFromCSV (const char *filename, BOM_WeatherDataset_TypeDef *dataset, BOM_WeatherStation_TypeDef *station) |
| Load BOM weather station dataset from .csv file. More... | |
| void | BOM_HistoricalWeatherToDB (BOM_WeatherStation_TypeDef *weather_station, BOM_WeatherDataset_TypeDef *dataset, PGconn *psql_conn) |
| Write observed weather to PostgreSQL table (weather_bom) More... | |
| void | BOM_TimeseriesToDB (const char *start_time, PGconn *psql_conn) |
| CURLcode BOM_GetWeather | ( | BOM_WeatherDataset_TypeDef * | dataset, |
| BOM_WeatherStation_TypeDef * | station, | ||
| const char * | year_month | ||
| ) |
Get historical weather for a particular BOM weather station.
Get a file from the Bureau of Meterology FTP server.
The BOM provides formatted .csv files for certain locations in Australia. These .csv files can be downloaded from the BOM's FTP server. Currently, it is unknown when the data is updated (sometime daily).
| dataset | Timeseries dataset to populate with data. |
| filename | Station filename obtained from BOM_Stations_TypeDef. |
| year_month | Year and month of interest e.g. 202206 for 2022 06 (June) |
| void BOM_HistoricalWeatherToDB | ( | BOM_WeatherStation_TypeDef * | weather_station, |
| BOM_WeatherDataset_TypeDef * | dataset, | ||
| PGconn * | psql_conn | ||
| ) |
Write observed weather to PostgreSQL table (weather_bom)
Turn a weather station dataset from the BOM into database values.
Rows that already exist are overwritten, new rows are added. Need to ensure each dataset and weather station are from the same source. These data are inserted into the weather_bom PostgreSQL table.
| weather_station | BOM weather station information. |
| dataset | BOM weather station dataset. |
| psql_conn | PostgreSQL connection handler. |
| int8_t BOM_LoadWeatherFromCSV | ( | const char * | filename, |
| BOM_WeatherDataset_TypeDef * | dataset, | ||
| BOM_WeatherStation_TypeDef * | station | ||
| ) |
Load BOM weather station dataset from .csv file.
Load a BOM dataset from a cached .csv file.
| filename | File to load (includes path). |
| dataset | Dataset to populate. |
|
static |
Saves a downloaded .csv dataset to a file. Also parses the data into a BOM dataset struct.
| stream | Contains raw string with .csv file. |
| dataset | Dataset to populate. |
| void BOM_TimeseriesToDB | ( | const char * | start_time, |
| PGconn * | psql_conn | ||
| ) |