Exemple #1
0
def subsector_calculate(subsector):
    if not subsector.calculated:
        cfg.initialize_config(subsector.workingdir, subsector.cfgfile_name,
                              subsector.log_name)
        subsector.calculate()
        cfg.cur.close()
    return subsector
Exemple #2
0
def aggregate_subsector_shapes(params):
    subsector = params[0]
    year = params[1]
    cfg.initialize_config(subsector.workingdir, subsector.cfgfile_name,
                          subsector.log_name)
    aggregate_electricity_shape = subsector.aggregate_electricity_shapes(year)
    cfg.cur.close()
    return aggregate_electricity_shape
def subsector_populate(subsector):
    cfg.initialize_config()
    try:
        subsector.add_energy_system_data()
    except Exception as e:
        traceback.print_exc()
        raise e
    return subsector
Exemple #4
0
def main():
    '''
    Main entrypoint for the testlib test library.
    '''
    config.initialize_config()

    # 'do' the given command.
    globals()['do_' + config.config.command]()
    log.test_log.close()
def process_shapes(shape):
    try:
        cfg.initialize_config()
        shape.process_shape()
    except Exception as e:
        print 'Caught exception in shape {}'.format(shape.name)
        traceback.print_exc()
        raise e
    return shape
def shapes_populate(shape):
    try:
        cfg.initialize_config()
        logging.info('    shape: ' + shape.name)
        shape.read_timeseries_data()
    except Exception as e:
        traceback.print_exc()
        raise e
    return shape
def subsector_calculate(subsector):
    try:
        if not subsector.calculated:
            cfg.initialize_config()
            subsector.calculate()
    except Exception as e:
        traceback.print_exc()
        raise e
    return subsector
def node_calculate(node):
    try:
        cfg.initialize_config()
        if node.name.lower() == 'bulk electricity blend' and cfg.rio_supply_run:
            node.calculate(calculate_residual=False)
        else:
            node.calculate()
    except Exception as e:
        traceback.print_exc()
        raise e
    return node
Exemple #9
0
def main():
    '''
    Main entrypoint for the testlib test library.
    Returns 0 on success and 1 otherwise so it can be used as a return code
    for scripts.
    '''
    config.initialize_config()

    # 'do' the given command.
    result = globals()['do_'+config.config.command]()
    log.test_log.close()

    return result
Exemple #10
0
def main():
    '''
    Main entrypoint for the testlib test library.
    Returns 0 on success and 1 otherwise so it can be used as a return code
    for scripts.
    '''
    config.initialize_config()

    # 'do' the given command.
    result = globals()['do_' + config.config.command]()
    log.test_log.close()

    return result
Exemple #11
0
 def __init__(self, session_factory, ion_mode):
     cmd.Cmd.__init__(self)
     self.prompt = 'domdb> '
     self.session_factory = session_factory
     self.config = initialize_config()
     self.ion_mode = ion_mode
     self.do_count('')
Exemple #12
0
 def __init__(self,session_factory,ion_mode):
     cmd.Cmd.__init__(self)
     self.prompt = 'domdb> '
     self.session_factory = session_factory
     self.config = initialize_config()
     self.ion_mode = ion_mode
     self.do_count('')
Exemple #13
0
def subsector_populate(subsector):
    cfg.initialize_config(subsector.workingdir, subsector.cfgfile_name,
                          subsector.log_name)
    subsector.add_energy_system_data()
    cfg.cur.close()
    return subsector
from config import initialize_config

# Reads settings from command line

initialize_config()
from Exploration_RQ4 import run_exploration

# generate_dtw_analysis_files()

# generate_mba_analysis_files()

# Start the exploration
run_exploration()

Exemple #15
0
def node_calculate(node):
    cfg.initialize_config(node.workingdir, node.cfgfile_name, node.log_name)
    node.calculate()
    cfg.cur.close()
    return node
Exemple #16
0
def process_shapes(shape):
    cfg.initialize_config(shape.workingdir, shape.cfgfile_name, shape.log_name)
    shape.process_shape()
    cfg.cur.close()
    return shape
Exemple #17
0
from sqlalchemy import create_engine, Column, Integer, String, DateTime, ForeignKey, Table
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
from config import initialize_config, is_debug
from os import environ

initialize_config()

Base = declarative_base()
engine = create_engine('postgresql://{DBUSER}:{DBPASS}@{DBSERVER}:{DBPORT}/{DBNAME}'.format(**environ),
                       echo=is_debug())

song_chord = Table('song_chord', Base.metadata,
                   Column('song_id', Integer, ForeignKey('song.id'), index=True),
                   Column('chord_id', Integer, ForeignKey('chord.id'), index=True)
)


class Song(Base):
    __tablename__ = 'song'
    id = Column(Integer(), primary_key=True, nullable=False, autoincrement=True)
    artist = Column(String(length=200))
    name = Column(String(length=200), nullable=False)
    url = Column(String(length=200), nullable=False, unique=True, index=True)
    rating = Column(Integer())
    created_date = Column(DateTime(), nullable=False, index=True)
    chords = relationship('Chord', secondary=song_chord, backref='songs', lazy='joined')

    def __str__(self):
        return '"{0}" by {1}'.format(self.name, self.artist)
def shapes_populate(shape):
    cfg.initialize_config(shape.workingdir, shape.cfgfile_name, shape.log_name)
    logging.info('    shape: ' + shape.name)
    shape.read_timeseries_data()
    cfg.cur.close()
    return shape
Exemple #19
0
def init_config():
    import config
    config.initialize_config()
Exemple #20
0
            return df

    @classmethod
    def is_energy_unit(cls, unit):
        uc = cls.get_instance()
        if uc.ureg.Quantity(unit).dimensionality == uc.ureg.Quantity(
                'kilowatt_hour').dimensionality:
            return True
        else:
            return False


if __name__ == "__main__":
    path = r'C:\github\EP_US_db\180728_US.db'
    os.chdir(path)
    cfg.initialize_config(r'C:\github\EP_runs\csv_migration', 'config.INI',
                          None)
    uc = self = UnitConverter.get_instance(path)

    currency_from, year_from, currency_to, year_to = 'EUR', 2001, 'USD', 2015
    factor = UnitConverter.currency_convert(1, currency_from, year_from,
                                            currency_to, year_to)
    print currency_from, year_from, currency_to, year_to, factor

    currency_from, year_from, currency_to, year_to = 'EUR', 2015, 'USD', 2001
    factor = UnitConverter.currency_convert(1, currency_from, year_from,
                                            currency_to, year_to)
    print currency_from, year_from, currency_to, year_to, factor

    currency_from, year_from, currency_to, year_to = 'USD', 2015, 'EUR', 2001
    factor = UnitConverter.currency_convert(1, currency_from, year_from,
                                            currency_to, year_to)
def init_app():
    initialize_config()
    connect_db()
Exemple #22
0
def main():
    config.initialize_config()

    # 'do' the given command.
    globals()['do_' + config.config.command]()
    log.test_log.close()