Skip to content

Commit

Permalink
Fix for andrews
Browse files Browse the repository at this point in the history
  • Loading branch information
ledm committed Nov 14, 2023
1 parent 95c5e01 commit ec80d4e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions bgcval2/functions/globalVolMean.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ec80d4e

Please sign in to comment.