def compute_heat_transport(self, dsarray, method):
from scipy import integrate
'''
compute heat transport using surface(toa,sfc) flux
'''
lat_rad = np.deg2rad(dsarray.lat)
coslat = np.cos(lat_rad)
field = coslat * dsarray
if method is "Flux_adjusted":
field = field - field.mean("lat")
print("The heat transport is computed by Flux adjestment.")
elif method is "Flux":
print("The heat transport is computed by Flux.")
elif method is "Dynamic":
print("The heat transport is computed by dynamic method.")
raise ValueError("Dynamic method has not been implimented.")
else:
raise ValueError("Method is not supported.")
try:
latax = field.get_axis_num('lat')
except:
raise ValueError('No lat coordinate!')
integral = integrate.cumtrapz(field, x=lat_rad, initial=0., axis=latax)
transport = 1e-15 * 2 * np.math.pi * integral * cc.rearth **2 # unit in PW
if isinstance(field, xr.DataArray):
result = field.copy()
result.values = transport
return result.T
# heat transport
# @property
评论列表
文章目录