Resource Assessment module#
Resource Assessment module
The module allows calculation and production of some of the standard deliverables for resource assessment listed in IEC 62600-101 for reconnoicanse and feasibility study. The calculations are based on energy flux, significant wave height and energy period parameters from RESOURCECODE database. The module produces univariate statistics for energy flux, bi-variate statistics and energy values binned in significant wave height and energy period
IMPORTANT: read_data_temp - is a temporary method to be replaced by method to export the data directly from Casandra
Created on Wed Dec 2 14:14:48 2020
@author: david.darbinyan
- resourcecode.resassess.bivar_monstats(df: DataFrame, filename: str = 'resource_assess', steph: float = 0.5, stept: float = 1, display: bool = True, write: bool = True)#
Method to produce monthly and annual bi-variate statistics and energy flux tables. These are calculated from bivar_stats method in a loop and saved as csv file
- Parameters:
df (PANDAS DATAFRAME) – Input data in RCODE dataframe format.
filename (STR, optional) – Full path to output file name, results will have suffix added describing the time period and type of the produced table. The default is ‘resource_assess’.
steph (DOUBLE, optional) – Bin size for significant wave height. The default is 0.5.
stept (DOUBLE, optional) – Bin size for energy period. The default is 1.
display (BOOLEAN) – Graphic has to be displayed. Default to True
write (BOOLEAN) – Table has to be written. Default to True
- Return type:
None. Writes csv files or display table.
- resourcecode.resassess.bivar_stats(df: DataFrame, steph: float = 0.5, stept: float = 1) DataFrame #
Method to calculate bi-variate statistcs and average and standard deviation of energy flux binned in significant wave height and energy period bins.
Produces dataframes containing percentage occurrence, number occurrence, average energy flux and energy flux standard devaition for significant wave height vs energy period tables
- Parameters:
df (PANDAS DATAFRAME) – Dataframe containing input data
steph (DOUBLE, optional) – Bin size for significant wave height. The default is 0.5.
stept (DOUBLE, optional) – Bin size for energy period. The default is 1.
- Raises:
NameError – The input dataframe should contain the following columns: ‘hs’,’t0m1’ and ‘cge’
- Returns:
res – Dataframe with hs bins as index. The columns is a hierarchical index of statistics and te bins: [(“count”, “mean”, “stdev”, “percentage”), te_bins].
- Examples:
res.loc[4.4, (“mean”, 3.5)] returns the mean for the bin containing 4.4 for hs and 3.5 for te
res[“mean”] returns the datframe containing all the means
- Return type:
PANDAS DATAFRAME
- resourcecode.resassess.disp_table(df: DataFrame, title: str)#
Method to output tables - (courtesy of Chris Old, Edinburgh University) :param store: DESCRIPTION. :type store: TYPE :param mVarName: DESCRIPTION. :type mVarName: TYPE
- Return type:
None.
- resourcecode.resassess.display_univar_monstats(df: DataFrame, varnm: str)#
Method to display univariate statistics for any input variable. Used in resource assessment to produce deliverables as per IEC
The mehtod produces plots including monthly statistcs and yearly statistics for the input variable and monthly exceedance plots
Optionally, the statistics can also be written in a csv file
- Parameters:
df (PANDAS DATAFRAME) – Dataframe containing the data.
varnm (STRING) – Variable name as in dataframe column names
- Return type:
None
- resourcecode.resassess.exceed(df: DataFrame) Tuple[DataFrame, ndarray] #
Returns ranked data and exceedance probabilities
- Parameters:
df (PANDAS DATAFRAME) – Dataframe that contains either full data or subset (yearly or monthly) in a format consistent with RCODE data extraction
- Returns:
datasrt (PANDAS DATAFRAME) – Input dataframe sorted in ascending order
exceedance (NUMPY ARRAY) – Calculated exceedance probabilities for the ranked input data
- resourcecode.resassess.univar_monstats(df: DataFrame, varnm: str) Tuple[DataFrame, DataFrame, DataFrame] #
Method to calculate univariate statistics for any input variable. Used in resource assessment to produce deliverables as per IEC
The mehtod produces plots including monthly statistcs and yearly statistics for the input variable and monthly exceedance plots
- Parameters:
df (PANDAS DATAFRAME) – Dataframe containing the data.
varnm (STRING) – Variable name as in dataframe column names
display (BOOLEAN) – Graphic has to be displayed. Default to False
- Returns:
dte (PANDAS DATAFRAME) – Contains monthly exceedance for the chosen variable
dtm (PANDAS DATAFRAME) – Contains monthly statistics for the chosen variable.
dty (PANDAS DATAFRAME) – Contains yearly statistics for the chosen variable.