Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adjust sign of water releases
  • Loading branch information
cmutel committed Sep 17, 2018
1 parent 9aaa72d commit 5af0e29
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions bw2_lcimpact/water.py
Expand Up @@ -6,21 +6,21 @@
We are assessing freshwater consumption, and so some water flows are excluded."""

SURFACE_WATER = [
('Fresh water (obsolete)', ('water', 'surface water')),
('Water', ('water',)),
('Water', ('water', 'surface water')),
('Water, cooling, unspecified natural origin', ('natural resource', 'in water')),
('Water, lake', ('natural resource', 'in water')),
('Water, river', ('natural resource', 'in water')),
('Water, turbine use, unspecified natural origin', ('natural resource', 'in water')),
('Water, unspecified natural origin', ('natural resource', 'in water')),
('Fresh water (obsolete)', ('water', 'surface water'), -1),
('Water', ('water',), -1),
('Water', ('water', 'surface water'), -1),
('Water, cooling, unspecified natural origin', ('natural resource', 'in water'), 1),
('Water, lake', ('natural resource', 'in water'), 1),
('Water, river', ('natural resource', 'in water'), 1),
('Water, turbine use, unspecified natural origin', ('natural resource', 'in water'), 1),
('Water, unspecified natural origin', ('natural resource', 'in water'), 1),
]

GROUND_WATER = [
('Water', ('water', 'ground-')),
('Water', ('water', 'ground-, long-term')),
('Water, unspecified natural origin', ('natural resource', 'in ground')),
('Water, well, in ground', ('natural resource', 'in water')),
('Water', ('water', 'ground-'), -1),
# ('Water', ('water', 'ground-, long-term')),
('Water, unspecified natural origin', ('natural resource', 'in ground'), 1),
('Water, well, in ground', ('natural resource', 'in water'), 1),
]


Expand All @@ -35,9 +35,9 @@ def _water_flows(self, kind='all'):

for act in self.db:
name, categories = act['name'], tuple(act['categories'])
for x, y in flows:
for x, y, sign in flows:
if name == x and categories == y:
yield act.key
yield act.key, sign


class WaterHumanHealthMarginal(Water):
Expand All @@ -62,8 +62,8 @@ def setup_geocollections(self):
}

def global_cfs(self):
for key in self._water_flows():
yield((key, self.global_cf, "GLO"))
for key, sign in self._water_flows():
yield((key, self.global_cf * sign, "GLO"))

@regionalized
def regional_cfs(self):
Expand All @@ -75,10 +75,10 @@ def regional_cfs(self):
with fiona.drivers():
with fiona.open(self.vector_ds) as src:
for feat in src:
for key in water_flows:
for key, sign in water_flows:
yield (
key,
feat['properties'][self.column] * 1e-6,
feat['properties'][self.column] * 1e-6 * sign,
(self.geocollection, feat['properties']['BAS34S_ID'])
)

Expand Down Expand Up @@ -111,8 +111,8 @@ def setup_geocollections(self):
}

def global_cfs(self):
for key in self._water_flows(self._flows_label):
yield((key, self.global_cf, "GLO"))
for key, sign in self._water_flows(self._flows_label):
yield((key, self.global_cf * sign, "GLO"))

@regionalized
def regional_cfs(self):
Expand All @@ -124,10 +124,10 @@ def regional_cfs(self):
with fiona.drivers():
with fiona.open(self.vector_ds) as src:
for feat in src:
for key in water_flows:
for key, sign in water_flows:
yield (
key,
feat['properties'][self.column],
feat['properties'][self.column] * sign,
(self.geocollection, feat['properties']['id'])
)

Expand Down

0 comments on commit 5af0e29

Please sign in to comment.