forked from JuliaClimate/Notebooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
06_overturning.jl
84 lines (69 loc) · 2.87 KB
/
06_overturning.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,jl:light
# text_representation:
# extension: .jl
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.2.4
# kernelspec:
# display_name: Julia 1.3.1
# language: julia
# name: julia-1.3
# ---
# + {"slideshow": {"slide_type": "slide"}, "cell_type": "markdown"}
# # Meridional Overturning Circulation
#
# Global Ocean transport depictions often involve concepts like the [AMOC](https://en.wikipedia.org/wiki/Atlantic_meridional_overturning_circulation), [Thermohaline Circulation](https://en.wikipedia.org/wiki/Thermohaline_circulation), or [conveyor Belt](http://oceanmotion.org/html/background/ocean-conveyor-belt.html). To apply these concepts to gridded ocean and climate models, one can compute an `overturning streamfunction` as shown below. For more detail, please refer to [Forget et al, 2015](https://doi.org/10.5194/gmd-8-3071-2015) and the other [GlobalOceanNotebooks](https://github.com/JuliaClimate/GlobalOceanNotebooks).
# + {"slideshow": {"slide_type": "slide"}, "cell_type": "markdown"}
# ### Read grid & velocities from file
#
# 1. pre-requisites
# 2. read variables
# 3. conversion to transports
# +
#]add MITgcmTools#master
# + {"slideshow": {"slide_type": "subslide"}}
using MeshArrays, Plots, Statistics, MITgcmTools
include("helper_functions.jl")
get_grid_if_needed()
get_velocity_if_needed()
Γ =read_llc90_grid()
LC=LatitudeCircles(-89.0:89.0,Γ);
# + {"slideshow": {"slide_type": "slide"}, "cell_type": "markdown"}
# ### Compute Overturning Streamfunction
#
# 1. integrate across `latitude circle paths`
# 2. integrate from the bottom
# + {"slideshow": {"slide_type": "-"}}
nz=size(Γ["hFacC"],2); nt=12; nl=length(LC)
ov=Array{Float64,3}(undef,nl,nz,nt)
#integrate across latitude circles
for t=1:nt
(U,V)=read_velocities(Γ["XC"].grid,t)
(U,V)=convert_velocities(U,V,Γ)
for z=1:nz
UV=Dict("U"=>U[:,z],"V"=>V[:,z],"dimensions"=>["x","y"])
[ov[l,z,t]=ThroughFlow(UV,LC[l],Γ) for l=1:nl]
end
end
#integrate from bottom
ov=reverse(cumsum(reverse(ov,dims=2),dims=2),dims=2);
# + {"slideshow": {"slide_type": "slide"}, "cell_type": "markdown"}
# ### Plot Annual Mean And Variability
# -
x=vec(-89.0:89.0); y=reverse(vec(Γ["RF"][1:end-1])); #coordinate variables
# + {"slideshow": {"slide_type": "fragment"}, "cell_style": "split"}
tmp=dropdims(mean(ov,dims=3),dims=3)
z=reverse(tmp,dims=2); z[z.==0.0].=NaN
contourf(x,y,1e-6*transpose(z),clims=(-40,40),
title="Overturning mean (Eulerian; in Sv)",titlefontsize=10)
#savefig("MOC_mean.png")
# + {"slideshow": {"slide_type": "fragment"}, "cell_style": "split"}
tmp=dropdims(std(ov,dims=3),dims=3)
z=reverse(tmp,dims=2); z[z.==0.0].=NaN
contourf(x,y,1e-6*transpose(z),clims=(-40,40),
title="Overturning standard deviation (Eulerian; in Sv)",titlefontsize=10)
#savefig("MOC_std.png")