Geometry API: Base class

Module to connect to the database API to retrieve and operate on geometry data.

class owimetadatabase_preprocessor.geometry.io.GeometryAPI(api_subdir: str = '/geometry/userroutes/', **kwargs)

Bases: API

Class to connect to the geometry data API with methods to retrieve data.

__init__(api_subdir: str = '/geometry/userroutes/', **kwargs) None

Create an instance of the GeometryAPI class with the required parameters.

Parameters:
  • api_subdir – Optional: subdirectory of the API endpooint url for specific type of data.

  • kwargs – Additional parameters to pass to the API (see the base class).

Returns:

None

get_model_definitions(projectsite: str | None = None) Dict[str, DataFrame | bool | int64 | None]

Get all relevant model definitions.

Parameters:

projectsite – Optional: Title of the projectsite.

Returns:

Dictionary with the following keys:

  • ”data”: Pandas dataframe with the model definitions

  • ”exists”: Boolean indicating whether matching records are found

get_modeldefinition_id(assetlocation: str | None = None, projectsite: str | None = None, model_definition: str | None = None) Dict[str, int | int64 | bool | None]

Get the ID of a model definition. Either the asset location or the project site must be specified.

Parameters:
  • assetlocation – Optional: Title of the asset location.

  • projectsite – Optional: Title of the projectsite.

  • model_definition – Optional: Title of the model definition.

Returns:

Dictionary with the following keys:

  • ”id”: ID of the specified model definition

  • ”multiple_modeldef”: Boolean indicating whether there are multiple model definitions

    for the asset location in general

get_subassemblies(projectsite: str | None = None, assetlocation: str | None = None, subassembly_type: str | None = None, model_definition: str | None = None) Dict[str, DataFrame | bool | int64 | None]

Get all relevant structure subassemblies. If you specify a model definition, you also must specify either the projectsite or the asset location.

Parameters:
  • projectsite – Optional: Title of the projectsite.

  • assetlocation – Optional: Title of the asset location.

  • subassembly_type – Optional: Type of the subassembly.

  • model_definition – Optional: Title of the model definition.

Returns:

Dictionary with the following keys:

  • ”data”: Pandas dataframe with the location data for each project

  • ”exists”: Boolean indicating whether matching records are found

get_buildingblocks(projectsite: str | None = None, assetlocation: str | None = None, subassembly_type: str | None = None, subassembly_id: int | int64 | None = None) Dict[str, DataFrame | bool | int64 | None]

Get all relevant building blocks.

Parameters:
  • projectsite – Optional: Title of the projectsite.

  • assetlocation – Optional: Title of the asset location.

  • subassembly_type – Optional: Type of the subassemblies (e.g. ‘MP’, ‘TW’, ‘TP’).

  • subassembly_id – Optional: ID of the subassembly.

Returns:

Dictionary with the following keys:

  • ”data”: Pandas dataframe with the location data for each project

  • ”exists”: Boolean indicating whether matching records are found

get_materials() Dict[str, DataFrame | bool | int64 | None]

Get all the materials of building blocks.

Returns:

Dictionary with the following keys:

  • ”data”: Pandas dataframe with the location data for each project

  • ”exists”: Boolean indicating whether matching records are found

get_subassembly_objects(turbine: str, subassembly: str | None = None, model_definition_id: int | int64 | None = None) Dict[str, SubAssembly]

Get all subassemblies for a given turbine, divided by type.

Parameters:
  • turbine – Turbine title

  • subassembly – Sub-assembly type (e.g. ‘MP’, ‘TW’, ‘TP’)

  • model_definition_id – ID of the model definition to filter the subassemblies.

Returns:

Dictionary with the following keys:

  • ”TW”: SubAssembly object for the tower

  • ”TP”: SubAssembly object for the transition piece

  • ”MP”: SubAssembly object for the monopile

get_owt_geometry_processor(turbines: str | List[str], model_definition: str | None = None, tower_base: float | List[float] | None = None, monopile_head: float | List[float] | None = None) OWTs

Return the required processing class. Will return data even if some turbines have issues given that at least one is fully OK.

Parameters:
  • turbines – Title(s) of the turbines.

  • model_definition – Optional: Title of the model definition.

  • tower_base – Optional: Height(s) of the tower base.

  • monopile_head – Optional: Height(s) of the monopile head.

Returns:

OWTs object: containing information about all the requested turbines.

get_monopile_pyles(projectsite, assetlocation, cutoff_point=nan, model_definition: str | None = None)

Returns a dataframe with the monopile geometry with the mudline as reference

Parameters:
  • projectsite – Name of the project site

  • assetlocation – Name of the wind turbine location

  • cutoff_point – Elevation of the load application point in (mLAT) above the mudline

  • model_definition – Optional: Title of the model definition.

Returns:

DataFrame with the monopile geometry.

plot_turbines(turbines: List[str] | str, figures_per_line: int = 5, return_fig: bool = False, model_definition: str | None = None) Figure | None

Plot turbines’ frontal geometry.

Parameters:
  • turbines – Title(s) of the turbines.

  • figures_per_line – Number of figures per line.

  • return_fig – Boolean indicating whether to return the figure.

  • model_definition – Optional: Title of the model definition.

Returns:

Plotly figure object with selected turbines front profiles (if requested) or nothing.