Skip to content

Commit aa0cde3

Browse files
committed
improve handling of vert_mean when thickness na inconsistent with data
1 parent e18d7f4 commit aa0cde3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

nctoolkit/verticals.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ def vertical_mean(self, thickness=None, depth_range=None, fixed=None):
314314
ds_thick = open_data(thickness)
315315
if len(ds_thick.variables) != 1:
316316
raise ValueError("Please provide a thickness file with 1 variable!")
317+
ds_mask = open_data(self[0])
318+
ds_mask.subset(variables=ds_mask.variables[0], time = 0)
319+
ds_mask.abs()
320+
ds_mask > 0
321+
ds_thick * ds_mask
317322

318323
thick_var = ds_thick.variables[0]
319324
# modify the depth if it is a list

0 commit comments

Comments
 (0)