Permalink
Browse files

Adjust sign of water releases

  • Loading branch information...
cmutel committed Sep 17, 2018
1 parent 9aaa72d commit 5af0e29440146faa2c60a8366c691d333af7d015
Showing with 22 additions and 22 deletions.
  1. +22 −22 bw2_lcimpact/water.py
@@ -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),
]
@@ -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):
@@ -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):
@@ -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'])
)
@@ -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):
@@ -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'])
)

0 comments on commit 5af0e29

Please sign in to comment.