forked from dpinney/omf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convertAll.py
31 lines (26 loc) · 1.17 KB
/
convertAll.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Open Modeling Framework (OMF) Software for simulating power systems behavior
# Copyright (c) 2015, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
from os import listdir
from os.path import join
from sqlalchemy.ext.declarative import declarative_base
from omf.tools.Converter.BaseElements.DB import set_db
from omf import filesystem
from omf.config import the_config
from omf.tools.Converter.Converter import Converter
def import_all():
db = declarative_base()
set_db(db)
fs = filesystem.Filesystem().fs
for file in fs.listdir('data/Feeder/public/'):
feeder_path = join("data/Feeder/public/", file) # without omf, due to HOME_DIR in filesystem class
Converter.convert(feeder_path, the_config.POSTGIS_DB_URI, -92.3395017, 38.9589246, 1)