Last active
August 29, 2015 13:57
-
-
Save adcroft/9663218 to your computer and use it in GitHub Desktop.
Diagnose total TKE input to internal tide mixing parameterization in MOM6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
import numpy | |
tkeFile = netCDF4.Dataset('/archive/bls/tikal_mom6_2014.01.17/MOM6z_SIS_025_enstro_newTides/gfdl.ncrc2-intel-prod/history/unpack/19000101.ocean_annual.nc') | |
TKEi = numpy.ma.array( tkeFile.variables['TKE_itidal'][0], dtype='float64') | |
TKEf = numpy.ma.array( tkeFile.variables['TKE_tidal'][0], dtype='float64') | |
staticFile = netCDF4.Dataset('/net2/aja/OWG/ocean_static.nc') | |
area = numpy.ma.array( staticFile.variables['area_t'][:], dtype='float64') | |
depth = numpy.ma.array( staticFile.variables['depth_ocean'][:], dtype='float64') | |
area[ depth<=0 ] = 0 | |
shallowArea = area.copy(); shallowArea[ depth>=500 ] = 0 | |
deepArea = area.copy(); deepArea[ depth<500 ] = 0 | |
Fall = numpy.ma.sum( area*TKEf ) /1e12 | |
Iall = numpy.ma.sum( area*TKEi ) /1e12 | |
Fshallow = numpy.ma.sum( shallowArea*TKEf ) /1e12 | |
Ishallow = numpy.ma.sum( shallowArea*TKEi ) /1e12 | |
Fdeep = numpy.ma.sum( deepArea*TKEf ) /1e12 | |
Ideep = numpy.ma.sum( deepArea*TKEi ) /1e12 | |
print 'Uncorrected global frictional, internal tides (TW):', Fall, Iall | |
print 'Uncorrected <500m frictional, internal tides (TW):', Fshallow, Ishallow | |
print 'Uncorrected >500m frictional, internal tides (TW):', Fdeep, Ideep | |
A = numpy.matrix([[Fshallow, Ishallow],[Fdeep, Ideep]]) | |
a = numpy.dot( A.I, numpy.array([2.5,1.0]) ).T | |
af = a.item(0) ; ai = a.item(1) | |
print 'af=', af, 'ai=', ai | |
print 'Scaled global frictional, internal tides (TW):', af*Fall, ai*Iall | |
print 'Scaled <500m frictional, internal tides (TW):', af*Fshallow, ai*Ishallow | |
print 'Scaled >500m frictional, internal tides (TW):', af*Fdeep, ai*Ideep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment