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 14437 – NEMO

Changeset 14437


Ignore:
Timestamp:
2021-02-11T16:38:56+01:00 (3 years ago)
Author:
smasson
Message:

trunk: true bugfix in fldread, following [14436], #2623

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/SBC/fldread.F90

    r14436 r14437  
    211211            ! 
    212212            IF( sd(jf)%ln_tint ) THEN              ! temporal interpolation 
    213                IF(lwp .AND. kt - nit000 <= 100 ) THEN  
     213               IF(lwp .AND. ( kt - nit000 <= 20 .OR. nitend - kt <= 20 ) ) THEN  
    214214                  clfmt = "('   fld_read: var ', a, ' kt = ', i8, ' (', f9.4,' days), Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," //   & 
    215215                     &    "', records b/a: ', i6.4, '/', i6.4, ' (days ', f9.4,'/', f9.4, ')')" 
     
    223223               sd(jf)%fnow(:,:,:) = ztintb * sd(jf)%fdta(:,:,:,ibb) + ztinta * sd(jf)%fdta(:,:,:,iaa) 
    224224            ELSE   ! nothing to do... 
    225                IF(lwp .AND. kt - nit000 <= 100 ) THEN 
     225               IF(lwp .AND. ( kt - nit000 <= 20 .OR. nitend - kt <= 20 ) ) THEN 
    226226                  clfmt = "('   fld_read: var ', a, ' kt = ', i8,' (', f9.4,' days), Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," //   & 
    227227                     &    "', record: ', i6.4, ' (days ', f9.4, ' <-> ', f9.4, ')')" 
     
    251251      !!--------------------------------------------------------------------- 
    252252      ! 
    253       IF( nflag == 0 )   nflag = -( HUGE(0) - 10 ) 
     253      IF( nflag == 0 )   nflag = -HUGE(0) 
    254254      ! 
    255255      CALL fld_def( sdjf ) 
     
    908908      TYPE(FLD)        , INTENT(inout) ::   sdjf       ! input field related variables 
    909909      ! 
    910       INTEGER, DIMENSION(2)  :: isave 
     910      INTEGER  :: isave 
    911911      LOGICAL  :: llprev, llnext, llstop 
    912912      !!---------------------------------------------------------------------- 
    913913      ! 
    914       llprev = sdjf%nrecsec(sdjf%nreclast) <  nsec000_1jan000   ! file ends before the beginning of the job -> file may not exist 
    915       llnext = sdjf%nrecsec(       0     ) >= nsecend_1jan000   ! file begins after the end of the job -> file may not exist  
     914      llprev = sdjf%nrecsec(sdjf%nreclast) < nsec000_1jan000   ! file ends before the beginning of the job -> file may not exist 
     915      llnext = sdjf%nrecsec(      1      ) > nsecend_1jan000   ! file begins after the end of the job -> file may not exist  
    916916 
    917917      llstop = sdjf%ln_clim .OR. .NOT. ( llprev .OR. llnext ) 
     
    926926         IF( llprev ) THEN   ! previous file does not exist : go back to current and accept to read only the first record 
    927927            CALL ctl_warn('previous file: '//TRIM(sdjf%clname)//' not found -> go back to current year/month/week/day file') 
    928             isave(1:2) = sdjf%nrecsec(sdjf%nreclast-1:sdjf%nreclast)   ! save previous file info 
    929             CALL fld_def( sdjf )   ! go back to current file 
    930             sdjf%nreclast = 1   ! force to use only the first record (do as if other were not existing...) 
    931             sdjf%nrecsec(0:1) = isave(1:2) 
     928            isave = sdjf%nrecsec(sdjf%nreclast)   ! save previous file info 
     929            CALL fld_def( sdjf )                  ! go back to current file 
     930            sdjf%nreclast = 1                     ! force to use only the first record (do as if other were not existing...) 
    932931         ENDIF 
    933932         ! 
    934933         IF( llnext ) THEN   ! next     file does not exist : go back to current and accept to read only the last  record  
    935934            CALL ctl_warn('next file: '//TRIM(sdjf%clname)//' not found -> go back to current year/month/week/day file') 
    936             isave(1:2) = sdjf%nrecsec(0:1)    ! save next file info 
    937             CALL fld_def( sdjf )   ! go back to current file 
    938             ! -> read last record but keep record info from the first record of next file 
    939             sdjf%nrecsec(sdjf%nreclast-1:sdjf%nreclast) = isave(1:2) 
    940             sdjf%nrecsec(0:sdjf%nreclast-2) = nflag 
    941          ENDIF 
     935            isave = sdjf%nrecsec(1)               ! save next file info 
     936            CALL fld_def( sdjf )                  ! go back to current file 
     937         ENDIF 
     938         ! -> read "last" record but keep record info from the first record of next file 
     939         sdjf%nrecsec(  sdjf%nreclast  ) = isave 
     940         sdjf%nrecsec(0:sdjf%nreclast-1) = nflag 
    942941         ! 
    943942         CALL iom_open( sdjf%clname, sdjf%num, ldiof = LEN_TRIM(sdjf%wgtname) > 0 )    
Note: See TracChangeset for help on using the changeset viewer.