New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 1730 for trunk/NEMO/OPA_SRC/SBC – NEMO

Ignore:
Timestamp:
2009-11-16T15:34:19+01:00 (15 years ago)
Author:
smasson
Message:

use integer in calendar, see ticket:601

Location:
trunk/NEMO/OPA_SRC/SBC
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/OPA_SRC/SBC/fldread.F90

    r1715 r1730  
    2424 
    2525   TYPE, PUBLIC ::   FLD_N      !: Namelist field informations 
    26       CHARACTER(len = 34) ::   clname      ! generic name of the NetCDF flux file 
    27       REAL(wp)            ::   freqh       ! frequency of each flux file 
    28       CHARACTER(len = 34) ::   clvar       ! generic name of the variable in the NetCDF flux file 
    29       LOGICAL             ::   ln_tint     ! time interpolation or not (T/F) 
    30       LOGICAL             ::   ln_clim     ! climatology or not (T/F) 
    31       CHARACTER(len = 7)  ::   cltype      ! type of data file 'daily', 'monthly' or yearly' 
    32       CHARACTER(len = 34) ::   wname       ! generic name of a NetCDF weights file to be used, blank if not 
    33       CHARACTER(len = 34) ::   vcomp       ! symbolic component name if a vector that needs rotation 
     26      CHARACTER(len = 256) ::   clname      ! generic name of the NetCDF flux file 
     27      INTEGER              ::   nfreqh      ! frequency of each flux file 
     28      CHARACTER(len = 34)  ::   clvar       ! generic name of the variable in the NetCDF flux file 
     29      LOGICAL              ::   ln_tint     ! time interpolation or not (T/F) 
     30      LOGICAL              ::   ln_clim     ! climatology or not (T/F) 
     31      CHARACTER(len = 7)   ::   cltype      ! type of data file 'daily', 'monthly' or yearly' 
     32      CHARACTER(len = 34)  ::   wname       ! generic name of a NetCDF weights file to be used, blank if not 
     33      CHARACTER(len = 34)  ::   vcomp       ! symbolic component name if a vector that needs rotation 
    3434                                           ! a string starting with "U" or "V" for each component    
    3535                                           ! chars 2 onwards identify which components go together   
     
    3939      CHARACTER(len = 256)            ::   clrootname   ! generic name of the NetCDF file 
    4040      CHARACTER(len = 256)            ::   clname       ! current name of the NetCDF file 
    41       REAL(wp)                        ::   freqh        ! frequency of each flux file 
     41      INTEGER                         ::   nfreqh       ! frequency of each flux file 
    4242      CHARACTER(len = 34)             ::   clvar        ! generic name of the variable in the NetCDF flux file 
    4343      LOGICAL                         ::   ln_tint      ! time interpolation or not (T/F) 
     
    4545      CHARACTER(len = 7)              ::   cltype       ! type of data file 'daily', 'monthly' or yearly' 
    4646      INTEGER                         ::   num          ! iom id of the jpfld files to be read 
    47       REAL(wp)                        ::   swap_sec     ! swapping time in second since Jan. 1st 00h of nit000 year 
    48       REAL(wp) , DIMENSION(2)         ::   rec_b        ! before record (1: index, 2: second since Jan. 1st 00h of nit000 year 
    49       REAL(wp) , DIMENSION(2)         ::   rec_a        ! after  record (1: index, 2: second since Jan. 1st 00h of nit000 year 
     47      INTEGER                         ::   nswap_sec    ! swapping time in second since Jan. 1st 00h of nit000 year 
     48      INTEGER , DIMENSION(2)          ::   nrec_b       ! before record (1: index, 2: second since Jan. 1st 00h of nit000 year) 
     49      INTEGER , DIMENSION(2)          ::   nrec_a       ! after  record (1: index, 2: second since Jan. 1st 00h of nit000 year) 
    5050      REAL(wp) , ALLOCATABLE, DIMENSION(:,:)   ::   fnow         ! input fields interpolated to now time step 
    5151      REAL(wp) , ALLOCATABLE, DIMENSION(:,:,:) ::   fdta         ! 2 consecutive record of input fields 
     
    121121      INTEGER  ::   jf         ! dummy indices 
    122122      INTEGER  ::   kw         ! index into wgts array 
    123       REAL(wp) ::   zreclast   ! last record to be read in the current year file 
    124       REAL(wp) ::   zsecend    ! number of second since Jan. 1st 00h of nit000 year at nitend 
     123      INTEGER  ::   ireclast   ! last record to be read in the current year file 
     124      INTEGER  ::   isecend    ! number of second since Jan. 1st 00h of nit000 year at nitend 
    125125      LOGICAL  ::   llnxtyr    ! open next year  file? 
    126126      LOGICAL  ::   llnxtmth   ! open next month file? 
     
    139139         ! 
    140140         ! read/update the after data? 
    141          IF( rsec_year + sec1jan000 > sd(jf)%swap_sec ) THEN  
     141         IF( nsec_year + nsec1jan000 > sd(jf)%nswap_sec ) THEN  
    142142 
    143143            IF( sd(jf)%ln_tint ) THEN         ! time interpolation: swap before record field 
     
    153153            IF( sd(jf)%ln_tint ) THEN 
    154154               ! if we do time interpolation we will need to open next year/month/day file before the end of the current one 
    155                ! if so, we are still before the end of the year/month/day when calling fld_rec so sd(jf)%rec_a(1) will be 
     155               ! if so, we are still before the end of the year/month/day when calling fld_rec so sd(jf)%nrec_a(1) will be 
    156156               ! larger than the record number that should be read for current year/month/day (for ex. 13 for monthly mean file) 
    157157 
    158158               ! last record to be read in the current file 
    159                IF( sd(jf)%freqh == -1. ) THEN             ;   zreclast = 12. 
     159               IF( sd(jf)%nfreqh == -1 ) THEN                  ;   ireclast = 12 
    160160               ELSE                              
    161                   IF(     sd(jf)%cltype == 'monthly'   ) THEN  ;   zreclast = 24. / sd(jf)%freqh * REAL( nmonth_len(nmonth), wp ) 
    162                   ELSEIF( sd(jf)%cltype == 'daily'     ) THEN  ;   zreclast = 24. / sd(jf)%freqh 
    163                   ELSE                                         ;   zreclast = 24. / sd(jf)%freqh * REAL( nyear_len(     1 ), wp ) 
     161                  IF(     sd(jf)%cltype == 'monthly'   ) THEN  ;   ireclast = 24 * nmonth_len(nmonth) / sd(jf)%nfreqh  
     162                  ELSEIF( sd(jf)%cltype == 'daily'     ) THEN  ;   ireclast = 24                      / sd(jf)%nfreqh 
     163                  ELSE                                         ;   ireclast = 24 * nyear_len(     1 ) / sd(jf)%nfreqh  
    164164                  ENDIF 
    165165               ENDIF 
    166166               
    167167               ! do we need next file data? 
    168                IF( sd(jf)%rec_a(1) > zreclast ) THEN 
    169  
    170                   sd(jf)%rec_a(1) = 1.              ! force to read the first record of the next file 
     168               IF( sd(jf)%nrec_a(1) > ireclast ) THEN 
     169 
     170                  sd(jf)%nrec_a(1) = 1              ! force to read the first record of the next file 
    171171 
    172172                  IF( .NOT. sd(jf)%ln_clim ) THEN   ! close the current file and open a new one. 
     
    177177                     ! if the run finishes at the end of the current year/month/day, we will allow next year/month/day file to be 
    178178                     ! not present. If the run continue further than the current year/month/day, next year/month/day file must exist 
    179                      zsecend = rsec_year + sec1jan000 + REAL(nitend - kt, wp) * rdttra(1)   ! second at the end of the run  
    180                      llstop = zsecend > sd(jf)%swap_sec                                 ! read more than 1 record of next year 
     179                     isecend = nsec_year + nsec1jan000 + (nitend - kt) * NINT(rdttra(1))   ! second at the end of the run  
     180                     llstop = isecend > sd(jf)%nswap_sec                                   ! read more than 1 record of next year 
    181181 
    182182                     CALL fld_clopn( sd(jf), nyear  + COUNT((/llnxtyr /))                                           ,         & 
     
    188188                                &     ' not present -> back to current year/month/day') 
    189189                        CALL fld_clopn( sd(jf), nyear, nmonth, nday )       ! back to the current year/month/day 
    190                         sd(jf)%rec_a(1) = zreclast     ! force to read the last record to be read in the current year file 
     190                        sd(jf)%nrec_a(1) = ireclast     ! force to read the last record to be read in the current year file 
    191191                     ENDIF 
    192192 
     
    197197               ! if we are not doing time interpolation, we must change the year/month/day of the file just after switching 
    198198               ! to the NEW year/month/day. If it is the case, we are at the beginning of the year/month/day when calling  
    199                ! fld_rec so sd(jf)%rec_a(1) = 1 
    200                IF( sd(jf)%rec_a(1) == 1 .AND. .NOT. sd(jf)%ln_clim )   CALL fld_clopn( sd(jf), nyear, nmonth, nday ) 
     199               ! fld_rec so sd(jf)%nrec_a(1) = 1 
     200               IF( sd(jf)%nrec_a(1) == 1 .AND. .NOT. sd(jf)%ln_clim )   CALL fld_clopn( sd(jf), nyear, nmonth, nday ) 
    201201            ENDIF 
    202202 
     
    204204            IF( LEN(TRIM(sd(jf)%wgtname)) > 0 ) THEN 
    205205               CALL wgt_list( sd(jf), kw ) 
    206                CALL fld_interp( sd(jf)%num, sd(jf)%clvar, kw, sd(jf)%fdta(:,:,2), NINT( sd(jf)%rec_a(1) ) ) 
     206               CALL fld_interp( sd(jf)%num, sd(jf)%clvar, kw, sd(jf)%fdta(:,:,2), sd(jf)%nrec_a(1) ) 
    207207            ELSE 
    208                CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,2), NINT( sd(jf)%rec_a(1) ) ) 
     208               CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,2), sd(jf)%nrec_a(1) ) 
    209209            ENDIF 
    210210            sd(jf)%rotn(2) = .FALSE. 
     
    274274                     &    "' records b/a: ', i4.4, '/', i4.4, ' (', f7.2,'/', f7.2, ' days)')" 
    275275                  WRITE(numout, clfmt)  TRIM( sd(jf)%clvar ), kt, nyear, nmonth, nday,   & 
    276                      & NINT(sd(jf)%rec_b(1)), NINT(sd(jf)%rec_a(1)), sd(jf)%rec_b(2)/rday, sd(jf)%rec_a(2)/rday 
     276                     & sd(jf)%nrec_b(1), sd(jf)%nrec_a(1), REAL(sd(jf)%nrec_b(2),wp)/rday, REAL(sd(jf)%nrec_a(2),wp)/rday 
    277277               ENDIF 
    278278               ! 
    279                ztinta =  ( rsec_year + sec1jan000 - sd(jf)%rec_b(2) ) / ( sd(jf)%rec_a(2) - sd(jf)%rec_b(2) ) 
     279               ztinta =  REAL( nsec_year + nsec1jan000 - sd(jf)%nrec_b(2), wp ) / REAL( sd(jf)%nrec_a(2) - sd(jf)%nrec_b(2), wp ) 
    280280               ztintb =  1. - ztinta 
    281281!CDIR COLLAPSE 
     
    285285                  clfmt = "('fld_read: var ', a, ' kt = ', i8,' Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," //   & 
    286286                     &    "' record: ', i4.4, ' at ', f7.2, ' day')" 
    287                   WRITE(numout, clfmt)  TRIM(sd(jf)%clvar), kt, nyear, nmonth, nday, NINT(sd(jf)%rec_a(1)), sd(jf)%rec_a(2)/rday 
     287                  WRITE(numout, clfmt) TRIM(sd(jf)%clvar), kt, nyear, nmonth, nday, sd(jf)%nrec_a(1), REAL(sd(jf)%nrec_a(2),wp)/rday 
    288288               ENDIF 
    289289!CDIR COLLAPSE 
     
    335335      IF( sdjf%ln_tint ) THEN ! we need to read the previous record and we will put it in the current record structure 
    336336          
    337          IF( sdjf%rec_b(1) == 0.e0 ) THEN   ! we redefine record sdjf%rec_b(1) with the last record of previous year file 
    338             IF( sdjf%freqh == -1. ) THEN    ! monthly mean 
     337         IF( sdjf%nrec_b(1) == 0  ) THEN   ! we redefine record sdjf%nrec_b(1) with the last record of previous year file 
     338            IF( sdjf%nfreqh == -1 ) THEN   ! monthly mean 
    339339               IF( sdjf%cltype == 'monthly' ) THEN   ! monthly file 
    340                   sdjf%rec_b(1) = 1.                                                       ! force to read the unique record 
     340                  sdjf%nrec_b(1) = 1                                                       ! force to read the unique record 
    341341                  llprevmth = .NOT. sdjf%ln_clim                                           ! use previous month file? 
    342342                  llprevyr  = llprevmth .AND. nmonth == 1                                  ! use previous year  file? 
    343343               ELSE                                  ! yearly file 
    344                   sdjf%rec_b(1) = 12.                                                      ! force to read december mean 
     344                  sdjf%nrec_b(1) = 12                                                      ! force to read december mean 
    345345                  llprevyr = .NOT. sdjf%ln_clim                                            ! use previous year  file? 
    346346               ENDIF 
    347347            ELSE    
    348348               IF( sdjf%cltype == 'monthly' ) THEN   ! monthly file 
    349                   sdjf%rec_b(1) = 24. / sdjf%freqh * REAL( nmonth_len(nmonth-1), wp )      ! last record of previous month 
     349                  sdjf%nrec_b(1) = 24 * nmonth_len(nmonth-1) / sdjf%nfreqh                 ! last record of previous month 
    350350                  llprevmth = .NOT. sdjf%ln_clim                                           ! use previous month file? 
    351351                  llprevyr  = llprevmth .AND. nmonth == 1                                  ! use previous year  file? 
    352352               ELSEIF( sdjf%cltype == 'daily' ) THEN ! daily file 
    353                   sdjf%rec_b(1) = 24. / sdjf%freqh                                         ! last record of previous day 
     353                  sdjf%nrec_b(1) = 24 / sdjf%nfreqh                                        ! last record of previous day 
    354354                  llprevday = .NOT. sdjf%ln_clim                                           ! use previous day   file? 
    355355                  llprevmth = llprevday .AND. nday   == 1                                  ! use previous month file? 
    356356                  llprevyr  = llprevmth .AND. nmonth == 1                                  ! use previous year  file? 
    357357               ELSE                                  ! yearly file 
    358                   sdjf%rec_b(1) = 24. / sdjf%freqh * REAL( nyear_len(0), wp )              ! last record of year month 
     358                  sdjf%nrec_b(1) = 24 * nyear_len(0) / sdjf%nfreqh                         ! last record of year month 
    359359                  llprevyr = .NOT. sdjf%ln_clim                                            ! use previous year  file? 
    360360               ENDIF 
     
    372372            ! we force to read the first record of the current year/month/day instead of last record of previous year/month/day 
    373373            llprev = .false. 
    374             sdjf%rec_b(1) = 1. 
     374            sdjf%nrec_b(1) = 1 
    375375            CALL fld_clopn( sdjf, nyear, nmonth, nday ) 
    376376         ENDIF 
    377377          
    378          IF( llprev ) THEN   ! check if the last record sdjf%rec_n(1) exists in the file 
     378         IF( llprev ) THEN   ! check if the last record sdjf%nrec_n(1) exists in the file 
    379379            idvar = iom_varid( sdjf%num, sdjf%clvar )                                        ! id of the variable sdjf%clvar 
    380380            IF( idvar <= 0 )   RETURN 
    381381            inrec = iom_file( sdjf%num )%dimsz( iom_file( sdjf%num )%ndims(idvar), idvar )   ! size of the last dim of idvar 
    382             sdjf%rec_b(1) = MIN( sdjf%rec_b(1), REAL( inrec, wp ) )   ! make sure we select an existing record 
     382            sdjf%nrec_b(1) = MIN( sdjf%nrec_b(1), inrec )   ! make sure we select an existing record 
    383383         ENDIF 
    384384 
     
    386386         IF( LEN(TRIM(sdjf%wgtname)) > 0 ) THEN 
    387387            CALL wgt_list( sdjf, kwgt ) 
    388             CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, sdjf%fdta(:,:,2), NINT( sdjf%rec_b(1) ) ) 
     388            CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, sdjf%fdta(:,:,2), sdjf%nrec_b(1) ) 
    389389         ELSE 
    390             CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,2), NINT( sdjf%rec_b(1) ) ) 
     390            CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,2), sdjf%nrec_b(1) ) 
    391391         ENDIF 
    392392         sdjf%rotn(2) = .FALSE. 
    393393 
    394394         clfmt = "('fld_init : time-interpolation for ', a, ' read previous record = ', i4, ' at time = ', f7.2, ' days')" 
    395          IF(lwp) WRITE(numout, clfmt) TRIM(sdjf%clvar), NINT(sdjf%rec_b(1)), sdjf%rec_b(2)/rday 
     395         IF(lwp) WRITE(numout, clfmt) TRIM(sdjf%clvar), sdjf%nrec_b(1), REAL(sdjf%nrec_b(2),wp)/rday 
    396396 
    397397         IF( llprev )   CALL iom_close( sdjf%num )   ! close previous year file (-> redefine sdjf%num to 0) 
     
    401401      IF( sdjf%num == 0 )   CALL fld_clopn( sdjf, nyear, nmonth, nday )   ! make sure current year/month/day file is opened 
    402402 
    403       sdjf%swap_sec = rsec_year + sec1jan000 - 1.   ! force read/update the after data in the following part of fld_read  
     403      sdjf%nswap_sec = nsec_year + nsec1jan000 - 1   ! force read/update the after data in the following part of fld_read  
    404404       
    405405   END SUBROUTINE fld_init 
     
    410410      !!                    ***  ROUTINE fld_rec  *** 
    411411      !! 
    412       !! ** Purpose :   compute rec_a, rec_b and swap_sec 
     412      !! ** Purpose :   compute nrec_a, nrec_b and nswap_sec 
    413413      !! 
    414414      !! ** Method  :    
     
    417417      !! 
    418418      INTEGER  ::   irec        ! record number 
    419       REAL(wp) ::   zrec        ! record number 
     419      INTEGER  ::   isecd       ! rday 
    420420      REAL(wp) ::   ztmp        ! temporary variable 
    421       REAL(wp) ::   zfreq_sec   ! frequency mean (in seconds) 
     421      INTEGER  ::   ifreq_sec   ! frequency mean (in seconds) 
    422422      !!---------------------------------------------------------------------- 
    423423      ! 
    424       IF( sdjf%freqh == -1. ) THEN      ! monthly mean 
     424      IF( sdjf%nfreqh == -1 ) THEN      ! monthly mean 
    425425         ! 
    426426         IF( sdjf%ln_tint ) THEN                 ! time interpolation, shift by 1/2 record 
     
    442442         irec = nmonth + INT( ztmp ) 
    443443 
    444          IF( sdjf%ln_tint ) THEN   ;   sdjf%swap_sec = rmonth_half(irec) + sec1jan000   ! swap at the middle of the month 
    445          ELSE                      ;   sdjf%swap_sec = rmonth_end( irec) + sec1jan000   ! swap at the end    of the month 
    446          ENDIF 
    447  
    448          sdjf%rec_a(:) = (/ REAL( irec, wp ), rmonth_half(irec) + sec1jan000 /)   ! define after  record number and time 
    449          irec = irec - 1                                                          ! move back to previous record 
    450          sdjf%rec_b(:) = (/ REAL( irec, wp ), rmonth_half(irec) + sec1jan000 /)   ! define before record number and time 
     444         IF( sdjf%ln_tint ) THEN   ;   sdjf%nswap_sec = nmonth_half(irec) + nsec1jan000   ! swap at the middle of the month 
     445         ELSE                      ;   sdjf%nswap_sec = nmonth_end (irec) + nsec1jan000   ! swap at the end    of the month 
     446         ENDIF 
     447 
     448         sdjf%nrec_a(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define after  record number and time 
     449         irec = irec - 1                                                ! move back to previous record 
     450         sdjf%nrec_b(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define before record number and time 
    451451         ! 
    452       ELSE                          ! higher frequency mean (in hours) 
     452      ELSE                              ! higher frequency mean (in hours) 
    453453         ! 
    454          zfreq_sec = sdjf%freqh * 3600.   ! frequency mean (in seconds) 
     454         ifreq_sec = sdjf%nfreqh * 3600   ! frequency mean (in seconds) 
    455455         ! number of second since the beginning of the file 
    456          IF(     sdjf%cltype == 'monthly' ) THEN   ;   ztmp = rsec_month   ! since 00h on the first day of the current month 
    457          ELSEIF( sdjf%cltype == 'daily'   ) THEN   ;   ztmp = rsec_day     ! since 00h of the current day 
    458          ELSE                                      ;   ztmp = rsec_year    ! since 00h on Jan 1 of the current year 
     456         IF(     sdjf%cltype == 'monthly' ) THEN   ;   ztmp = REAL(nsec_month,wp)   ! since 00h on the 1st day of the current month 
     457         ELSEIF( sdjf%cltype == 'daily'   ) THEN   ;   ztmp = REAL(nsec_day  ,wp)   ! since 00h of the current day 
     458         ELSE                                      ;   ztmp = REAL(nsec_year ,wp)   ! since 00h on Jan 1 of the current year 
    459459         ENDIF 
    460460         IF( sdjf%ln_tint ) THEN                ! time interpolation, shift by 1/2 record 
     
    466466            !                    0 |--(               
    467467            !                      |--+--|--+--|--+--|--> time 
    468             !                      0 /|\ 1 /|\ 2 /|\ 3 (rsec_year/zfreq_sec) or (rsec_month/zfreq_sec) 
     468            !                      0 /|\ 1 /|\ 2 /|\ 3 (nsec_year/ifreq_sec) or (nsec_month/ifreq_sec) 
    469469            !                         |     |     | 
    470470            !                         |     |     | 
    471471            !       forcing record :  1     2     3 
    472472            !                    
    473             ztmp= ztmp / zfreq_sec + 0.5 
     473            ztmp= ztmp / ifreq_sec + 0.5 
    474474         ELSE                  
    475475            ! 
     
    480480            !                    0 |-----(               
    481481            !                      |--+--|--+--|--+--|--> time 
    482             !                      0 /|\ 1 /|\ 2 /|\ 3 (rsec_year/zfreq_sec) or (rsec_month/zfreq_sec) 
     482            !                      0 /|\ 1 /|\ 2 /|\ 3 (nsec_year/ifreq_sec) or (nsec_month/ifreq_sec) 
    483483            !                         |     |     | 
    484484            !                         |     |     | 
    485485            !       forcing record :  1     2     3 
    486486            !                             
    487             ztmp= ztmp / zfreq_sec 
    488          ENDIF 
    489          zrec = 1. + REAL( INT( ztmp ), wp ) 
    490  
     487            ztmp= ztmp / ifreq_sec 
     488         ENDIF 
     489         irec = 1 + INT( ztmp ) 
     490 
     491         isecd = NINT(rday) 
    491492         ! after record index and second since Jan. 1st 00h of nit000 year 
    492          sdjf%rec_a(:) = (/ zrec, zfreq_sec * ( zrec - 0.5 ) + sec1jan000 /) 
     493         sdjf%nrec_a(:) = (/ irec, ifreq_sec * irec - ifreq_sec / 2 + nsec1jan000 /) 
    493494         IF( sdjf%cltype == 'monthly' )   &   ! add the number of seconds between 00h Jan 1 and the end of previous month 
    494             sdjf%rec_a(2) = sdjf%rec_a(2) + rday * REAL(SUM(nmonth_len(1:nmonth -1)), wp)   ! ok if nmonth=1 
     495            sdjf%nrec_a(2) = sdjf%nrec_a(2) + isecd * SUM(nmonth_len(1:nmonth -1))   ! ok if nmonth=1 
    495496         IF( sdjf%cltype == 'daily'   )   &   ! add the number of seconds between 00h Jan 1 and the end of previous day 
    496             sdjf%rec_a(2) = sdjf%rec_a(2) + rday * ( nday_year - 1 ) 
     497            sdjf%nrec_a(2) = sdjf%nrec_a(2) + isecd * ( nday_year - 1 ) 
    497498 
    498499         ! before record index and second since Jan. 1st 00h of nit000 year 
    499          zrec = zrec - 1.                           ! move back to previous record 
    500          sdjf%rec_b(:) = (/ zrec, zfreq_sec * ( zrec - 0.5 ) + sec1jan000 /) 
     500         irec = irec - 1.                           ! move back to previous record 
     501         sdjf%nrec_b(:) = (/ irec, ifreq_sec * irec - ifreq_sec / 2 + nsec1jan000 /) 
    501502         IF( sdjf%cltype == 'monthly' )   &   ! add the number of seconds between 00h Jan 1 and the end of previous month 
    502             sdjf%rec_b(2) = sdjf%rec_b(2) + rday * REAL(SUM(nmonth_len(1:nmonth -1)), wp)   ! ok if nmonth=1 
     503            sdjf%nrec_b(2) = sdjf%nrec_b(2) + isecd * SUM(nmonth_len(1:nmonth -1))   ! ok if nmonth=1 
    503504         IF( sdjf%cltype == 'daily'   )   &   ! add the number of seconds between 00h Jan 1 and the end of previous day 
    504             sdjf%rec_b(2) = sdjf%rec_b(2) + rday * ( nday_year - 1 ) 
     505            sdjf%nrec_b(2) = sdjf%nrec_b(2) + isecd * ( nday_year - 1 ) 
    505506 
    506507         ! swapping time in second since Jan. 1st 00h of nit000 year 
    507          IF( sdjf%ln_tint ) THEN   ;   sdjf%swap_sec =  sdjf%rec_a(2)                     ! swap at the middle of the record 
    508          ELSE                      ;   sdjf%swap_sec =  sdjf%rec_a(2) + 0.5 * zfreq_sec   ! swap at the end    of the record 
     508         IF( sdjf%ln_tint ) THEN   ;   sdjf%nswap_sec =  sdjf%nrec_a(2)                     ! swap at the middle of the record 
     509         ELSE                      ;   sdjf%nswap_sec =  sdjf%nrec_a(2) + ifreq_sec / 2     ! swap at the end    of the record 
    509510         ENDIF        
    510511         ! 
     
    559560      DO jf = 1, SIZE(sdf) 
    560561         sdf(jf)%clrootname = TRIM( cdir )//TRIM( sdf_n(jf)%clname ) 
    561          sdf(jf)%freqh      = sdf_n(jf)%freqh 
     562         sdf(jf)%nfreqh     = sdf_n(jf)%nfreqh 
    562563         sdf(jf)%clvar      = sdf_n(jf)%clvar 
    563564         sdf(jf)%ln_tint    = sdf_n(jf)%ln_tint 
    564565         sdf(jf)%ln_clim    = sdf_n(jf)%ln_clim 
    565          IF( sdf(jf)%freqh == -1. ) THEN   ;    sdf(jf)%cltype = 'yearly' 
    566          ELSE                              ;    sdf(jf)%cltype = sdf_n(jf)%cltype 
     566         IF( sdf(jf)%nfreqh == -1. ) THEN   ;   sdf(jf)%cltype = 'yearly' 
     567         ELSE                               ;   sdf(jf)%cltype = sdf_n(jf)%cltype 
    567568         ENDIF 
    568569         sdf(jf)%wgtname = " " 
    569          IF( LEN( TRIM(sdf_n(jf)%wname) ) > 0 )  & 
    570             sdf(jf)%wgtname = TRIM( cdir )//TRIM( sdf_n(jf)%wname ) 
     570         IF( LEN( TRIM(sdf_n(jf)%wname) ) > 0 )   sdf(jf)%wgtname = TRIM( cdir )//TRIM( sdf_n(jf)%wname ) 
    571571         sdf(jf)%vcomp   = sdf_n(jf)%vcomp 
    572572      END DO 
     
    581581            WRITE(numout,*) '               root filename: '  , TRIM( sdf(jf)%clrootname ),   & 
    582582               &                          ' variable name: '  , TRIM( sdf(jf)%clvar      ) 
    583             WRITE(numout,*) '               frequency: '      ,       sdf(jf)%freqh       ,   & 
     583            WRITE(numout,*) '               frequency: '      ,       sdf(jf)%nfreqh      ,   & 
    584584               &                          ' time interp: '    ,       sdf(jf)%ln_tint     ,   & 
    585585               &                          ' climatology: '    ,       sdf(jf)%ln_clim     ,   & 
  • trunk/NEMO/OPA_SRC/SBC/sbcblk_clio.F90

    r1715 r1730  
    140140         !            !    file     ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   ! 
    141141         !            !    name     !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      ! 
    142          sn_utau = FLD_N( 'utau'    ,    24.    ,  'utau'    ,  .true.    , .false. ,   'yearly'  , ''       , ''         )  
    143          sn_vtau = FLD_N( 'vtau'    ,    24.    ,  'vtau'    ,  .true.    , .false. ,   'yearly'  , ''       , ''         )  
    144          sn_wndm = FLD_N( 'mwnd10m' ,    24.    ,  'm_10'    ,  .true.    , .false. ,   'yearly'  , ''       , ''         )  
    145          sn_tair = FLD_N( 'tair10m' ,    24.    ,  't_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         )  
    146          sn_humi = FLD_N( 'humi10m' ,    24.    ,  'q_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         )  
    147          sn_ccov = FLD_N( 'ccover'  ,    -1.    ,  'cloud'   ,  .true.    , .false. ,   'yearly'  , ''       , ''         )  
    148          sn_prec = FLD_N( 'precip'  ,    -1.    ,  'precip'  ,  .true.    , .false. ,   'yearly'  , ''       , ''         )  
     142         sn_utau = FLD_N( 'utau'    ,    24     ,  'utau'    ,  .true.    , .false. ,   'yearly'  , ''       , ''         )  
     143         sn_vtau = FLD_N( 'vtau'    ,    24     ,  'vtau'    ,  .true.    , .false. ,   'yearly'  , ''       , ''         )  
     144         sn_wndm = FLD_N( 'mwnd10m' ,    24     ,  'm_10'    ,  .true.    , .false. ,   'yearly'  , ''       , ''         )  
     145         sn_tair = FLD_N( 'tair10m' ,    24     ,  't_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         )  
     146         sn_humi = FLD_N( 'humi10m' ,    24     ,  'q_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         )  
     147         sn_ccov = FLD_N( 'ccover'  ,    -1     ,  'cloud'   ,  .true.    , .false. ,   'yearly'  , ''       , ''         )  
     148         sn_prec = FLD_N( 'precip'  ,    -1     ,  'precip'  ,  .true.    , .false. ,   'yearly'  , ''       , ''         )  
    149149 
    150150         REWIND( numnam )                    ! ... read in namlist namsbc_clio 
  • trunk/NEMO/OPA_SRC/SBC/sbcblk_core.F90

    r1715 r1730  
    134134         !            !    file     ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   ! 
    135135         !            !    name     !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      ! 
    136          sn_wndi = FLD_N( 'uwnd10m' ,    24.    ,  'u_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    137          sn_wndj = FLD_N( 'vwnd10m' ,    24.    ,  'v_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    138          sn_qsr  = FLD_N( 'qsw'     ,    24.    ,  'qsw'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    139          sn_qlw  = FLD_N( 'qlw'     ,    24.    ,  'qlw'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    140          sn_tair = FLD_N( 'tair10m' ,    24.    ,  't_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    141          sn_humi = FLD_N( 'humi10m' ,    24.    ,  'q_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    142          sn_prec = FLD_N( 'precip'  ,    -1.    ,  'precip'  ,  .true.    , .false. ,   'yearly'  , ''       , ''         ) 
    143          sn_snow = FLD_N( 'snow'    ,    -1.    ,  'snow'    ,  .true.    , .false. ,   'yearly'  , ''       , ''         ) 
    144          sn_tdif = FLD_N( 'taudif'  ,    24.    ,  'taudif'  ,  .true.    , .false. ,   'yearly'  , ''       , ''         ) 
     136         sn_wndi = FLD_N( 'uwnd10m' ,    24     ,  'u_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     137         sn_wndj = FLD_N( 'vwnd10m' ,    24     ,  'v_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     138         sn_qsr  = FLD_N( 'qsw'     ,    24     ,  'qsw'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     139         sn_qlw  = FLD_N( 'qlw'     ,    24     ,  'qlw'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     140         sn_tair = FLD_N( 'tair10m' ,    24     ,  't_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     141         sn_humi = FLD_N( 'humi10m' ,    24     ,  'q_10'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     142         sn_prec = FLD_N( 'precip'  ,    -1     ,  'precip'  ,  .true.    , .false. ,   'yearly'  , ''       , ''         ) 
     143         sn_snow = FLD_N( 'snow'    ,    -1     ,  'snow'    ,  .true.    , .false. ,   'yearly'  , ''       , ''         ) 
     144         sn_tdif = FLD_N( 'taudif'  ,    24     ,  'taudif'  ,  .true.    , .false. ,   'yearly'  , ''       , ''         ) 
    145145         ! 
    146146         REWIND( numnam )                    ! ... read in namlist namsbc_core 
  • trunk/NEMO/OPA_SRC/SBC/sbcflx.F90

    r1715 r1730  
    106106         !              !   file    ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   ! 
    107107         !              !   name    !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      ! 
    108          sn_utau = FLD_N(   'utau'  ,    24.    ,  'utau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    109          sn_vtau = FLD_N(   'vtau'  ,    24.    ,  'vtau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    110          sn_qtot = FLD_N(   'qtot'  ,    24.    ,  'qtot'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    111          sn_qsr  = FLD_N(   'qsr'   ,    24.    ,  'qsr'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    112          sn_emp  = FLD_N(   'emp'   ,    24.    ,  'emp'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     108         sn_utau = FLD_N(   'utau'  ,    24     ,  'utau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     109         sn_vtau = FLD_N(   'vtau'  ,    24     ,  'vtau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     110         sn_qtot = FLD_N(   'qtot'  ,    24     ,  'qtot'    ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     111         sn_qsr  = FLD_N(   'qsr'   ,    24     ,  'qsr'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     112         sn_emp  = FLD_N(   'emp'   ,    24     ,  'emp'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    113113 
    114114         REWIND ( numnam )               ! ... read in namlist namflx 
  • trunk/NEMO/OPA_SRC/SBC/sbcice_if.F90

    r1695 r1730  
    7272         !             !   file    ! frequency !  variable  ! time intep !  clim  ! 'yearly' or ! weights  ! rotation   ! 
    7373         !             !   name    !  (hours)  !   name     !   (T/F)    !  (T/F) !  'monthly'  ! filename ! pairs      !  
    74          sn_ice = FLD_N('ice_cover',    -1.    ,  'ice_cov' ,  .true.    , .true. ,   'yearly'  , ''       , ''         ) 
     74         sn_ice = FLD_N('ice_cover',    -1    ,  'ice_cov' ,  .true.    , .true. ,   'yearly'  , ''       , ''         ) 
    7575 
    7676         REWIND ( numnam )               ! ... read in namlist namiif 
  • trunk/NEMO/OPA_SRC/SBC/sbcrnf.F90

    r1715 r1730  
    133133      !            !   file    ! frequency !  variable  ! time intep !  clim  ! 'yearly' or ! weights  ! rotation   ! 
    134134      !            !   name    !  (hours)  !   name     !   (T/F)    !  (T/F) !  'monthly'  ! filename ! pairs      ! 
    135       sn_rnf = FLD_N( 'runoffs',    -1.    , 'sorunoff' ,  .TRUE.    , .true. ,   'yearly'  , ''       , ''         ) 
    136       sn_cnf = FLD_N( 'runoffs',     0.    , 'sorunoff' ,  .FALSE.   , .true. ,   'yearly'  , ''       , ''         ) 
     135      sn_rnf = FLD_N( 'runoffs',    -1     , 'sorunoff' ,  .TRUE.    , .true. ,   'yearly'  , ''       , ''         ) 
     136      sn_cnf = FLD_N( 'runoffs',     0     , 'sorunoff' ,  .FALSE.   , .true. ,   'yearly'  , ''       , ''         ) 
    137137 
    138138      ! 
  • trunk/NEMO/OPA_SRC/SBC/sbcssr.F90

    r1715 r1730  
    8989         !            !   file    ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   ! 
    9090         !            !   name    !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      ! 
    91          sn_sst = FLD_N( 'sst'    ,    24.    ,  'sst'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
    92          sn_sss = FLD_N( 'sss'    ,    -1.    ,  'sss'     ,  .true.    , .false. ,   'yearly'  , ''       , ''         ) 
     91         sn_sst = FLD_N( 'sst'    ,    24     ,  'sst'     ,  .false.   , .false. ,   'yearly'  , ''       , ''         ) 
     92         sn_sss = FLD_N( 'sss'    ,    -1     ,  'sss'     ,  .true.    , .false. ,   'yearly'  , ''       , ''         ) 
    9393 
    9494         REWIND ( numnam )            !* read in namlist namflx 
Note: See TracChangeset for help on using the changeset viewer.