--- trunk/libf/IOIPSL/Histcom/histdef.f90 2012/04/20 14:58:43 61 +++ trunk/IOIPSL/Histcom/histdef.f 2014/04/01 15:50:48 93 @@ -5,16 +5,15 @@ contains SUBROUTINE histdef(fileid, varname, ptitle, unit, xsize, ysize, & - horiid, pzsize, par_oriz, par_szz, pzid, popp, pfreq_opp, pfreq_wrt) + horiid, pzsize, oriz, szz, zid, opp, pfreq_opp, pfreq_wrt) ! With this subroutine each variable to be archived on the history - ! tape should be declared. It gives the user the choise of - ! operation to be performed on the variables, the frequency of + ! tape should be declared. It gives the user the choice of + ! operation to be performed on the variable, the frequency of ! this operation and the frequency of the archiving. - USE find_str_m, ONLY: find_str - USE mathelp, ONLY: buildop USE errioipsl, ONLY: histerr + USE find_str_m, ONLY: find_str USE histcom_var, ONLY: buff_pos, deltat, freq_opp, freq_wrt, fullop, & full_size, itau0, last_opp, last_opp_chk, last_wrt, last_wrt_chk, & missing_val, name, name_length, nbopp, nbopp_max, nb_hax, nb_opp, & @@ -22,59 +21,60 @@ slab_ori, slab_sz, sopps, tax_last, tax_name, tax_name_length, & title, topp, unit_name, var_axid, var_haxid, var_zaxid, zax_name, & zax_size, zorig, zsize - USE calendar, ONLY: ioget_calendar + USE ioget_calendar_m, ONLY: ioget_calendar_real + USE mathelp, ONLY: buildop - INTEGER, INTENT (IN):: fileid + INTEGER, INTENT(IN):: fileid ! (ID of the file the variable should be archived in) - CHARACTER (len=*), INTENT (IN):: varname + CHARACTER(len=*), INTENT(IN):: varname ! (name of the variable, short and easy to remember) - CHARACTER (len=*), INTENT (IN):: ptitle ! full name of the variable - CHARACTER (len=*), INTENT (IN):: unit ! units of the variable + CHARACTER(len=*), INTENT(IN):: ptitle ! full name of the variable + CHARACTER(len=*), INTENT(IN):: unit ! units of the variable ! The next 3 arguments give the size of that data ! that will be passed to histwrite. The zoom will be ! done there with the horizontal information obtained ! in "histbeg" and the vertical information to follow. - INTEGER, INTENT (IN):: xsize, ysize ! Sizes in X and Y directions - INTEGER, INTENT (IN):: horiid ! ID of the horizontal axis + INTEGER, INTENT(IN):: xsize, ysize ! Sizes in X and Y directions + INTEGER, INTENT(IN):: horiid ! ID of the horizontal axis ! The next two arguments give the vertical zoom to use. - INTEGER, INTENT (IN):: pzsize + INTEGER, INTENT(IN):: pzsize ! (Size in Z direction (If 1 then no axis is declared for this - ! variable and pzid is not used) + ! variable and zid is not used) - INTEGER, INTENT (IN):: par_oriz ! Off set of the zoom - INTEGER, INTENT (IN):: par_szz ! Size of the zoom + INTEGER, INTENT(IN):: oriz ! Off set of the zoom + INTEGER, INTENT(IN):: szz ! Size of the zoom - INTEGER, INTENT (IN):: pzid + INTEGER, INTENT(IN):: zid ! (ID of the vertical axis to use. It has to have the size of the zoom.) - CHARACTER (len=*), INTENT (IN):: popp + CHARACTER(len=*), INTENT(IN):: opp ! Operation to be performed. The following options exist today: ! inst: keeps instantaneous values for writting ! ave: Computes the average from call between writes - REAL, INTENT (IN):: pfreq_opp ! Frequency of this operation (in seconds) + REAL, INTENT(IN):: pfreq_opp ! Frequency of this operation (in seconds) - REAL, INTENT (IN):: pfreq_wrt + REAL, INTENT(IN):: pfreq_wrt ! (Frequency at which the variable should be written, in seconds) ! Local: INTEGER:: iv, i, nb - CHARACTER (len=70):: str70, str71, str72 - CHARACTER (len=20):: tmp_name - CHARACTER (len=20):: str20, tab_str20(nb_var_max) + CHARACTER(len=70):: str70, str71, str72 + CHARACTER(len=20):: tmp_name + CHARACTER(len=20):: str20, tab_str20(nb_var_max) INTEGER:: tab_str20_length(nb_var_max) - CHARACTER (len=40):: str40, tab_str40(nb_var_max) + CHARACTER(len=40):: str40, tab_str40(nb_var_max) INTEGER:: tab_str40_length(nb_var_max) - CHARACTER (len=10):: str10 - CHARACTER (len=80):: tmp_str80 - CHARACTER (len=7):: tmp_topp, tmp_sopp(nbopp_max) - CHARACTER (len=120):: ex_topps + CHARACTER(len=10):: str10 + CHARACTER(len=80):: tmp_str80 + CHARACTER(len=7):: tmp_topp, tmp_sopp(nbopp_max) + CHARACTER(len=120):: ex_topps REAL:: tmp_scal(nbopp_max), un_an, un_jour, test_fopp, test_fwrt INTEGER:: pos, buff_sz @@ -120,8 +120,8 @@ ! 1.1 decode the operations - fullop(fileid, iv) = popp - tmp_str80 = popp + fullop(fileid, iv) = opp + tmp_str80 = opp CALL buildop(tmp_str80, ex_topps, tmp_topp, nbopp_max, missing_val, & tmp_sopp, tmp_scal, nbopp(fileid, iv)) @@ -145,10 +145,10 @@ scsize(fileid, iv, :) = (/ xsize, ysize, pzsize/) zorig(fileid, iv, 1:3) = (/ slab_ori(fileid, 1), slab_ori(fileid, 2), & - par_oriz/) + oriz/) zsize(fileid, iv, 1:3) = (/ slab_sz(fileid, 1), slab_sz(fileid, 2), & - par_szz/) + szz/) ! Is the size of the full array the same as that of the coordinates ? @@ -191,11 +191,11 @@ ! 2.2 Check the vertical coordinates if needed - IF (par_szz>1) THEN + IF (szz>1) THEN ! Does the vertical coordinate exist ? - IF (pzid>nb_zax(fileid)) THEN + IF (zid>nb_zax(fileid)) THEN WRITE (str70, '("The vertical coordinate chosen for variable ", a)' & ) trim(tmp_name) str71 = ' Does not exist.' @@ -204,28 +204,28 @@ ! Is the vertical size of the variable equal to that of the axis ? - IF (par_szz/=zax_size(fileid, pzid)) THEN - str20 = zax_name(fileid, pzid) + IF (szz/=zax_size(fileid, zid)) THEN + str20 = zax_name(fileid, zid) str70 = 'The size of the zoom does not correspond ' // & 'to the size of the chosen vertical axis' - WRITE (str71, '("Size of zoom in z:", I4)') par_szz + WRITE (str71, '("Size of zoom in z:", I4)') szz WRITE (str72, '("Size declared for axis ", a, ":", I4)') & - trim(str20), zax_size(fileid, pzid) + trim(str20), zax_size(fileid, zid) CALL histerr(3, 'histdef', str70, str71, str72) END IF ! Is the zoom smaler that the total size of the variable ? - IF (pzsize