Changeset 1023 for IOIPSL


Ignore:
Timestamp:
05/18/10 12:27:11 (12 years ago)
Author:
bellier
Message:

New version with bounds for reductive time operations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • IOIPSL/trunk/src/histcom.f90

    r1011 r1023  
    104104  LOGICAL :: hist_calc_rng=.FALSE.,hist_wrt_rng=.FALSE. 
    105105!-Book keeping of the axes 
    106   INTEGER :: tdimid,tax_last 
     106  INTEGER :: tdimid,tbndid=-1,tax_last 
     107  LOGICAL :: l_bnd 
    107108  CHARACTER(LEN=40) :: tax_name 
    108109!- 
     
    127128!-Counter of elements (variables, time-horizontal-vertical axis 
    128129  INTEGER :: n_var=0,n_tax=0,n_hax=0,n_zax=0 
    129 !-NETCDF dimension IDs for time-longitude-latitude 
    130   INTEGER :: tid,xid,yid 
     130!-NETCDF dimension IDs for time-[time_bounds]-longitude-latitude 
     131  INTEGER :: tid,bid,xid,yid 
    131132!-General definitions in the NETCDF file 
    132133  INTEGER,DIMENSION(2) :: full_size=0,slab_ori,slab_siz 
     
    13211322    IF (pos < 0) THEN 
    13221323      W_F(idf)%n_tax = W_F(idf)%n_tax+1 
     1324      W_F(idf)%W_V(iv)%l_bnd = & 
     1325 &      (TRIM(W_F(idf)%W_V(iv)%topp) /= 'inst') 
    13231326      W_F(idf)%W_V(W_F(idf)%n_tax)%tax_name = str40 
    13241327      W_F(idf)%W_V(W_F(idf)%n_tax)%tax_last = 0 
     
    13671370  REAL :: rtime0 
    13681371  CHARACTER(LEN=30) :: str30 
     1372  CHARACTER(LEN=35) :: str35 
    13691373  CHARACTER(LEN=120) :: assoc 
    13701374  CHARACTER(LEN=70) :: str70 
     
    13731377 &     'JUL','AUG','SEP','OCT','NOV','DEC' /) 
    13741378  CHARACTER(LEN=7) :: tmp_opp 
     1379  LOGICAL :: l_b 
    13751380  LOGICAL :: l_dbg 
    13761381!--------------------------------------------------------------------- 
     
    13821387!- 
    13831388  IF (l_dbg) WRITE(*,*) "histend : 1.0" 
    1384 !--- 
     1389!- 
     1390! 1.1 Define the time dimensions needed for this file 
     1391!- 
    13851392  iret = NF90_DEF_DIM (nfid,'time_counter', & 
    13861393 &                     NF90_UNLIMITED,W_F(idf)%tid) 
    1387 !- 
    1388 ! 1.1 Define all the time axes needed for this file 
     1394  DO iv=1,W_F(idf)%n_var 
     1395    IF (W_F(idf)%W_V(iv)%l_bnd) THEN 
     1396      iret = NF90_DEF_DIM (nfid,'tbnds',2,W_F(idf)%bid) 
     1397      EXIT 
     1398    ENDIF 
     1399  ENDDO 
     1400!- 
     1401! 1.2 Define all the time axes needed for this file 
    13891402!- 
    13901403  DO itx=1,W_F(idf)%n_tax 
    13911404    dims(1) = W_F(idf)%tid 
     1405    l_b = (INDEX(W_F(idf)%W_V(itx)%tax_name,"t_op_") == 1) 
    13921406    IF (W_F(idf)%n_tax > 1) THEN 
    13931407      str30 = W_F(idf)%W_V(itx)%tax_name 
    13941408    ELSE 
    13951409      str30 = "time_counter" 
     1410    ENDIF 
     1411    IF (l_b) THEN 
     1412      str35 = TRIM(str30)//'_bnds' 
    13961413    ENDIF 
    13971414    iret = NF90_DEF_VAR (nfid,TRIM(str30),NF90_REAL8, & 
     
    14451462    iret = NF90_PUT_ATT (nfid,W_F(idf)%W_V(itx)%tdimid, & 
    14461463 &           'time_origin',TRIM(str70)) 
     1464!--- 
     1465    IF (l_b) THEN 
     1466      iret = NF90_PUT_ATT (nfid,W_F(idf)%W_V(itx)%tdimid, & 
     1467 &             'bounds',TRIM(str35)) 
     1468      dims(1:2) = (/ W_F(idf)%bid,W_F(idf)%tid /) 
     1469      iret = NF90_DEF_VAR (nfid,TRIM(str35),NF90_REAL8, & 
     1470 &            dims(1:2),W_F(idf)%W_V(itx)%tbndid) 
     1471    ENDIF 
    14471472  ENDDO 
    14481473!- 
     
    15441569      IF (itax > 0) THEN 
    15451570        IF (W_F(idf)%n_tax > 1) THEN 
    1546           str30 = "t_"//W_F(idf)%W_V(itax)%tax_name 
     1571          str30 = W_F(idf)%W_V(itax)%tax_name 
    15471572        ELSE 
    15481573          str30 = "time_counter" 
     
    18391864!- 
    18401865  REAL :: rtime 
     1866  REAL,DIMENSION(2) :: t_bnd 
    18411867  CHARACTER(LEN=7) :: tmp_opp 
    18421868  REAL,ALLOCATABLE,DIMENSION(:),SAVE :: tbf_2 
     
    20202046    IF (     (TRIM(tmp_opp) /= "inst") & 
    20212047 &      .AND.(TRIM(tmp_opp) /= "once") ) THEN 
    2022       rtime = (rtime+W_F(idf)%W_V(iv)%last_wrt*W_F(idf)%deltat)/2.0 
     2048      t_bnd(1:2) = (/ W_F(idf)%W_V(iv)%last_wrt*W_F(idf)%deltat,rtime /) 
     2049      rtime = (t_bnd(1)+t_bnd(2))/2.0 
    20232050    ENDIF 
    20242051!- 
     
    20372064        iret = NF90_PUT_VAR (nfid,W_F(idf)%W_V(itax)%tdimid, & 
    20382065 &               (/ rtime /),start=(/ itime /),count=(/ 1 /)) 
     2066        IF (W_F(idf)%W_V(itax)%tbndid > 0) THEN 
     2067          iret = NF90_PUT_VAR (nfid,W_F(idf)%W_V(itax)%tbndid, & 
     2068 &                 t_bnd,start=(/ 1,itime /),count=(/ 2,1 /)) 
     2069        ENDIF 
    20392070        W_F(idf)%W_V(itax)%tax_last = itime 
    20402071      ENDIF 
Note: See TracChangeset for help on using the changeset viewer.