|
Oyster Harvest Area Closure Analysis 0.1
Prediction and analysis of NSW oyster harvest area closures.
|
#include "transform.h"Functions | |
| static float | T_Normalise (const float value, const float min, const float max) |
| Helper function for nomalising data. More... | |
| void | T_BuildWeatherDB (T_LocationsLookup_TypeDef *locations, PGconn *psql_conn) |
| Build weather table in PostgreSQL database. More... | |
| void | T_FloodPrediction (PGconn *psql_conn) |
| Transforms data from all harvest programs into flood prediction. More... | |
| void | T_WindowDataset (PGconn *psql_conn, const int program_id) |
| Window dataset into sum of next 8-days and previous 5-days. More... | |
| void | T_NormaliseWindowedPrecipitation (PGconn *psql_conn, const int program_id) |
| Normalise summed moving window precipitation between 0 and 1. More... | |
| void T_BuildWeatherDB | ( | T_LocationsLookup_TypeDef * | locations, |
| PGconn * | psql_conn | ||
| ) |
Build weather table in PostgreSQL database.
Main weather table for each location.
This table contains both forecasted and historical weather information for each harvest location. One column contains precipitation data where forecasted weather is added first, then overwritten using observed values. Both forecasted and observed data are stored in seperate columns.
| locations | Unique locations information. |
| psql_conn | PostgreSQL connection handler. |
| void T_FloodPrediction | ( | PGconn * | psql_conn | ) |
Transforms data from all harvest programs into flood prediction.
@breif Main entry point for calculating the risk of a harvest area closure.
Gets a list of the harvest areas. Loops through each of these locations to calcualte a windowed moving average of precipitation and then normalises this window to provide a value between 0 and 1.
| psql_conn | PostgreSQL connection. |
|
inlinestatic |
Helper function for nomalising data.
| value | Raw input value. |
| min | Raw maxiumum value. |
| max | Raw miniumum value. |
| void T_NormaliseWindowedPrecipitation | ( | PGconn * | psql_conn, |
| const int | program_id | ||
| ) |
Normalise summed moving window precipitation between 0 and 1.
@breif Normalise precipiation data between 0 and 1.
After a summed window average has been completed by T_WindowDataset the data can then be normalised. This normalisation is program specific i.e. each normalisations max and min are based on that program only and not the max and min of all programs in NSW.
| psql_conn | PostgreSQL connection. |
| void T_WindowDataset | ( | PGconn * | psql_conn, |
| const int | program_id | ||
| ) |
Window dataset into sum of next 8-days and previous 5-days.
Window transform Z-Score values into a probability of flooding event.
For each program_id calcualte the sum of the next 8-days precipitation and the previous 5-days preciptiation. This acts as a moving window across all available data.
w_start and w_end variables in this function.| psql_conn | PostgreSQL connection. |
| program_id | Food authority program ID. |