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

Last change on this file since 231 was 231, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

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