5 |
contains |
contains |
6 |
|
|
7 |
SUBROUTINE histdef(fileid, varname, ptitle, unit, xsize, ysize, & |
SUBROUTINE histdef(fileid, varname, ptitle, unit, xsize, ysize, & |
8 |
horiid, pzsize, par_oriz, par_szz, pzid, popp, pfreq_opp, pfreq_wrt) |
horiid, pzsize, oriz, szz, zid, opp, pfreq_opp, pfreq_wrt) |
9 |
|
|
10 |
! With this subroutine each variable to be archived on the history |
! With this subroutine each variable to be archived on the history |
11 |
! tape should be declared. It gives the user the choise of |
! tape should be declared. It gives the user the choice of |
12 |
! operation to be performed on the variables, the frequency of |
! operation to be performed on the variable, the frequency of |
13 |
! this operation and the frequency of the archiving. |
! this operation and the frequency of the archiving. |
14 |
|
|
|
USE find_str_m, ONLY: find_str |
|
|
USE mathelp, ONLY: buildop |
|
15 |
USE errioipsl, ONLY: histerr |
USE errioipsl, ONLY: histerr |
16 |
|
USE find_str_m, ONLY: find_str |
17 |
USE histcom_var, ONLY: buff_pos, deltat, freq_opp, freq_wrt, fullop, & |
USE histcom_var, ONLY: buff_pos, deltat, freq_opp, freq_wrt, fullop, & |
18 |
full_size, itau0, last_opp, last_opp_chk, last_wrt, last_wrt_chk, & |
full_size, itau0, last_opp, last_opp_chk, last_wrt, last_wrt_chk, & |
19 |
missing_val, name, name_length, nbopp, nbopp_max, nb_hax, nb_opp, & |
missing_val, name, name_length, nbopp, nbopp_max, nb_hax, nb_opp, & |
21 |
slab_ori, slab_sz, sopps, tax_last, tax_name, tax_name_length, & |
slab_ori, slab_sz, sopps, tax_last, tax_name, tax_name_length, & |
22 |
title, topp, unit_name, var_axid, var_haxid, var_zaxid, zax_name, & |
title, topp, unit_name, var_axid, var_haxid, var_zaxid, zax_name, & |
23 |
zax_size, zorig, zsize |
zax_size, zorig, zsize |
24 |
USE calendar, ONLY: ioget_calendar |
USE ioget_calendar_m, ONLY: ioget_calendar |
25 |
|
USE mathelp, ONLY: buildop |
26 |
|
|
27 |
INTEGER, INTENT (IN):: fileid |
INTEGER, INTENT(IN):: fileid |
28 |
! (ID of the file the variable should be archived in) |
! (ID of the file the variable should be archived in) |
29 |
|
|
30 |
CHARACTER (len=*), INTENT (IN):: varname |
CHARACTER(len=*), INTENT(IN):: varname |
31 |
! (name of the variable, short and easy to remember) |
! (name of the variable, short and easy to remember) |
32 |
|
|
33 |
CHARACTER (len=*), INTENT (IN):: ptitle ! full name of the variable |
CHARACTER(len=*), INTENT(IN):: ptitle ! full name of the variable |
34 |
CHARACTER (len=*), INTENT (IN):: unit ! units of the variable |
CHARACTER(len=*), INTENT(IN):: unit ! units of the variable |
35 |
|
|
36 |
! The next 3 arguments give the size of that data |
! The next 3 arguments give the size of that data |
37 |
! that will be passed to histwrite. The zoom will be |
! that will be passed to histwrite. The zoom will be |
38 |
! done there with the horizontal information obtained |
! done there with the horizontal information obtained |
39 |
! in "histbeg" and the vertical information to follow. |
! in "histbeg" and the vertical information to follow. |
40 |
INTEGER, INTENT (IN):: xsize, ysize ! Sizes in X and Y directions |
INTEGER, INTENT(IN):: xsize, ysize ! Sizes in X and Y directions |
41 |
INTEGER, INTENT (IN):: horiid ! ID of the horizontal axis |
INTEGER, INTENT(IN):: horiid ! ID of the horizontal axis |
42 |
|
|
43 |
! The next two arguments give the vertical zoom to use. |
! The next two arguments give the vertical zoom to use. |
44 |
|
|
45 |
INTEGER, INTENT (IN):: pzsize |
INTEGER, INTENT(IN):: pzsize |
46 |
! (Size in Z direction (If 1 then no axis is declared for this |
! (Size in Z direction (If 1 then no axis is declared for this |
47 |
! variable and pzid is not used) |
! variable and zid is not used) |
48 |
|
|
49 |
INTEGER, INTENT (IN):: par_oriz ! Off set of the zoom |
INTEGER, INTENT(IN):: oriz ! Off set of the zoom |
50 |
INTEGER, INTENT (IN):: par_szz ! Size of the zoom |
INTEGER, INTENT(IN):: szz ! Size of the zoom |
51 |
|
|
52 |
INTEGER, INTENT (IN):: pzid |
INTEGER, INTENT(IN):: zid |
53 |
! (ID of the vertical axis to use. It has to have the size of the zoom.) |
! (ID of the vertical axis to use. It has to have the size of the zoom.) |
54 |
|
|
55 |
CHARACTER (len=*), INTENT (IN):: popp |
CHARACTER(len=*), INTENT(IN):: opp |
56 |
! Operation to be performed. The following options exist today: |
! Operation to be performed. The following options exist today: |
57 |
! inst: keeps instantaneous values for writting |
! inst: keeps instantaneous values for writting |
58 |
! ave: Computes the average from call between writes |
! ave: Computes the average from call between writes |
59 |
|
|
60 |
REAL, INTENT (IN):: pfreq_opp ! Frequency of this operation (in seconds) |
REAL, INTENT(IN):: pfreq_opp ! Frequency of this operation (in seconds) |
61 |
|
|
62 |
REAL, INTENT (IN):: pfreq_wrt |
REAL, INTENT(IN):: pfreq_wrt |
63 |
! (Frequency at which the variable should be written, in seconds) |
! (Frequency at which the variable should be written, in seconds) |
64 |
|
|
65 |
! Local: |
! Local: |
66 |
|
|
67 |
INTEGER:: iv, i, nb |
INTEGER:: iv, i, nb |
68 |
CHARACTER (len=70):: str70, str71, str72 |
CHARACTER(len=70):: str70, str71, str72 |
69 |
CHARACTER (len=20):: tmp_name |
CHARACTER(len=20):: tmp_name |
70 |
CHARACTER (len=20):: str20, tab_str20(nb_var_max) |
CHARACTER(len=20):: str20, tab_str20(nb_var_max) |
71 |
INTEGER:: tab_str20_length(nb_var_max) |
INTEGER:: tab_str20_length(nb_var_max) |
72 |
CHARACTER (len=40):: str40, tab_str40(nb_var_max) |
CHARACTER(len=40):: str40, tab_str40(nb_var_max) |
73 |
INTEGER:: tab_str40_length(nb_var_max) |
INTEGER:: tab_str40_length(nb_var_max) |
74 |
CHARACTER (len=10):: str10 |
CHARACTER(len=10):: str10 |
75 |
CHARACTER (len=80):: tmp_str80 |
CHARACTER(len=80):: tmp_str80 |
76 |
CHARACTER (len=7):: tmp_topp, tmp_sopp(nbopp_max) |
CHARACTER(len=7):: tmp_topp, tmp_sopp(nbopp_max) |
77 |
CHARACTER (len=120):: ex_topps |
CHARACTER(len=120):: ex_topps |
78 |
REAL:: tmp_scal(nbopp_max), un_an, un_jour, test_fopp, test_fwrt |
REAL:: tmp_scal(nbopp_max), un_an, un_jour, test_fopp, test_fwrt |
79 |
INTEGER:: pos, buff_sz |
INTEGER:: pos, buff_sz |
80 |
|
|
120 |
|
|
121 |
! 1.1 decode the operations |
! 1.1 decode the operations |
122 |
|
|
123 |
fullop(fileid, iv) = popp |
fullop(fileid, iv) = opp |
124 |
tmp_str80 = popp |
tmp_str80 = opp |
125 |
CALL buildop(tmp_str80, ex_topps, tmp_topp, nbopp_max, missing_val, & |
CALL buildop(tmp_str80, ex_topps, tmp_topp, nbopp_max, missing_val, & |
126 |
tmp_sopp, tmp_scal, nbopp(fileid, iv)) |
tmp_sopp, tmp_scal, nbopp(fileid, iv)) |
127 |
|
|
145 |
scsize(fileid, iv, :) = (/ xsize, ysize, pzsize/) |
scsize(fileid, iv, :) = (/ xsize, ysize, pzsize/) |
146 |
|
|
147 |
zorig(fileid, iv, 1:3) = (/ slab_ori(fileid, 1), slab_ori(fileid, 2), & |
zorig(fileid, iv, 1:3) = (/ slab_ori(fileid, 1), slab_ori(fileid, 2), & |
148 |
par_oriz/) |
oriz/) |
149 |
|
|
150 |
zsize(fileid, iv, 1:3) = (/ slab_sz(fileid, 1), slab_sz(fileid, 2), & |
zsize(fileid, iv, 1:3) = (/ slab_sz(fileid, 1), slab_sz(fileid, 2), & |
151 |
par_szz/) |
szz/) |
152 |
|
|
153 |
! Is the size of the full array the same as that of the coordinates ? |
! Is the size of the full array the same as that of the coordinates ? |
154 |
|
|
191 |
|
|
192 |
! 2.2 Check the vertical coordinates if needed |
! 2.2 Check the vertical coordinates if needed |
193 |
|
|
194 |
IF (par_szz>1) THEN |
IF (szz>1) THEN |
195 |
|
|
196 |
! Does the vertical coordinate exist ? |
! Does the vertical coordinate exist ? |
197 |
|
|
198 |
IF (pzid>nb_zax(fileid)) THEN |
IF (zid>nb_zax(fileid)) THEN |
199 |
WRITE (str70, '("The vertical coordinate chosen for variable ", a)' & |
WRITE (str70, '("The vertical coordinate chosen for variable ", a)' & |
200 |
) trim(tmp_name) |
) trim(tmp_name) |
201 |
str71 = ' Does not exist.' |
str71 = ' Does not exist.' |
204 |
|
|
205 |
! Is the vertical size of the variable equal to that of the axis ? |
! Is the vertical size of the variable equal to that of the axis ? |
206 |
|
|
207 |
IF (par_szz/=zax_size(fileid, pzid)) THEN |
IF (szz/=zax_size(fileid, zid)) THEN |
208 |
str20 = zax_name(fileid, pzid) |
str20 = zax_name(fileid, zid) |
209 |
str70 = 'The size of the zoom does not correspond ' // & |
str70 = 'The size of the zoom does not correspond ' // & |
210 |
'to the size of the chosen vertical axis' |
'to the size of the chosen vertical axis' |
211 |
WRITE (str71, '("Size of zoom in z:", I4)') par_szz |
WRITE (str71, '("Size of zoom in z:", I4)') szz |
212 |
WRITE (str72, '("Size declared for axis ", a, ":", I4)') & |
WRITE (str72, '("Size declared for axis ", a, ":", I4)') & |
213 |
trim(str20), zax_size(fileid, pzid) |
trim(str20), zax_size(fileid, zid) |
214 |
CALL histerr(3, 'histdef', str70, str71, str72) |
CALL histerr(3, 'histdef', str70, str71, str72) |
215 |
END IF |
END IF |
216 |
|
|
217 |
! Is the zoom smaler that the total size of the variable ? |
! Is the zoom smaler that the total size of the variable ? |
218 |
|
|
219 |
IF (pzsize<par_szz) THEN |
IF (pzsize<szz) THEN |
220 |
str20 = zax_name(fileid, pzid) |
str20 = zax_name(fileid, zid) |
221 |
str70 = 'The vertical size of variable ' // & |
str70 = 'The vertical size of variable ' // & |
222 |
'is smaller than that of the zoom.' |
'is smaller than that of the zoom.' |
223 |
WRITE (str71, '("Declared vertical size of data:", I5)') pzsize |
WRITE (str71, '("Declared vertical size of data:", I5)') pzsize |
224 |
WRITE (str72, '("Size of zoom for variable ", a, " = ", I5)') & |
WRITE (str72, '("Size of zoom for variable ", a, " = ", I5)') & |
225 |
trim(tmp_name), par_szz |
trim(tmp_name), szz |
226 |
CALL histerr(3, 'histdef', str70, str71, str72) |
CALL histerr(3, 'histdef', str70, str71, str72) |
227 |
END IF |
END IF |
228 |
var_zaxid(fileid, iv) = pzid |
var_zaxid(fileid, iv) = zid |
229 |
ELSE |
ELSE |
230 |
var_zaxid(fileid, iv) = -99 |
var_zaxid(fileid, iv) = -99 |
231 |
END IF |
END IF |