source: trunk/SRC/Grid/romsdepth.pro @ 173

Last change on this file since 173 was 172, checked in by smasson, 18 years ago

bugfix + manage roms outputs

  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1;+
2; @file_comments
3; compute depth of ROMS outputs according to ROMS parameters
4; stored in the common variable (cm_4mesh) romszinfos
5;
6; @categories
7; Grid
8;
9; @returns
10; the depth of the points (or -1 if error)
11;
12; @uses
13; cm_4mesh cm_4data
14;
15; @restrictions
16; common variable (cm_4mesh) romszinfos must be correctly defined
17;
18; @history
19; Sept 2006 Sebastien Masson (smasson\@lodyc.jussieu.fr)
20;
21; @version
22; $Id$
23;-
24FUNCTION romsdepth
25;
26@cm_4mesh
27@cm_4data
28;
29  theta_s = romszinfos.theta_s
30  IF theta_s EQ -1 THEN return, -1
31  theta_b = romszinfos.theta_b
32  IF theta_b EQ -1 THEN return, -1
33  hc      = romszinfos.hc
34  IF hc EQ -1 THEN return, -1
35  hroms = romszinfos.h
36  IF hroms[0] EQ -1 THEN return, -1
37  zeta = romszinfos.zeta
38  IF zeta[0] EQ -1 THEN return, -1
39  type = vargrid
40;
41  CASE strupcase(vargrid) OF
42    'U':BEGIN
43      nx = nxu
44      ny = nyu
45    END
46    'V':BEGIN
47      nx = nxv
48      ny = nyv
49    END
50    'F':BEGIN
51      nx = nxf
52      ny = nyf
53    END
54    ELSE:BEGIN
55      nx = nxt
56      ny = nyt
57    END
58  ENDCASE
59  nt = n_elements(zeta)/nx/ny
60;
61  cff1 = 1./sinh(theta_s)
62  cff2 = 0.5/tanh(0.5*theta_s)
63;
64  IF type EQ 'W' THEN BEGIN
65    sc = (findgen(jpk)-jpk)/jpk     
66;  sc = (dindgen(jpk+1)-jpk)/jpk     
67;  jpk = jpk+1
68  ENDIF ELSE BEGIN
69    sc = (findgen(jpk)-jpk-0.5+1)/jpk 
70  ENDELSE
71;
72  cs = (1.-theta_b)*cff1*sinh(theta_s*sc)+theta_b*(cff2*tanh(theta_s*(sc+0.5))-0.5)
73  cff = hc*(sc-cs)
74  cff1 = cs
75;
76  hinv = 1./hroms
77  hinv = hinv[*]#replicate(1., jpk)
78; put a z dimenstion to zeta
79  zeta = transpose(temporary(zeta))
80  zeta = reform((temporary(zeta))[*]#replicate(1., jpk), nt, ny, nx, jpk, /overwrite)
81  zeta = transpose(temporary(zeta), [2, 1, 3, 0])
82
83  z0 = replicate(1., nx*ny)#cff[*] + (replicate(1., nx*ny)#cff1[*]) * (hroms[*]#replicate(1., jpk))
84  z = (z0[*]#replicate(1., nt)) + temporary(zeta) * ((1.+z0*hinv)[*]#replicate(1., nt))
85  z = reform(z, nx, ny, jpk, nt, /overwrite)
86  z = -1*reverse(temporary(z), 3)
87
88  return, z
89end
Note: See TracBrowser for help on using the repository browser.