From ec80d4ea9250cacf8eff7b49916e38fb7095d835 Mon Sep 17 00:00:00 2001 From: Lee de Mora Date: Tue, 14 Nov 2023 16:51:28 +0000 Subject: [PATCH] Fix for andrews --- bgcval2/functions/globalVolMean.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bgcval2/functions/globalVolMean.py b/bgcval2/functions/globalVolMean.py index 5d7f9ebb..b267a779 100644 --- a/bgcval2/functions/globalVolMean.py +++ b/bgcval2/functions/globalVolMean.py @@ -31,18 +31,28 @@ import numpy as np from bgcval2.functions.standard_functions import choose_best_var +from bgcval2.functions.standard_functions import find_best_var +#def calc_vol(nc): +# """ +# Calculate volume from the (grid-T) netcdf file. +# """ +# area = nc.variables['area'][:] +# thkcello = nc.variables['thkcello'][:] +# area = area[None, None,:, :] +# return thkcello * area def calc_vol(nc): """ Calculate volume from the (grid-T) netcdf file. """ - area = nc.variables['area'][:] - thkcello = nc.variables['thkcello'][:] + area_key = find_best_var(nc, ['area', 'area_grid_T']) + thkcello_key = find_best_var(nc, ['thkcello', 'thkcello_grid_T']) + area = nc.variables[area_key][:] + thkcello = nc.variables[thkcello_key][:] area = area[None, None,:, :] return thkcello * area - def globalVolumeMean(nc, keys, **kwargs): """ Calculate the global volume mean.