optiwindnet.importer

Module Contents

optiwindnet.importer.L_from_yaml(filepath: pathlib.Path | str, handle: str | None = None) networkx.Graph[source]

Import wind farm data from .yaml file.

Two options available for COORDINATE_FORMAT: “planar” and “latlon”.

Format “planar” is: [tag] easting northing. Example:

TAG 234.2 5212.5

Format “latlon” is: [tag] latitude longitude. Example:

TAG1 11°22.333'N 44°55.666'E
TAG2 11.3563°N 44.8903°E
TAG3 11°22'20"N 44°55'40"E

The [tag] is optional. Ensure no spaces within a latitude or longitude.

The coordinate pair may be separated by “,” or “;” and may be enclosed in “[]” or “()”. Example:

TAG [234.2, 5212.5]
Parameters:
  • filepath – path to .yaml file to read.

  • handle – Short moniker for the site.

Returns:

Unconnected location graph L.

optiwindnet.importer.L_from_pbf(filepath: pathlib.Path | str, handle: str | None = None) networkx.Graph[source]

Import wind farm data from .osm.pbf file.

Parameters:
  • filepath – path to .osm.pbf file to read.

  • handle – Short moniker for the site.

Returns:

Unconnected location graph L.

optiwindnet.importer.load_repository(path: pathlib.Path | str | None = None) tuple[networkx.Graph, Ellipsis][source]

Load locations from files of known formats into a namedtuple.

Each file (.yaml or .osm.pbf) is translated into a location graph and included as an attribute in the returned namedtuple. The attribute name can be specified in the .yaml with the field HANDLE or in the .osm.pbf file with the tag handle applied to the power plant object.

Parameters:

path – Path to look for location files (non-recursive). If omited, the locations included in optiwindnet are loaded.

Returns:

Named tuple which has the location handles as attribute identifiers.