class HeatLoadProfileNuts(db.Model):
    __tablename__ = 'load_profile'
    __table_args__ = (db.ForeignKeyConstraint(
        ['fk_nuts_gid'], ['geo.nuts.gid'], name='load_profile_nuts_gid_fkey'),
                      db.ForeignKeyConstraint(
                          ['fk_time_id'], ['stat.time.id'],
                          name='load_profile_time_id_fkey'), {
                              "schema": 'stat'
                          })

    CRS = 4258

    id = db.Column(db.Integer, primary_key=True)
    nuts_id = db.Column(db.String(14))
    process_id = db.Column(db.Integer)
    process = db.Column(db.String())
    unit = db.Column(db.String())
    value = db.Column(db.Numeric(precision=30, scale=10))
    fk_nuts_gid = db.Column(db.BigInteger)
    fk_time_id = db.Column(db.BigInteger)

    nuts = db.relationship("Nuts")
    time = db.relationship("Time")

    def __repr__(self):
        return "<HeatLoadProfileNuts(nuts_id='%s', time='%s', value='%d', unit='%s')>" % (
            self.nuts_id, str(self.time), self.value, self.unit)
Example #2
0
class PopulationDensityHaModel(db.Model):
    __tablename__ = 'pop_tot_curr_density'
    __table_args__ = ({"schema": 'geo'})

    CRS = 3035

    rid = db.Column(db.Integer, primary_key=True)
    rast = db.Column(Raster)
    filename = db.Column(db.String)
    date = db.Column(db.Date)

    def __repr__(self):
        str_date = self.date.strftime("%Y-%m-%d")
        return "<PopDensity1ha(rid='%s', date='%s', filename='%d', rast='%s')>" % (
            self.rid, str_date, self.filename, str(self.rast))
Example #3
0
class Nuts(db.Model):
    __tablename__ = 'nuts'
    __table_args__ = ({"schema": 'geo'})

    CRS = 4258

    gid = db.Column(db.Integer, primary_key=True)
    nuts_id = db.Column(db.String(14))
    name = db.Column(db.String(255))
    stat_levl_ = db.Column(db.Integer)
    shape_area = db.Column(db.Numeric)
    shape_len = db.Column(db.Numeric)
    geom = db.Column(Geometry('GEOMETRY', 4258))
    year = db.Column(db.Date)

    def __repr__(self):
        return "<Nuts(nuts_id='%s', name='%s', level='%s')>" % (
            self.nuts_id, self.name, self.stat_levl_)
Example #4
0
class Lau(db.Model):
    __tablename__ = 'lau'
    __table_args__ = (
        {"schema": 'public'}
    )

    CRS = 3035

    gid = db.Column(db.Integer, primary_key=True)
    comm_id = db.Column(db.String(14))
    #name = db.Column(db.String(255))
    stat_levl_ = db.Column(db.Integer)
    shape_area = db.Column(db.Numeric)
    shape_leng = db.Column(db.Numeric)
    geom = db.Column(Geometry('GEOMETRY', 4258))
    year = db.Column(db.Date)

    def __repr__(self):
        return "<Lau(comm_id='%s', level='%s')>" % (
            self.comm_id, self.stat_levl_)
Example #5
0
class WwtpModel(db.Model):
    __tablename__ = 'wwtp'
    __table_args__ = ({"schema": 'geo'})

    CRS = 3035

    gid = db.Column(db.Integer, primary_key=True)
    date = db.Column(db.Date)
    capacity = db.Column(db.Numeric)
    power = db.Column(db.Numeric)
    unit = db.Column(db.String(255))
    geom = db.Column(Geometry('GEOMETRY', 4258))

    def __repr__(self):
        str_date = self.date.strftime("%Y-%m-%d")
        return "<Wwtp(gid= '%d', date='%s', capacity='%d', power='%d', unit='%s', geom='%s')>" % (
            self.gid, str_date, self.capacity, self.power, self.unit,
            self.geom)
