exposureentity.py 3.75 KB
Newer Older
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python3

# Copyright (C) 2021:
#   Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.

import logging

logger = logging.getLogger()


class ExposureEntity:
    """This class represents a geographical unit where an exposure model is defined. In the
    spatial sense is encompasses smaller geographical data units.

    Attributes:
        self.name (str):
            Name of the exposure entity.
        self.occupancy_cases (dict):
            Dictionary definining the type, level and definition of the data units used for each
            occupancy case of the model (e.g. residential, commercial), with the following
            structure:
                self.occupancy_cases
                  |_ occupancy_cases.keys()[0]
                  |    |_  data_units_type (str):
                  |    |       Type of data unit used to define this occupancy case in this
                  |    |       ExposureEntity. Currently supported types:
                  |    |           "polygon":
                  |    |               Polygon of arbitrary shape (e.g. boundaries of an
                  |    |               administrative unit, Voronoi cell).
                  |    |           "cell":
                  |    |               Regular quadrilateral in a specified projection that can
                  |    |               be sufficiently and unequivocally defined by knowing (1)
                  |    |               the coordinates of a vertex or the centroid, (2) the
                  |    |               width, (3) the height, and (4) the projection system.
                  |    |               E.g. a 30 arcsec (width) by 30 arcsec cell (height) in
                  |    |               the World Geodetic System 1984 (WGS84).
                  |    |_  data_units_level (str):
                  |    |       Level/resolution of the data unit used to define this occupancy
                  |    |       case in this ExposureEntity. Currently supported types:
                  |    |           "30arcsec_30arcsec":
                  |    |               Applies to the "cell" type and defines a 30 arcsec
                  |    |               (width) by 30 arcsec (height) cell in the World Geodetic
                  |    |               System 1984 (WGS84).
                  |    |           Any integer >= 0:
                  |    |               Applies to the "polygon" type and refers to an
                  |    |               administrative unit level as per a classification
                  |    |               system.
                  |    |_  data_units_definition (str):
                  |    |       Name of the projection (if "cell" type) or classification system
                  |    |       (if "polygon" type) in which the data unit is defined. E.g.
                  |    |       "WGS84" for cells, "NUTS" for polygons that represent
                  |    |       administrative units.
                  |_ occupancy_cases.keys()[1]
                  |    |_  data_units_type: ...
                  |_ ...
    """

    def __init__(self, name):
        self.name = name
        self.occupancy_cases = {}