Fatigue API: Base class
Module defining API to retrieve/plot specific fatigue data from the owimetadatabase.
- class owimetadatabase_preprocessor.fatigue.io.FatigueAPI(api_root: str = 'https://owimetadatabase.owilab.be/api/v1', api_subdir: str = '/fatigue/userroutes/', token: str | None = None, uname: str | None = None, password: str | None = None, **kwargs)
Bases:
API
Class to connect to the fatigue data API with methods to retrieve data.
A number of methods are provided to query the database via the owimetadatabase API. For FatigueAPI the
get_*
methods return lists of custom objects storing/processing fatigue data. The methods are written such that a number of mandatory URL parameters are required (see documentation of the methods). The URL parameters can be expanded with Django-style additional filtering arguments (e.g.title__icontains="BBG01"
) as optional keyword arguments. Knowledge of the Django models is required for this (seeowimetadatabase
code).- __init__(api_root: str = 'https://owimetadatabase.owilab.be/api/v1', api_subdir: str = '/fatigue/userroutes/', token: str | None = None, uname: str | None = None, password: str | None = None, **kwargs) None
Constructor for the FatigueAPI class.
- Parameters:
api_root – Root URL for the API.
token – Token for the API.
uname – Username for the API.
password – Password for the API.
kwargs – Additional keyword arguments.
- Api_subdir:
Subdirectory for the API.
- get_sncurves(**kwargs) List[SNCurve]
Get all available SN curves requested by the user.
- Parameters:
kwargs – Any API filter, e.g. ‘title__icontains=NRTA1’
- Returns:
List of SNCurve objects representing SN curves
- get_fatiguedetails(**kwargs) List[FatigueDetail]
Get all fatigue details according to the specified search parameters (see kwargs).
- Parameters:
kwargs – Any API filter, e.g. ‘title__icontains’: ‘NW2F04_MP’ for a specific turbine and subassembly
- Returns:
List of FatigueDetail objects representing fatigue data for specified elements
- get_fatiguesubassembly(turbine: str, subassembly: str | None = None) List[FatigueSubAssembly]
Get all fatigue details for a given turbine/turbine subassembly.
- Parameters:
turbine – Turbine title (e.g. ‘BBC01’)
subassembly – Sub-assembly type (e.g. ‘MP’, ‘TW’, ‘TP’)
- Returns:
List of FatigueSubAssembly objects representing subassemblies
- fatiguedetails_df(turbines: str | List[str] | ndarray | None = None, projectsite_name: str | None = None) DataFrame
Return a dataframe with all fatigue details for given turbine(s).
- Parameters:
turbines – Turbine name(s)
projectsite_name – Name of the projectsite
- Returns:
Pandas DataFrame with all fatigue details for given turbine(s)
- fatiguedetails_animatedquickview(turbines: str | List[str] | ndarray | None = None, projectsite_name: str | None = None, showmudline: bool = True, show: bool = True) Dict[str, Figure | DataFrame]
Plot (animated) fatigue data information for given turbine(s).
- Parameters:
turbines – Turbine name(s)
projectsite_name – Name of the projectsite
showmudline – Whether to show mudline in the plot
show – Whether to show the plot
- Returns:
Dictionary with the fatigue data DataFrame and Plotly figure
- fatiguedetails_serializedquickview(turbines: str | List[str] | ndarray | None = None, projectsite_name: str | None = None, showmudline: bool = True, x_step: float = 10000.0, show: bool = True, marker_scaler: int = 6) Dict[str, Figure | DataFrame]
Plot (static) fatigue data information for given turbine(s).
- Parameters:
turbines – Turbine name(s)
projectsite_name – Name of the projectsite
showmudline – Whether to show mudline in the plot
x_step
show – Whether to show the figure
marker_scaler
- Returns:
Dictionary with the fatigue data DataFrame and Plotly figure