source: trunk/procs/macros/make_eos.pro @ 2

Last change on this file since 2 was 2, checked in by post_it, 17 years ago

Initial import from ~/POST_IT/

File size: 3.5 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME: RHOPN
6;
7; PURPOSE:
8;       compute rhopn   potential volumic mass
9;
10; CATEGORY:
11;       calculation
12;
13; CALLING SEQUENCE:
14;       tableau=rhopn(t,s)
15;
16; INPUTS:
17;       t temperature
18;       s salinity
19;
20; COMMON BLOCKS:
21;       common.pro     
22;
23; REFERENCE:
24;       Compute the potential volumic mass (Kg/m3) from now potential
25;       temperature and salinity fields using Jackett and McDougall
26;       (1994) equation of state.
27;       It is computed directly as a function of
28;       potential temperature relative to the surface (the opa tn
29;       variable), salt and pressure (assuming no pressure variation
30;       along geopotential surfaces, i.e. the pressure p in decibars
31;       is approximated by the depth in meters.
32;              rhop(t,s)  = rho(t,s,0)
33;         with pressure                      p        decibars
34;              potential temperature         t        deg celsius
35;              salinity                      s        psu
36;              reference volumic mass        rau0     kg/m**3
37;              in situ volumic mass          rho      kg/m**3
38;
39;         Check value: rho = 1059.8204 kg/m**3 for p=10000 dbar,
40;          t = 40 deg celcius, s=40 psu
41;
42;       Jackett, D.R., and T.J. McDougall. J. Atmos. Ocean. Tech., 1994
43;
44;   MODIFICATION HISTORY:
45;       Maurice Imbard
46;       Eric Guilyardi - adaptation to post_it
47;-
48;------------------------------------------------------------
49;------------------------------------------------------------
50;------------------------------------------------------------
51FUNCTION make_eos, file_name, ncdf_db,  TIME_1 = time_1,  TIME_2 =  time_2, ZMTYP = zmtyp
52;
53@common
54@com_eg
55;
56;
57; Read T and S
58;
59   tn = nc_read(file_name,'votemper', ncdf_db,  TIME_1 = time_1,  TIME_2 =  time_2, no_mean = 1)
60   sn = nc_read(file_name,'vosaline', ncdf_db,  TIME_1 = time_1,  TIME_2 =  time_2, no_mean = 1)
61
62; declarations
63;
64   t=tn.data
65   s=sn.data
66   idxt=where(t eq valmask)
67   idxs=where(s eq valmask)
68   IF idxt[0] NE -1 THEN t(idxt)=0.
69   IF idxs[0] NE -1 THEN s(idxs)=0.
70;
71; potential volumic mass
72;
73   sr=sqrt(abs(s))
74   r1=((((6.536332E-9*t-1.120083E-6)*t+1.001685E-4)*t $
75        -9.095290E-3)*t+6.793952E-2)*t+999.842594
76   r2=(((5.3875E-9*t-8.2467E-7)*t+7.6438E-5)*t-4.0899E-3)*t+8.24493E-1
77   r3=(-1.6546E-6*t+1.0227E-4)*t-5.72466E-3
78   rhopn = ( ( 4.8314E-4*s + r3*sr +r2)*s +r1)
79
80   IF idxs[0] NE -1 THEN rhopn(idxt) = valmask
81
82   fdirec = tn.direc
83   flegend = ''
84
85   remove_dim = 0
86   IF vert_switch ge 1 THEN BEGIN
87      old_boite = [lon1, lon2, lat1, lat2, prof1, prof2]
88      domdef
89      print, '      Average in vertical domain ', vert_type, vert_mean
90      CASE vert_type OF
91         'z': zmean = grossemoyenne(rhopn, 'z', boite = vert_mean, NAN =1.e20)
92         ELSE: zmean = grossemoyenne(rhopn, 'z', boite = vert_mean, NAN =1.e20, /zindex)
93      ENDCASE
94      rhopn = zmean
95      domdef, old_boite
96      vert_switch = 2
97      remove_dim = 1
98      fdirec = 'xyt'
99      name_suff = ' averaged in '+vert_type+'['+strtrim(string(vert_mean(0)), 2)+','+strtrim(string(vert_mean(1)), 2)+']'
100      flegend = name_suff
101   ENDIF
102
103   fieldr = {name: '', data: rhopn, legend: '', units: '', origin: '', dim: 0, direc:''}
104
105   fieldr.origin = tn.origin
106   fieldr.dim = tn.dim - remove_dim
107   fieldr.direc = fdirec
108   fieldr.legend = flegend
109 
110   return, fieldr
111end
Note: See TracBrowser for help on using the repository browser.