Example #6
0
class PopulationDensityNutsModel(db.Model):
    __tablename__ = 'pop_tot_curr_density_tif_nuts'
    __table_args__ = (db.ForeignKeyConstraint(['nuts_id'],
                                              ['geo.nuts_rg_01m.nuts_id']), {
                                                  "schema": 'stat'
                                              })

    CRS = 4258

    id = db.Column(db.Integer, primary_key=True)
    nuts_id = db.Column(db.String(14))
    #date = db.Column(db.Date)
    count = db.Column(db.BigInteger)
    sum = db.Column(db.Numeric(precision=30, scale=10))
    mean = db.Column(db.Numeric(precision=30, scale=10))
    median = db.Column(db.Numeric(precision=30, scale=10))
    min = db.Column(db.Numeric(precision=30, scale=10))
    max = db.Column(db.Numeric(precision=30, scale=10))
    std = db.Column(db.Numeric(precision=30, scale=10))
    variance = db.Column(db.Numeric(precision=30, scale=10))
    range = db.Column(db.Numeric(precision=30, scale=10))
    nuts = db.relationship("NutsRG01M")

    def __repr__(self):
        str_date = self.date.strftime("%Y-%m-%d")
        return "<PopDensity(nuts_id='%s', date='%s', value='%d', nuts='%s')>" % (
            self.nuts_id, str_date, self.value, str(self.nuts))
Example #7
0
class PopulationDensityLauModel(db.Model):
    __tablename__ = 'pop_tot_curr_density_lau_test'
    """__table_args__ = (
        db.ForeignKeyConstraint(['fk_lau_gid'], ['geo.lau.gid']),
        db.ForeignKeyConstraint(['fk_time_id'], ['stat.time.id']),
        {"schema": 'stat'}
    )
"""
    __table_args__ = (db.ForeignKeyConstraint(['fk_lau_gid'],
                                              ['public.lau.gid']), {
                                                  "schema": 'stat'
                                              })

    CRS = 3035

    id = db.Column(db.Integer, primary_key=True)
    comm_id = db.Column(db.String(14))
    count = db.Column(db.BigInteger)
    sum = db.Column(db.Numeric(precision=30, scale=10))
    mean = db.Column(db.Numeric(precision=30, scale=10))
    median = db.Column(db.Numeric(precision=30, scale=10))
    min = db.Column(db.Numeric(precision=30, scale=10))
    max = db.Column(db.Numeric(precision=30, scale=10))
    std = db.Column(db.Numeric(precision=30, scale=10))
    variance = db.Column(db.Numeric(precision=30, scale=10))
    range = db.Column(db.Numeric(precision=30, scale=10))
    fk_lau_gid = db.Column(db.BigInteger)
    #fk_time_id = db.Column(db.BigInteger)

    lau = db.relationship("Lau")

    #time = db.relationship("Time")

    def __repr__(self):
        return "<PopDensityLau(comm_id='%s', year='%s', sum='%d', lau='%s')>" % \
               (self.comm_id, self.time.year, self.sum, str(self.lau))
Example #8
0
class Time(db.Model):
    __tablename__ = 'time'
    __table_args__ = (
        {"schema": 'stat'}
    )

    id = db.Column(db.Integer, primary_key=True)
    granularity = db.Column(db.String(14))
    date = db.Column(db.Date)
    hour_of_year = db.Column(db.BigInteger)
    hour_of_day = db.Column(db.SmallInteger)
    season = db.Column(db.String(14))
    weekday = db.Column(db.String(14))
    day = db.Column(db.SmallInteger)
    month = db.Column(db.SmallInteger)
    year = db.Column(db.SmallInteger)
    timestamp = db.Column(db.DateTime(timezone=False))

    def __repr__(self):
        return "<Time(%s)>" % (self.timestamp.strftime("%Y-%m-%d %H:%M"))