<commit_before>#!/usr/bin/env python3

"""This file is part of DINGO, the DIstribution Network GeneratOr.
DINGO is a tool to generate synthetic medium and low voltage power
distribution grids based on open data.

It is developed in the project open_eGo: https://openegoproject.wordpress.com

DINGO lives at github: https://github.com/openego/dingo/
The documentation is available on RTD: http://dingo.readthedocs.io"""

__copyright__  = "Reiner Lemoine Institut gGmbH"
__license__    = "GNU Affero General Public License Version 3 (AGPL-3.0)"
__url__        = "https://github.com/openego/dingo/blob/master/LICENSE"
__author__     = "nesnoj, gplssm"


# ===== IMPORTS AND CONFIGURATION =====

# import DB interface
from dingo.tools import db

# import required modules of DINGO
from dingo.core import NetworkDingo
from dingo.tools.logger import setup_logger
from dingo.tools.results import save_nd_to_pickle
import logging

# define logger
logger = setup_logger()

# ===== MAIN =====

# database connection
conn = db.connection(section='oedb')

# instantiate new dingo network object
nd = NetworkDingo(name='network')

# choose MV Grid Districts to import
mv_grid_districts = [3545]

# run DINGO on selected MV Grid District
nd.run_dingo(conn=conn,
             mv_grid_districts_no=mv_grid_districts)

# export grids to database
nd.control_circuit_breakers(mode='close')
# nd.export_mv_grid(conn, mv_grid_districts)
# nd.export_mv_grid_new(conn, mv_grid_districts)

conn.close()

# export grid to file (pickle)
save_nd_to_pickle(nd, filename='dingo_grids_example.pkl')<commit_msg>remove closing of circ. breakers in single grid example<commit_after>#!/usr/bin/env python3

"""This file is part of DINGO, the DIstribution Network GeneratOr.
DINGO is a tool to generate synthetic medium and low voltage power
distribution grids based on open data.

It is developed in the project open_eGo: https://openegoproject.wordpress.com

DINGO lives at github: https://github.com/openego/dingo/
The documentation is available on RTD: http://dingo.readthedocs.io"""

__copyright__  = "Reiner Lemoine Institut gGmbH"
__license__    = "GNU Affero General Public License Version 3 (AGPL-3.0)"
__url__        = "https://github.com/openego/dingo/blob/master/LICENSE"
__author__     = "nesnoj, gplssm"


# ===== IMPORTS AND CONFIGURATION =====

# import DB interface
from dingo.tools import db

# import required modules of DINGO
from dingo.core import NetworkDingo
from dingo.tools.logger import setup_logger
from dingo.tools.results import save_nd_to_pickle
import logging

# define logger
logger = setup_logger()

# ===== MAIN =====

# database connection
conn = db.connection(section='oedb')

# instantiate new dingo network object
nd = NetworkDingo(name='network')

# choose MV Grid Districts to import
mv_grid_districts = [3545]

# run DINGO on selected MV Grid District
nd.run_dingo(conn=conn,
             mv_grid_districts_no=mv_grid_districts)

# export grids to database
#nd.control_circuit_breakers(mode='close')
# nd.export_mv_grid(conn, mv_grid_districts)
# nd.export_mv_grid_new(conn, mv_grid_districts)

conn.close()

# export grid to file (pickle)
save_nd_to_pickle(nd, filename='dingo_grids_example.pkl')
{'fraction_non_alphanumeric': 0.09615985014049329, 'fraction_numerical': 0.004995316890415236, 'mean_word_length': 5.068181818181818, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3862051', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1049, 'n_words': 303}