Oyster Harvest Area Closure Analysis 0.1
Prediction and analysis of NSW oyster harvest area closures.
Loading...
Searching...
No Matches
historical_weather.h
Go to the documentation of this file.
1#ifndef PROGRAM_HISTORICAL_WEATHER_H
2#define PROGRAM_HISTORICAL_WEATHER_H
3
4#include <time.h>
5#include <curl/curl.h>
6#include <ctype.h>
7#include <libpq-fe.h>
8#include <stdint.h>
9
10#include "transform.h"
11#include "BOM/stations.h"
12#include "ftp.h"
13
15#define BOM_RESPONSE_BUFFER_SIZE 200
16
18#define BOM_TIME_STR_BUFFER_SIZE 30
19
21#define BOM_MAX_RESPONSE_SIZE 10000
22
23typedef struct {
24 uint16_t count;
25 time_t timestamps[BOM_RESPONSE_BUFFER_SIZE];
28 double precipitation[BOM_RESPONSE_BUFFER_SIZE];
29 double max_temperature[BOM_RESPONSE_BUFFER_SIZE];
30 double min_temperature[BOM_RESPONSE_BUFFER_SIZE];
32
36 const char* year_month);
37
39int8_t BOM_LoadWeatherFromCSV(const char* filename,
42
46 PGconn* psql_conn);
47
48void BOM_TimeseriesToDB(const char* start_time, PGconn* psql_conn);
49
50#endif //PROGRAM_HISTORICAL_WEATHER_H
void BOM_TimeseriesToDB(const char *start_time, PGconn *psql_conn)
Definition: historical_weather.c:261
#define BOM_RESPONSE_BUFFER_SIZE
Max number of items in weather dataset.
Definition: historical_weather.h:15
#define BOM_TIME_STR_BUFFER_SIZE
Max number of chars in timestamp buffer.
Definition: historical_weather.h:18
void BOM_HistoricalWeatherToDB(BOM_WeatherStation_TypeDef *weather_station, BOM_WeatherDataset_TypeDef *dataset, PGconn *psql_conn)
Write observed weather to PostgreSQL table (weather_bom)
Definition: historical_weather.c:200
CURLcode BOM_GetWeather(BOM_WeatherDataset_TypeDef *dataset, BOM_WeatherStation_TypeDef *station, const char *year_month)
Get historical weather for a particular BOM weather station.
Definition: historical_weather.c:21
int8_t BOM_LoadWeatherFromCSV(const char *filename, BOM_WeatherDataset_TypeDef *dataset, BOM_WeatherStation_TypeDef *station)
Load BOM weather station dataset from .csv file.
Definition: historical_weather.c:93
Definition: historical_weather.h:23
uint16_t count
Number of values in dataset.
Definition: historical_weather.h:24
BOM weather station (id, state, name, latitude, longitude)
Definition: stations.h:25