Commit e453ce65 authored by Javier Vegas-Regidor's avatar Javier Vegas-Regidor
Browse files

Fix sivolume issues in HR experiments

parent 29753ddf
......@@ -98,7 +98,7 @@ class Sivolume(Diagnostic):
area = e1t * e2t
for basin in basins:
masks[basin] = Utils.get_mask(basin) * area.data
masks[basin] = Utils.get_mask(basin) * area.core_data()
job_list = list()
for (
......@@ -175,19 +175,19 @@ class Sivolume(Diagnostic):
condition = data.coord("latitude").points > 0
else:
condition = data.coord("latitude").points < 0
weights = (
iris.util.broadcast_to_shape(
condition, data.shape, data.coord_dims("latitude")
)
* mask
)
new_mask = condition * mask
if new_mask.max() == 0:
return None
data = data * new_mask
return data.collapsed(
("latitude", "longitude"), iris.analysis.SUM, weights=weights
("latitude", "longitude"), iris.analysis.SUM
)
def save(self, var, results):
cubes = iris.cube.CubeList()
for basin, result in six.iteritems(results):
if result is None:
continue
result.var_name = var
result.units = "m^3"
result.add_aux_coord(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment