Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix units for heat transports #281

Merged
merged 1 commit into from
Jul 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions tools/analysis/poleward_heat_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def main(cmdLineArgs,stream=False):
try: basin_code = m6toolbox.readNCFromTar(cmdLineArgs.gridspec,'basin_codes.nc','basin')[:]
except: basin_code = m6toolbox.genBasinMasks(xcenter, ycenter, depth)
else:
raise ValueError('Unable to extract grid information from gridspec directory/tar file.')
raise ValueError('Unable to extract grid information from gridspec directory/tar file.')

rootGroup = netCDF4.MFDataset( cmdLineArgs.infile )
if 'T_ady_2d' in rootGroup.variables:
Expand All @@ -60,7 +60,7 @@ def main(cmdLineArgs,stream=False):
if 'T_diffy_2d' in rootGroup.variables:
varName = 'T_diffy_2d'
diffusive = rootGroup.variables[varName][:].filled(0.)
else:
else:
diffusive = None
warnings.warn('Diffusive temperature term not found. This will result in an underestimation of the heat transport.')

Expand All @@ -77,7 +77,9 @@ def heatTrans(advective, diffusive=None, vmask=None):
Cp = 3989.
HT = HT * (rho0 * Cp)
HT = HT * 1.e-15 # convert to PW
elif advective.units == "W m-2":
elif advective.units == "W m-2": # bug in MOM6 units (issue #934), keep for retrocompatibility
HT = HT * 1.e-15
elif advective.units == "W":
HT = HT * 1.e-15
else:
print('Unknown units')
Expand All @@ -96,7 +98,7 @@ def annotatePlot(label):
fig = plt.gcf()
#fig.text(0.1,0.85,label)
fig.text(0.535,0.12,label)

def annotateObs():
fig = plt.gcf()
fig.text(0.1,0.85,r"Trenberth, K. E. and J. M. Caron, 2001: Estimates of Meridional Atmosphere and Ocean Heat Transports. J.Climate, 14, 3433-3443.", fontsize=8)
Expand All @@ -113,7 +115,7 @@ def annotateObs():
ECMWF = {}; ECMWF['Global'] = fObs.variables['OTe'][:]
ECMWF['Atlantic'] = fObs.variables['ATLe'][:]; ECMWF['IndoPac'] = fObs.variables['INDPACe'][:]

#G and W
#G and W
Global = {}
Global['lat'] = numpy.array([-30., -19., 24., 47.])
Global['trans'] = numpy.array([-0.6, -0.8, 1.8, 0.6])
Expand Down Expand Up @@ -208,6 +210,6 @@ def plotGandW(lat,trans,err):

if stream is True:
return imgbufs

if __name__ == '__main__':
run()