_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q16500 | _get_trailing_whitespace | train | def _get_trailing_whitespace(marker, s):
"""Return the whitespace content trailing the given 'marker' in string 's',
up to and including a newline.
"""
suffix = ''
start = s.index(marker) + len(marker)
i = start
while i < len(s):
if s[i] in ' \t':
suffix += s[i]
e... | python | {
"resource": ""
} |
q16501 | RawCmdln.cmd | train | def cmd(self, argv):
"""Run one command and exit.
"argv" is the arglist for the command to run. argv[0] is the
command to run. If argv is an empty list then the
'emptyline' handler is run.
Returns the return value from the command handler.
"""
... | python | {
"resource": ""
} |
q16502 | RawCmdln.default | train | def default(self, argv):
"""Hook called to handle a command for which there is no handler.
"argv" is the command and arguments to run.
The default implementation writes an error message to stderr
and returns an error exit status.
Returns a numeric command exit status.
... | python | {
"resource": ""
} |
q16503 | RawCmdln.helpdefault | train | def helpdefault(self, cmd, known):
"""Hook called to handle help on a command for which there is no
help handler.
"cmd" is the command name on which help was requested.
"known" is a boolean indicating if this command is known
(i.e. if there is a handler for it).
... | python | {
"resource": ""
} |
q16504 | RawCmdln._help_reindent | train | def _help_reindent(self, help, indent=None):
"""Hook to re-indent help strings before writing to stdout.
"help" is the help content to re-indent
"indent" is a string with which to indent each line of the
help content after normalizing. If unspecified or None
... | python | {
"resource": ""
} |
q16505 | RawCmdln._help_preprocess | train | def _help_preprocess(self, help, cmdname):
"""Hook to preprocess a help string before writing to stdout.
"help" is the help string to process.
"cmdname" is the canonical sub-command name for which help
is being given, or None if the help is not specific to a
... | python | {
"resource": ""
} |
q16506 | RawCmdln._get_canonical_map | train | def _get_canonical_map(self):
"""Return a mapping of available command names and aliases to
their canonical command name.
"""
cacheattr = "_token2canonical"
if not hasattr(self, cacheattr):
# Get the list of commands and their aliases, if any.
token2canoni... | python | {
"resource": ""
} |
q16507 | _getRegisteredExecutable | train | def _getRegisteredExecutable(exeName):
"""Windows allow application paths to be registered in the registry."""
registered = None
if sys.platform.startswith('win'):
if os.path.splitext(exeName)[1].lower() != '.exe':
exeName += '.exe'
import _winreg
try:
key = "... | python | {
"resource": ""
} |
q16508 | whichall | train | def whichall(command, path=None, verbose=0, exts=None):
"""Return a list of full paths to all matches of the given command
on the path.
"command" is a the name of the executable to search for.
"path" is an optional alternate path list to search. The default it
to use the PATH environment vari... | python | {
"resource": ""
} |
q16509 | get_version | train | def get_version():
"""Get the python-manta version without having to import the manta package,
which requires deps to already be installed.
"""
_globals = {}
_locals = {}
exec(
compile(
open(TOP + "/manta/version.py").read(), TOP + "/manta/version.py",
'exec'), _g... | python | {
"resource": ""
} |
q16510 | fingerprint_from_ssh_pub_key | train | def fingerprint_from_ssh_pub_key(data):
"""Calculate the fingerprint of SSH public key data.
>>> data = "ssh-rsa AAAAB3NzaC1y...4IEAA1Z4wIWCuk8F9Tzw== my key comment"
>>> fingerprint_from_ssh_pub_key(data)
'54:c7:4c:93:cf:ff:e3:32:68:bc:89:6e:5e:22:b5:9c'
Adapted from <http://stackoverflow.com/que... | python | {
"resource": ""
} |
q16511 | agent_key_info_from_key_id | train | def agent_key_info_from_key_id(key_id):
"""Find a matching key in the ssh-agent.
@param key_id {str} Either a private ssh key fingerprint, e.g.
'b3:f0:a1:6c:18:3b:42:63:fd:6e:57:42:74:17:d4:bc', or the path to
an ssh private key file (like ssh's IdentityFile config option).
@return {dict} w... | python | {
"resource": ""
} |
q16512 | create_channel | train | def create_channel(
target: str,
options: Optional[List[Tuple[str, Any]]] = None,
interceptors: Optional[List[ClientInterceptor]] = None,
) -> grpc.Channel:
"""Creates a gRPC channel
The gRPC channel is created with the provided options and intercepts each
invocation via the provide... | python | {
"resource": ""
} |
q16513 | create_server | train | def create_server(
max_workers: int,
options: Optional[List[Tuple[str, Any]]] = None,
interceptors: Optional[List[grpc.ServerInterceptor]] = None,
) -> grpc.Server:
"""Creates a gRPC server
The gRPC server is created with the provided options and intercepts each
incoming RPCs via th... | python | {
"resource": ""
} |
q16514 | to_grpc_address | train | def to_grpc_address(target: str) -> str:
"""Converts a standard gRPC target to one that is supported by grpcio
:param target: the server address.
:returns: the converted address.
"""
u = urlparse(target)
if u.scheme == "dns":
raise ValueError("dns:// not supported")
if u.scheme ==... | python | {
"resource": ""
} |
q16515 | implement_switch_disconnector | train | def implement_switch_disconnector(mv_grid, node1, node2):
"""
Install switch disconnector in grid topology
The graph that represents the grid's topology is altered in such way that
it explicitly includes a switch disconnector.
The switch disconnector is always located at ``node1``. Technically, it
... | python | {
"resource": ""
} |
q16516 | select_cable | train | def select_cable(network, level, apparent_power):
"""Selects an appropriate cable type and quantity using given apparent
power.
Considers load factor.
Parameters
----------
network : :class:`~.grid.network.Network`
The eDisGo container object
level : :obj:`str`
Grid level (... | python | {
"resource": ""
} |
q16517 | get_gen_info | train | def get_gen_info(network, level='mvlv', fluctuating=False):
"""
Gets all the installed generators with some additional information.
Parameters
----------
network : :class:`~.grid.network.Network`
Network object holding the grid data.
level : :obj:`str`
Defines which generators a... | python | {
"resource": ""
} |
q16518 | assign_mv_feeder_to_nodes | train | def assign_mv_feeder_to_nodes(mv_grid):
"""
Assigns an MV feeder to every generator, LV station, load, and branch tee
Parameters
-----------
mv_grid : :class:`~.grid.grids.MVGrid`
"""
mv_station_neighbors = mv_grid.graph.neighbors(mv_grid.station)
# get all nodes in MV grid and remove ... | python | {
"resource": ""
} |
q16519 | get_mv_feeder_from_line | train | def get_mv_feeder_from_line(line):
"""
Determines MV feeder the given line is in.
MV feeders are identified by the first line segment of the half-ring.
Parameters
----------
line : :class:`~.grid.components.Line`
Line to find the MV feeder for.
Returns
-------
:class:`~.gr... | python | {
"resource": ""
} |
q16520 | disconnect_storage | train | def disconnect_storage(network, storage):
"""
Removes storage from network graph and pypsa representation.
Parameters
-----------
network : :class:`~.grid.network.Network`
storage : :class:`~.grid.components.Storage`
Storage instance to be removed.
"""
# does only remove from n... | python | {
"resource": ""
} |
q16521 | Grid.weather_cells | train | def weather_cells(self):
"""
Weather cells contained in grid
Returns
-------
list
list of weather cell ids contained in grid
"""
if not self._weather_cells:
# get all the weather cell ids
self._weather_cells = []
f... | python | {
"resource": ""
} |
q16522 | Grid.peak_generation | train | def peak_generation(self):
"""
Cumulative peak generation capacity of generators of this grid
Returns
-------
float
Ad-hoc calculated or cached peak generation capacity
"""
if self._peak_generation is None:
self._peak_generation = sum(
... | python | {
"resource": ""
} |
q16523 | Grid.peak_generation_per_technology | train | def peak_generation_per_technology(self):
"""
Peak generation of each technology in the grid
Returns
-------
:pandas:`pandas.Series<series>`
Peak generation index by technology
"""
peak_generation = defaultdict(float)
for gen in self.generator... | python | {
"resource": ""
} |
q16524 | Grid.peak_generation_per_technology_and_weather_cell | train | def peak_generation_per_technology_and_weather_cell(self):
"""
Peak generation of each technology and the
corresponding weather cell in the grid
Returns
-------
:pandas:`pandas.Series<series>`
Peak generation index by technology
"""
peak_gen... | python | {
"resource": ""
} |
q16525 | Grid.peak_load | train | def peak_load(self):
"""
Cumulative peak load capacity of generators of this grid
Returns
-------
float
Ad-hoc calculated or cached peak load capacity
"""
if self._peak_load is None:
self._peak_load = sum(
[_.peak_load.sum(... | python | {
"resource": ""
} |
q16526 | Grid.consumption | train | def consumption(self):
"""
Consumption in kWh per sector for whole grid
Returns
-------
:pandas:`pandas.Series<series>`
Indexed by demand sector
"""
consumption = defaultdict(float)
for load in self.graph.nodes_by_attribute('load'):
... | python | {
"resource": ""
} |
q16527 | Grid.generators | train | def generators(self):
"""
Connected Generators within the grid
Returns
-------
list
List of Generator Objects
"""
if not self._generators:
generators = list(self.graph.nodes_by_attribute('generator'))
generators.extend(list(se... | python | {
"resource": ""
} |
q16528 | MVGrid.draw | train | def draw(self):
""" Draw MV grid's graph using the geo data of nodes
Notes
-----
This method uses the coordinates stored in the nodes' geoms which
are usually conformal, not equidistant. Therefore, the plot might
be distorted and does not (fully) reflect the real positio... | python | {
"resource": ""
} |
q16529 | Graph.nodes_from_line | train | def nodes_from_line(self, line):
"""
Get nodes adjacent to line
Here, line refers to the object behind the key 'line' of the attribute
dict attached to each edge.
Parameters
----------
line: edisgo.grid.components.Line
A eDisGo line object
R... | python | {
"resource": ""
} |
q16530 | Graph.line_from_nodes | train | def line_from_nodes(self, u, v):
"""
Get line between two nodes ``u`` and ``v``.
Parameters
----------
u : :class:`~.grid.components.Component`
One adjacent node
v : :class:`~.grid.components.Component`
The other adjacent node
Returns
... | python | {
"resource": ""
} |
q16531 | Graph.nodes_by_attribute | train | def nodes_by_attribute(self, attr_val, attr='type'):
"""
Select Graph's nodes by attribute value
Get all nodes that share the same attribute. By default, the attr 'type'
is used to specify the nodes type (generator, load, etc.).
Examples
--------
>>> import edis... | python | {
"resource": ""
} |
q16532 | Graph.lines_by_attribute | train | def lines_by_attribute(self, attr_val=None, attr='type'):
""" Returns a generator for iterating over Graph's lines by attribute value.
Get all lines that share the same attribute. By default, the attr 'type'
is used to specify the lines' type (line, agg_line, etc.).
The edge of a graph... | python | {
"resource": ""
} |
q16533 | ServerInterceptorWrapper.intercept_service | train | def intercept_service(self, continuation, handler_call_details):
"""Intercepts incoming RPCs before handing them over to a handler
See `grpc.ServerInterceptor.intercept_service`.
"""
rpc_method_handler = self._get_rpc_handler(handler_call_details)
if rpc_method_handler.response... | python | {
"resource": ""
} |
q16534 | combine_mv_and_lv | train | def combine_mv_and_lv(mv, lv):
"""Combine MV and LV grid topology in PyPSA format
"""
combined = {
c: pd.concat([mv[c], lv[c]], axis=0) for c in list(lv.keys())
}
combined['Transformer'] = mv['Transformer']
return combined | python | {
"resource": ""
} |
q16535 | add_aggregated_lv_components | train | def add_aggregated_lv_components(network, components):
"""
Aggregates LV load and generation at LV stations
Use this function if you aim for MV calculation only. The according
DataFrames of `components` are extended by load and generators representing
these aggregated respecting the technology type... | python | {
"resource": ""
} |
q16536 | _pypsa_bus_timeseries | train | def _pypsa_bus_timeseries(network, buses, timesteps):
"""
Time series in PyPSA compatible format for bus instances
Set all buses except for the slack bus to voltage of 1 pu (it is assumed
this setting is entirely ignored during solving the power flow problem).
This slack bus is set to an operationa... | python | {
"resource": ""
} |
q16537 | _pypsa_generator_timeseries_aggregated_at_lv_station | train | def _pypsa_generator_timeseries_aggregated_at_lv_station(network, timesteps):
"""
Aggregates generator time series per generator subtype and LV grid.
Parameters
----------
network : Network
The eDisGo grid topology model overall container
timesteps : array_like
Timesteps is an a... | python | {
"resource": ""
} |
q16538 | _pypsa_load_timeseries_aggregated_at_lv_station | train | def _pypsa_load_timeseries_aggregated_at_lv_station(network, timesteps):
"""
Aggregates load time series per sector and LV grid.
Parameters
----------
network : Network
The eDisGo grid topology model overall container
timesteps : array_like
Timesteps is an array-like object with... | python | {
"resource": ""
} |
q16539 | update_pypsa_timeseries | train | def update_pypsa_timeseries(network, loads_to_update=None,
generators_to_update=None, storages_to_update=None,
timesteps=None):
"""
Updates load, generator, storage and bus time series in pypsa network.
See functions :func:`update_pypsa_load_timeserie... | python | {
"resource": ""
} |
q16540 | update_pypsa_load_timeseries | train | def update_pypsa_load_timeseries(network, loads_to_update=None,
timesteps=None):
"""
Updates load time series in pypsa representation.
This function overwrites p_set and q_set of loads_t attribute of
pypsa network.
Be aware that if you call this function with `times... | python | {
"resource": ""
} |
q16541 | update_pypsa_generator_timeseries | train | def update_pypsa_generator_timeseries(network, generators_to_update=None,
timesteps=None):
"""
Updates generator time series in pypsa representation.
This function overwrites p_set and q_set of generators_t attribute of
pypsa network.
Be aware that if you call ... | python | {
"resource": ""
} |
q16542 | update_pypsa_storage_timeseries | train | def update_pypsa_storage_timeseries(network, storages_to_update=None,
timesteps=None):
"""
Updates storage time series in pypsa representation.
This function overwrites p_set and q_set of storage_unit_t attribute of
pypsa network.
Be aware that if you call this f... | python | {
"resource": ""
} |
q16543 | update_pypsa_bus_timeseries | train | def update_pypsa_bus_timeseries(network, timesteps=None):
"""
Updates buses voltage time series in pypsa representation.
This function overwrites v_mag_pu_set of buses_t attribute of
pypsa network.
Be aware that if you call this function with `timesteps` and thus overwrite
current time steps it... | python | {
"resource": ""
} |
q16544 | _update_pypsa_timeseries_by_type | train | def _update_pypsa_timeseries_by_type(network, type, components_to_update=None,
timesteps=None):
"""
Updates time series of specified component in pypsa representation.
Be aware that if you call this function with `timesteps` and thus overwrite
current time steps it ... | python | {
"resource": ""
} |
q16545 | fifty_fifty | train | def fifty_fifty(network, storage, feedin_threshold=0.5):
"""
Operational mode where the storage operation depends on actual power by
generators. If cumulative generation exceeds 50% of nominal power, the
storage is charged. Otherwise, the storage is discharged.
The time series for active power is wr... | python | {
"resource": ""
} |
q16546 | connect_mv_generators | train | def connect_mv_generators(network):
"""Connect MV generators to existing grids.
This function searches for unconnected generators in MV grids and connects them.
It connects
* generators of voltage level 4
* to HV-MV station
* generators of voltage level 5
* with a... | python | {
"resource": ""
} |
q16547 | _add_cable_to_equipment_changes | train | def _add_cable_to_equipment_changes(network, line):
"""Add cable to the equipment changes
All changes of equipment are stored in network.results.equipment_changes
which is used later to determine grid expansion costs.
Parameters
----------
network : :class:`~.grid.network.Network`
The ... | python | {
"resource": ""
} |
q16548 | _del_cable_from_equipment_changes | train | def _del_cable_from_equipment_changes(network, line):
"""Delete cable from the equipment changes if existing
This is needed if a cable was already added to network.results.equipment_changes
but another node is connected later to this cable. Therefore, the cable needs to
be split which changes the id (o... | python | {
"resource": ""
} |
q16549 | _find_nearest_conn_objects | train | def _find_nearest_conn_objects(network, node, branches):
"""Searches all branches for the nearest possible connection object per branch
It picks out 1 object out of 3 possible objects: 2 branch-adjacent stations
and 1 potentially created branch tee on the line (using perpendicular projection).
The resu... | python | {
"resource": ""
} |
q16550 | _get_griddistrict | train | def _get_griddistrict(ding0_filepath):
"""
Just get the grid district number from ding0 data file path
Parameters
----------
ding0_filepath : str
Path to ding0 data ending typically
`/path/to/ding0_data/"ding0_grids__" + str(``grid_district``) + ".xxx"`
Returns
-------
i... | python | {
"resource": ""
} |
q16551 | run_edisgo_basic | train | def run_edisgo_basic(ding0_filepath,
generator_scenario=None,
analysis='worst-case',
*edisgo_grid):
"""
Analyze edisgo grid extension cost as reference scenario
Parameters
----------
ding0_filepath : str
Path to ding0 data endin... | python | {
"resource": ""
} |
q16552 | _attach_aggregated | train | def _attach_aggregated(network, grid, aggregated, ding0_grid):
"""Add Generators and Loads to MV station representing aggregated generation
capacity and load
Parameters
----------
grid: MVGrid
MV grid object
aggregated: dict
Information about aggregated load and generation capac... | python | {
"resource": ""
} |
q16553 | _validate_ding0_grid_import | train | def _validate_ding0_grid_import(mv_grid, ding0_mv_grid, lv_grid_mapping):
"""Cross-check imported data with original data source
Parameters
----------
mv_grid: MVGrid
eDisGo MV grid instance
ding0_mv_grid: MVGridDing0
Ding0 MV grid instance
lv_grid_mapping: dict
Translat... | python | {
"resource": ""
} |
q16554 | import_generators | train | def import_generators(network, data_source=None, file=None):
"""Import generator data from source.
The generator data include
* nom. capacity
* type ToDo: specify!
* timeseries
Additional data which can be processed (e.g. used in OEDB data) are
* location
* type... | python | {
"resource": ""
} |
q16555 | _build_generator_list | train | def _build_generator_list(network):
"""Builds DataFrames with all generators in MV and LV grids
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
A DataFrame with id of and reference to MV generators
:pandas:`pandas.DataFrame<dataframe>`
A DataFrame with id of and refere... | python | {
"resource": ""
} |
q16556 | _build_lv_grid_dict | train | def _build_lv_grid_dict(network):
"""Creates dict of LV grids
LV grid ids are used as keys, LV grid references as values.
Parameters
----------
network: :class:`~.grid.network.Network`
The eDisGo container object
Returns
-------
:obj:`dict`
Format: {:obj:`int`: :class:... | python | {
"resource": ""
} |
q16557 | import_feedin_timeseries | train | def import_feedin_timeseries(config_data, weather_cell_ids):
"""
Import RES feed-in time series data and process
Parameters
----------
config_data : dict
Dictionary containing config data from config files.
weather_cell_ids : :obj:`list`
List of weather cell id's (integers) to o... | python | {
"resource": ""
} |
q16558 | import_load_timeseries | train | def import_load_timeseries(config_data, data_source, mv_grid_id=None,
year=None):
"""
Import load time series
Parameters
----------
config_data : dict
Dictionary containing config data from config files.
data_source : str
Specify type of data source. A... | python | {
"resource": ""
} |
q16559 | feedin_proportional | train | def feedin_proportional(feedin, generators, curtailment_timeseries, edisgo,
curtailment_key, **kwargs):
"""
Implements curtailment methodology 'feedin-proportional'.
The curtailment that has to be met in each time step is allocated
equally to all generators depending on their sh... | python | {
"resource": ""
} |
q16560 | _check_curtailment_target | train | def _check_curtailment_target(curtailment, curtailment_target,
curtailment_key):
"""
Raises an error if curtailment target was not met in any time step.
Parameters
-----------
curtailment : :pandas:`pandas:DataFrame<dataframe>`
Dataframe containing the curtailm... | python | {
"resource": ""
} |
q16561 | _assign_curtailment | train | def _assign_curtailment(curtailment, edisgo, generators, curtailment_key):
"""
Helper function to write curtailment time series to generator objects.
This function also writes a list of the curtailed generators to curtailment
in :class:`edisgo.grid.network.TimeSeries` and
:class:`edisgo.grid.networ... | python | {
"resource": ""
} |
q16562 | add_basemap | train | def add_basemap(ax, zoom=12):
"""
Adds map to a plot.
"""
url = ctx.sources.ST_TONER_LITE
xmin, xmax, ymin, ymax = ax.axis()
basemap, extent = ctx.bounds2img(xmin, ymin, xmax, ymax,
zoom=zoom, url=url)
ax.imshow(basemap, extent=extent, interpolati... | python | {
"resource": ""
} |
q16563 | get_grid_district_polygon | train | def get_grid_district_polygon(config, subst_id=None, projection=4326):
"""
Get MV grid district polygon from oedb for plotting.
"""
# make DB session
conn = connection(section=config['db_connection']['section'])
Session = sessionmaker(bind=conn)
session = Session()
# get polygon from ... | python | {
"resource": ""
} |
q16564 | Load.timeseries | train | def timeseries(self):
"""
Load time series
It returns the actual time series used in power flow analysis. If
:attr:`_timeseries` is not :obj:`None`, it is returned. Otherwise,
:meth:`timeseries()` looks for time series of the according sector in
:class:`~.grid.network.Ti... | python | {
"resource": ""
} |
q16565 | Load.peak_load | train | def peak_load(self):
"""
Get sectoral peak load
"""
peak_load = pd.Series(self.consumption).mul(pd.Series(
self.grid.network.config['peakload_consumption_ratio']).astype(
float), fill_value=0)
return peak_load | python | {
"resource": ""
} |
q16566 | Load.power_factor | train | def power_factor(self):
"""
Power factor of load
Parameters
-----------
power_factor : :obj:`float`
Ratio of real power to apparent power.
Returns
--------
:obj:`float`
Ratio of real power to apparent power. If power factor is not... | python | {
"resource": ""
} |
q16567 | Load.reactive_power_mode | train | def reactive_power_mode(self):
"""
Power factor mode of Load.
This information is necessary to make the load behave in an inductive
or capacitive manner. Essentially this changes the sign of the reactive
power.
The convention used here in a load is that:
- when ... | python | {
"resource": ""
} |
q16568 | Storage.timeseries | train | def timeseries(self):
"""
Time series of storage operation
Parameters
----------
ts : :pandas:`pandas.DataFrame<dataframe>`
DataFrame containing active power the storage is charged (negative)
and discharged (positive) with (on the grid side) in kW in colu... | python | {
"resource": ""
} |
q16569 | MVDisconnectingPoint.open | train | def open(self):
"""Toggle state to open switch disconnector"""
if self._state != 'open':
if self._line is not None:
self._state = 'open'
self._nodes = self.grid.graph.nodes_from_line(self._line)
self.grid.graph.remove_edge(
... | python | {
"resource": ""
} |
q16570 | MVDisconnectingPoint.close | train | def close(self):
"""Toggle state to closed switch disconnector"""
self._state = 'closed'
self.grid.graph.add_edge(
self._nodes[0], self._nodes[1], {'line': self._line}) | python | {
"resource": ""
} |
q16571 | wrap_context | train | def wrap_context(func):
"""Wraps the provided servicer method by passing a wrapped context
The context is wrapped using `lookout.sdk.grpc.log_fields.LogFieldsContext`.
:param func: the servicer method to wrap_context
:returns: the wrapped servicer method
"""
@functools.wraps(func)
def wra... | python | {
"resource": ""
} |
q16572 | LogFieldsContext.pack_metadata | train | def pack_metadata(self) -> List[Tuple[str, Any]]:
"""Packs the log fields and the invocation metadata into a new metadata
The log fields are added in the new metadata with the key
`LOG_FIELDS_KEY_META`.
"""
metadata = [(k, v) for k, v in self._invocation_metadata.items()
... | python | {
"resource": ""
} |
q16573 | LogFields.from_metadata | train | def from_metadata(cls, metadata: Dict[str, Any]) -> 'LogFields':
"""Initialize the log fields from the provided metadata
The log fields are taken from the `LOG_FIELDS_KEY_META` key of the
provided metadata.
"""
return cls(fields=json.loads(metadata.get(LOG_FIELDS_KEY_META, '{}'... | python | {
"resource": ""
} |
q16574 | EDisGoReimport.plot_mv_voltages | train | def plot_mv_voltages(self, **kwargs):
"""
Plots voltages in MV grid on grid topology plot.
For more information see :func:`edisgo.tools.plots.mv_grid_topology`.
"""
if self.network.pypsa is not None:
try:
v_res = self.network.results.v_res()
... | python | {
"resource": ""
} |
q16575 | EDisGoReimport.plot_mv_grid_expansion_costs | train | def plot_mv_grid_expansion_costs(self, **kwargs):
"""
Plots costs per MV line.
For more information see :func:`edisgo.tools.plots.mv_grid_topology`.
"""
if self.network.pypsa is not None and \
self.network.results.grid_expansion_costs is not None:
if... | python | {
"resource": ""
} |
q16576 | EDisGoReimport.plot_mv_storage_integration | train | def plot_mv_storage_integration(self, **kwargs):
"""
Plots storage position in MV grid of integrated storages.
For more information see :func:`edisgo.tools.plots.mv_grid_topology`.
"""
if self.network.pypsa is not None:
plots.mv_grid_topology(
self.n... | python | {
"resource": ""
} |
q16577 | EDisGoReimport.histogram_voltage | train | def histogram_voltage(self, timestep=None, title=True, **kwargs):
"""
Plots histogram of voltages.
For more information see :func:`edisgo.tools.plots.histogram`.
Parameters
----------
timestep : :pandas:`pandas.Timestamp<timestamp>` or None, optional
Specifi... | python | {
"resource": ""
} |
q16578 | EDisGoReimport.histogram_relative_line_load | train | def histogram_relative_line_load(self, timestep=None, title=True,
voltage_level='mv_lv', **kwargs):
"""
Plots histogram of relative line loads.
For more information see :func:`edisgo.tools.plots.histogram`.
Parameters
----------
Para... | python | {
"resource": ""
} |
q16579 | EDisGo.curtail | train | def curtail(self, methodology, curtailment_timeseries, **kwargs):
"""
Sets up curtailment time series.
Curtailment time series are written into
:class:`~.grid.network.TimeSeries`. See
:class:`~.grid.network.CurtailmentControl` for more information on
parameters and metho... | python | {
"resource": ""
} |
q16580 | EDisGo.import_from_ding0 | train | def import_from_ding0(self, file, **kwargs):
"""Import grid data from DINGO file
For details see
:func:`edisgo.data.import_data.import_from_ding0`
"""
import_from_ding0(file=file, network=self.network) | python | {
"resource": ""
} |
q16581 | EDisGo.reinforce | train | def reinforce(self, **kwargs):
"""
Reinforces the grid and calculates grid expansion costs.
See :meth:`edisgo.flex_opt.reinforce_grid` for more information.
"""
results = reinforce_grid(
self, max_while_iterations=kwargs.get(
'max_while_iterations', ... | python | {
"resource": ""
} |
q16582 | EDisGo.integrate_storage | train | def integrate_storage(self, timeseries, position, **kwargs):
"""
Integrates storage into grid.
See :class:`~.grid.network.StorageControl` for more information.
"""
StorageControl(edisgo=self, timeseries=timeseries,
position=position, **kwargs) | python | {
"resource": ""
} |
q16583 | Network._load_equipment_data | train | def _load_equipment_data(self):
"""Load equipment data for transformers, cables etc.
Returns
-------
:obj:`dict` of :pandas:`pandas.DataFrame<dataframe>`
"""
package_path = edisgo.__path__[0]
equipment_dir = self.config['system_dirs']['equipment_dir']
... | python | {
"resource": ""
} |
q16584 | Config._load_config | train | def _load_config(config_path=None):
"""
Load config files.
Parameters
-----------
config_path : None or :obj:`str` or dict
See class definition for more information.
Returns
-------
:obj:`collections.OrderedDict`
eDisGo configurat... | python | {
"resource": ""
} |
q16585 | TimeSeriesControl._check_timeindex | train | def _check_timeindex(self):
"""
Check function to check if all feed-in and load time series contain
values for the specified time index.
"""
try:
self.timeseries.generation_fluctuating
self.timeseries.generation_dispatchable
self.timeseries.lo... | python | {
"resource": ""
} |
q16586 | TimeSeriesControl._worst_case_generation | train | def _worst_case_generation(self, worst_case_scale_factors, modes):
"""
Define worst case generation time series for fluctuating and
dispatchable generators.
Parameters
----------
worst_case_scale_factors : dict
Scale factors defined in config file 'config_tim... | python | {
"resource": ""
} |
q16587 | TimeSeriesControl._worst_case_load | train | def _worst_case_load(self, worst_case_scale_factors,
peakload_consumption_ratio, modes):
"""
Define worst case load time series for each sector.
Parameters
----------
worst_case_scale_factors : dict
Scale factors defined in config file 'confi... | python | {
"resource": ""
} |
q16588 | CurtailmentControl._check_timeindex | train | def _check_timeindex(self, curtailment_timeseries, network):
"""
Raises an error if time index of curtailment time series does not
comply with the time index of load and feed-in time series.
Parameters
-----------
curtailment_timeseries : :pandas:`pandas.Series<series>` ... | python | {
"resource": ""
} |
q16589 | CurtailmentControl._precheck | train | def _precheck(self, curtailment_timeseries, feedin_df, curtailment_key):
"""
Raises an error if the curtailment at any time step exceeds the
total feed-in of all generators curtailment can be distributed among
at that time.
Parameters
-----------
curtailment_time... | python | {
"resource": ""
} |
q16590 | CurtailmentControl._postcheck | train | def _postcheck(self, network, feedin):
"""
Raises an error if the curtailment of a generator exceeds the
feed-in of that generator at any time step.
Parameters
-----------
network : :class:`~.grid.network.Network`
feedin : :pandas:`pandas.DataFrame<dataframe>`
... | python | {
"resource": ""
} |
q16591 | StorageControl._integrate_storage | train | def _integrate_storage(self, timeseries, position, params, voltage_level,
reactive_power_timeseries, **kwargs):
"""
Integrate storage units in the grid.
Parameters
----------
timeseries : :obj:`str` or :pandas:`pandas.Series<series>`
Parame... | python | {
"resource": ""
} |
q16592 | StorageControl._check_nominal_power | train | def _check_nominal_power(self, storage_parameters, timeseries):
"""
Tries to assign a nominal power to the storage.
Checks if nominal power is provided through `storage_parameters`,
otherwise tries to return the absolute maximum of `timeseries`. Raises
an error if it cannot assi... | python | {
"resource": ""
} |
q16593 | StorageControl._check_timeindex | train | def _check_timeindex(self, timeseries):
"""
Raises an error if time index of storage time series does not
comply with the time index of load and feed-in time series.
Parameters
-----------
timeseries : :pandas:`pandas.DataFrame<dataframe>`
DataFrame containin... | python | {
"resource": ""
} |
q16594 | Results.curtailment | train | def curtailment(self):
"""
Holds curtailment assigned to each generator per curtailment target.
Returns
-------
:obj:`dict` with :pandas:`pandas.DataFrame<dataframe>`
Keys of the dictionary are generator types (and weather cell ID)
curtailment targets wer... | python | {
"resource": ""
} |
q16595 | Results.storages | train | def storages(self):
"""
Gathers relevant storage results.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing all storages installed in the MV grid and
LV grids. Index of the dataframe are the storage representatives,
c... | python | {
"resource": ""
} |
q16596 | Results.storages_timeseries | train | def storages_timeseries(self):
"""
Returns a dataframe with storage time series.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing time series of all storages installed in the
MV grid and LV grids. Index of the dataframe is a
... | python | {
"resource": ""
} |
q16597 | ResultsReimport.v_res | train | def v_res(self, nodes=None, level=None):
"""
Get resulting voltage level at node.
Parameters
----------
nodes : :obj:`list`
List of string representatives of grid topology components, e.g.
:class:`~.grid.components.Generator`. If not provided defaults to
... | python | {
"resource": ""
} |
q16598 | set_up_storage | train | def set_up_storage(node, parameters,
voltage_level=None, operational_mode=None):
"""
Sets up a storage instance.
Parameters
----------
node : :class:`~.grid.components.Station` or :class:`~.grid.components.BranchTee`
Node the storage will be connected to.
parameters :... | python | {
"resource": ""
} |
q16599 | connect_storage | train | def connect_storage(storage, node):
"""
Connects storage to the given node.
The storage is connected by a cable
The cable the storage is connected with is selected to be able to carry
the storages nominal power and equal amount of reactive power.
No load factor is considered.
Parameters
... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.