1 | ;+ |
---|
2 | ; |
---|
3 | ; @uses |
---|
4 | ; <pro>common</pro> |
---|
5 | ; |
---|
6 | ; @version |
---|
7 | ; $Id$ |
---|
8 | ; |
---|
9 | ;- |
---|
10 | FUNCTION msfz, vnname, date1, date2 $ |
---|
11 | , MASK=mask $ |
---|
12 | , ORCA=orca $ |
---|
13 | , _EXTRA=extra |
---|
14 | ; |
---|
15 | compile_opt idl2, strictarrsubs |
---|
16 | ; |
---|
17 | @common |
---|
18 | ; |
---|
19 | domdef,0,100000 |
---|
20 | ;------------------------- |
---|
21 | case n_params() of |
---|
22 | 0:msf=read_ncdf('vomecrty',0,/timestep,_EXTRA=extra,iodir=iodir,/nostruct,/tout) |
---|
23 | 1:begin |
---|
24 | if size(vnname,/type) eq 7 then $ |
---|
25 | msf=read_ncdf(vnname,0,/timestep,_EXTRA=extra,iodir=iodir,/nostruct,/tout) $ |
---|
26 | else msf=vnname |
---|
27 | end |
---|
28 | 2:msf=read_ncdf(vnname,date1,_EXTRA=extra,iodir=iodir,/nostruct,/tout) |
---|
29 | 3:msf=read_ncdf(vnname,date1,date2,_EXTRA=extra,iodir=iodir,/nostruct,/tout) |
---|
30 | endcase |
---|
31 | if n_params() eq 3 then msf=grossemoyenne(msf,'t') |
---|
32 | msf=msf*vmask() |
---|
33 | if keyword_set(mask) then begin |
---|
34 | ; print, 'subdomain: use of mask argument' |
---|
35 | if (size(mask))[0] eq 2 then mask=reform(mask[*]#replicate(1,jpk),jpi,jpj,jpk) |
---|
36 | msf=msf*mask |
---|
37 | endif else mask=1 |
---|
38 | ;print, mask |
---|
39 | msf=moyenne(msf,'x',/integration) |
---|
40 | msf=1e-6*msf |
---|
41 | e3t2d=replicate(1,jpj)#e3t |
---|
42 | msf=total(msf*e3t2d,2,/cumulative) |
---|
43 | msf=shift(msf,0,1) |
---|
44 | ; if sub basin, substract the bottom value (equivalent to upward integration) |
---|
45 | if keyword_set(mask) then begin |
---|
46 | for k=0, jpk-1 do begin |
---|
47 | for j=0,jpj-1 do begin |
---|
48 | msf[j,k] = msf[j,k] - msf[j,jpk-1] |
---|
49 | endfor |
---|
50 | endfor |
---|
51 | endif |
---|
52 | varname='Meridional Stream Function' |
---|
53 | varunit='Sv' |
---|
54 | vargrid='W' |
---|
55 | if keyword_set(orca) then begin |
---|
56 | case orca of |
---|
57 | 2:ixref=51-1 |
---|
58 | .5:ixref=204-1 |
---|
59 | .25:ixref=408-1 |
---|
60 | else:ixref=0 |
---|
61 | endcase |
---|
62 | ixref=ixref-ixminmesh |
---|
63 | ixref=ixref+key_shift |
---|
64 | ixref=ixref mod jpi |
---|
65 | if ixref lt 0 then ixref=ixref+jpi |
---|
66 | endif else ixref=0 |
---|
67 | domdef,ixref,ixref,0,jpj-1,0,jpk-1,/index,grille=['T','W'] |
---|
68 | ;terre=where(total(vmask()*mask,1) eq 0) |
---|
69 | ;if n_elements(valmask) eq 0 then valmask=1e20 |
---|
70 | ;if terre[0] ne -1 then msf[terre]=valmask |
---|
71 | ;------------------------ |
---|
72 | return, msf |
---|
73 | end |
---|