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

Last change on this file since 378 was 370, checked in by pinsard, 16 years ago

improvemnts of headers (typo, links)

  • Property svn:keywords set to Id
File size: 1.9 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; <pro>cm_4mesh</pro>
15; <pro>cm_4data</pro>
16;
17; @restrictions
18; common variable (<pro>cm_4mesh</pro>) romszinfos must be correctly defined
19;
20; @history
21; Sept 2006 Sebastien Masson (smasson\@lodyc.jussieu.fr)
22;
23; @version
24; $Id$
25;
26;-
27FUNCTION romsdepth
28;
29  compile_opt idl2, strictarrsubs
30;
31@cm_4mesh
32@cm_4data
33;
34  theta_s = romszinfos.theta_s
35  IF theta_s EQ -1 THEN return, -1
36  theta_b = romszinfos.theta_b
37  IF theta_b EQ -1 THEN return, -1
38  hc      = romszinfos.hc
39  IF hc EQ -1 THEN return, -1
40  hroms = romszinfos.h
41  IF hroms[0] EQ -1 THEN return, -1
42  zeta = romszinfos.zeta
43  IF zeta[0] EQ -1 THEN return, -1
44  type = vargrid
45;
46  grille, -1, -1, -1, -1, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz
47  hroms = hroms[firstx:lastx, firsty:lasty]
48  nt = n_elements(zeta)/nx/ny
49;
50  cff1 = 1./sinh(theta_s)
51  cff2 = 0.5/tanh(0.5*theta_s)
52;
53  IF type EQ 'W' THEN BEGIN
54    sc = (findgen(jpk)-jpk)/jpk
55;  sc = (dindgen(jpk+1)-jpk)/jpk
56;  jpk = jpk+1
57  ENDIF ELSE BEGIN
58    sc = (findgen(jpk)-jpk-0.5+1)/jpk
59  ENDELSE
60;
61  cs = (1.-theta_b)*cff1*sinh(theta_s*sc)+theta_b*(cff2*tanh(theta_s*(sc+0.5))-0.5)
62  cff = hc*(sc-cs)
63  cff1 = cs
64;
65  hinv = 1./hroms
66  hinv = hinv[*]#replicate(1., jpk)
67; put a z dimension to zeta
68  zeta = transpose(temporary(zeta))
69  zeta = reform((temporary(zeta))[*]#replicate(1., jpk), nt, ny, nx, jpk, /overwrite)
70  zeta = transpose(temporary(zeta), [2, 1, 3, 0])
71
72  z0 = replicate(1., nx*ny)#cff[*] + (replicate(1., nx*ny)#cff1[*]) * (hroms[*]#replicate(1., jpk))
73  z = (z0[*]#replicate(1., nt)) + temporary(zeta) * ((1.+z0*hinv)[*]#replicate(1., nt))
74  z = reform(z, nx, ny, jpk, nt, /overwrite)
75  z = -1*reverse(temporary(z), 3)
76
77  return, z
78end
Note: See TracBrowser for help on using the repository browser.