Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
gplessm committed May 15, 2018
2 parents eaaa5fe + d33d677 commit 2892e11
Show file tree
Hide file tree
Showing 63 changed files with 2,641 additions and 1,510 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pip3 install ding0
```

Further details regarding the installation including dependencies are provided
in the [documentation](https://ding0.readthedocs.io)
in the [documentation](https://dingo.readthedocs.io)

A [set of examples](https://ding0.readthedocs.io/en/dev/usage_details.html#examples)
is provided to show how to use Ding0.
Expand Down
15 changes: 13 additions & 2 deletions ding0/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@


# TODO: (Maybe) move to more general place (ego.io repo)
# TODO: check docstring
def adapt_numpy_int64(numpy_int64):
""" Adapting numpy.int64 type to SQL-conform int type using psycopg extension, see [1]_ for more info.
""" Adapting numpy.int64 type to SQL-conform int type using psycopg extension, see [#]_ for more info.
Parameters
----------
numpy_int64 : int
numpty 64bits integer.
Returns
-------
type
#TODO: Description of return. Change type in the previous line accordingly
References
----------
.. [1] http://initd.org/psycopg/docs/advanced.html#adapting-new-python-types-to-sql-syntax
.. [#] http://initd.org/psycopg/docs/advanced.html#adapting-new-python-types-to-sql-syntax
"""
return AsIs(numpy_int64)

Expand Down
34 changes: 32 additions & 2 deletions ding0/config/config_db_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,57 +22,87 @@
Base = declarative_base()


# TODO: check docstrings


# ================ DEFINITIONS FOR EXPORTED DATA ===============
class sqla_mv_grid_viz(Base):
""" SQLAlchemy table definition for the export of MV grids for visualization purposes
Notes
-----
#TODO: Check docstrings *before* definitions! is that ok?
"""

__tablename__ = 'ego_grid_mv_visualization_bunch'
__table_args__ = {'schema': 'model_draft'}

#::obj:`type`: Description.
grid_id = sa.Column('grid_id', sa.Integer(), primary_key=True)
#::obj:`type`: Description.
geom_mv_station = sa.Column('geom_mv_station', Geometry(geometry_type='POINT', srid=4326))
#::obj:`type`: Description.
geom_mv_cable_dists = sa.Column('geom_mv_cable_dists', Geometry(geometry_type='MULTIPOINT', srid=4326))
#::obj:`type`: Description.
geom_mv_circuit_breakers = sa.Column('geom_mv_circuit_breakers', Geometry(geometry_type='MULTIPOINT', srid=4326))
#::obj:`type`: Description.
geom_lv_load_area_centres = sa.Column('geom_lv_load_area_centres', Geometry(geometry_type='MULTIPOINT', srid=4326))
#::obj:`type`: Description.
geom_lv_stations = sa.Column('geom_lv_stations', Geometry(geometry_type='MULTIPOINT', srid=4326))
#::obj:`type`: Description.
geom_mv_generators = sa.Column('geom_mv_generators', Geometry(geometry_type='MULTIPOINT', srid=4326))
#::obj:`type`: Description.
geom_mv_lines = sa.Column('geom_mv_lines', Geometry(geometry_type='MULTILINESTRING', srid=4326))


class sqla_mv_grid_viz_branches(Base):
""" SQLAlchemy table definition for the export of MV grids' branches for visualization purposes
#TODO: Check docstrings *after* definitions! is that ok?
"""

__tablename__ = 'ego_grid_mv_visualization_branches'
__table_args__ = {'schema': 'model_draft'}

branch_id = sa.Column(sa.String(25), primary_key=True)
""":obj:`type`: Description."""
grid_id = sa.Column('grid_id', sa.Integer)
""":obj:`type`: Description."""
type_name = sa.Column('type_name', sa.String(25))
""":obj:`type`: Description."""
type_kind = sa.Column('type_kind', sa.String(5))
""":obj:`type`: Description."""
type_v_nom = sa.Column('type_v_nom', sa.Integer)
""":obj:`type`: Description."""
type_s_nom = sa.Column('type_s_nom', sa.Float(53))
""":obj:`type`: Description."""
length = sa.Column('length', sa.Float(53))
""":obj:`type`: Description."""
geom = sa.Column('geom', Geometry(geometry_type='LINESTRING', srid=4326))
""":obj:`type`: Description."""
s_res0 = sa.Column('s_res0', sa.Float(53))
""":obj:`type`: Description."""
s_res1 = sa.Column('s_res1', sa.Float(53))
""":obj:`type`: Description."""


class sqla_mv_grid_viz_nodes(Base):
""" SQLAlchemy table definition for the export of MV grids' branches for visualization purposes
#TODO: Check docstrings *before* definitions! is that ok?
"""

__tablename__ = 'ego_grid_mv_visualization_nodes'
__table_args__ = {'schema': 'model_draft'}


#::obj:`type`: Description.
node_id = sa.Column(sa.String(100), primary_key=True)
#::obj:`type`: Description.
grid_id = sa.Column('grid_id', sa.Integer)
#::obj:`type`: Description.
v_nom = sa.Column('v_nom', sa.Integer)
#::obj:`type`: Description.
geom = sa.Column('geom', Geometry(geometry_type='POINT', srid=4326))
#::obj:`type`: Description.
v_res0 = sa.Column('v_res0', sa.Float(53))
#::obj:`type`: Description.
v_res1 = sa.Column('v_res1', sa.Float(53))
2 changes: 1 addition & 1 deletion ding0/config/config_db_tables.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ conv_generators = t_ego_dp_conv_powerplant_sq_mview
version = v0.3.0

[input_data_source]
input_data = versioned
input_data = model_draft
Loading

0 comments on commit 2892e11

Please sign in to comment.