|
Oyster Harvest Area Closure Analysis 0.1
Prediction and analysis of NSW oyster harvest area closures.
|
#include <string.h>#include <stdlib.h>#include <math.h>#include <time.h>#include <curl/curl.h>#include <cjson/cJSON.h>#include <log.h>#include "WillyWeather/authenticate.h"#include "WillyWeather/location.h"#include "WillyWeather/forecast.h"#include "http.h"#include "utils.h"Go to the source code of this file.
Data Structures | |
| struct | WW_TideDataset_TypeDef |
| Tide data from Willy Weather request. More... | |
Functions | |
| CURLcode | WillyWeather_GetTides (uint16_t location_id, const char *start_date, uint16_t n_days, WW_TideDataset_TypeDef *tides) |
| Get the tides data from Willy Weather. More... | |
| uint8_t | WillyWeather_TidesToCSV (WW_Location_TypeDef *location_info, WW_TideDataset_TypeDef *dataset) |
| Write tide dataset to csv files in specific directory. More... | |
| WW_TideDataset_TypeDef | WW_TidesFromCSV (const char *filename) |
| Load tide dataset from cache (.csv or .txt) More... | |
| CURLcode WillyWeather_GetTides | ( | uint16_t | location_id, |
| const char * | start_date, | ||
| uint16_t | n_days, | ||
| WW_TideDataset_TypeDef * | tides | ||
| ) |
Get the tides data from Willy Weather.
Get calculated high and low tides from Willy Weather.
Willy Weather provides tide data for coastal regions. These data consist of high and low tides (and timestamps) grouped by day. This function extracts relevent high, low and maximum daily tides and appends them to a tides struct (WW_TideDataset_TypeDef).
,-'''-.─────── High Tide (HT)
,-' ▲ `-.
,' │ `.
,' │ `.
/ │ \
/ │ \
-—+---------—│---------—-----------------------— Tide Diff │ \ / │ \ / MAX(TD = HT - LT) │ ‘. ,’ │ ‘. ,’ │ ‘-. ,-’ ▼ Low Tide (LT) ───‘-,,,-’
| location_id | Location index provided by Willy Weather. |
| start_date | Start date (e.g. YYYY-MM-DD HH:MM:SS). |
| n_days | Number of days from the start date (basically end date). |
| uint8_t WillyWeather_TidesToCSV | ( | WW_Location_TypeDef * | location_info, |
| WW_TideDataset_TypeDef * | dataset | ||
| ) |
Write tide dataset to csv files in specific directory.
Create output CSV files with tide data from a particular location.
Build tide directories and then for each of low, high and daily tide values build .csv files. Spaces in filenames are handled by this function and replaced with '-'.
| location_info | Location struct for filename. |
| dataset | Dataset to write to .csv files. |
| WW_TideDataset_TypeDef WW_TidesFromCSV | ( | const char * | filename | ) |
Load tide dataset from cache (.csv or .txt)
Build tide dataset from cache (.csv or .txt)
Requires the following format Unix;Date;Values
| filename | Filename (and path) of .csv or .txt file to open. |