forked from hmchristensen/MUMIP-cg
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunc_advtend.ncl
41 lines (27 loc) · 1.21 KB
/
func_advtend.ncl
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
; func_advtend.ncl
procedure func_advtend(fout:file,var_name_in:string,var_name_out:string,long_name_out:string,units_out:string)
local fout, var_name_in, var_name_out, long_name_out, units_out,\
var_data_out, u_data_out, v_data_out, vartend_data_out
begin
;==================================================================================
; derive advective tendency
print("procedure advective tendency")
;=====================
; load required variables in from file
var_data_out = fout->$var_name_in$
u_data_out = fout->u_t
v_data_out = fout->v_t
;=====================
; calculation
vartend_data_out = func_advection(var_data_out,u_data_out,v_data_out)
vartend_data_out@long_name =long_name_out
vartend_data_out@units =units_out
;====================
; ensure saved as float not double
vartend_data_out_flt = tofloat(vartend_data_out)
copy_VarAtts(vartend_data_out,vartend_data_out_flt)
copy_VarCoords(vartend_data_out,vartend_data_out_flt)
;-- save to file
add_to_file(fout,vartend_data_out_flt , var_name_out)
delete([/var_data_out, u_data_out, v_data_out, vartend_data_out, vartend_data_out_flt/])
end