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 13061 for NEMO/releases/r4.0/r4.0-HEAD/src/OCE/IOM/iom_nf90.F90 – NEMO

Ignore:
Timestamp:
2020-06-08T15:20:11+02:00 (4 years ago)
Author:
smasson
Message:

r4.0-HEAD: fix max number of digits for the cpu number in filename, see #2424

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/releases/r4.0/r4.0-HEAD/src/OCE/IOM/iom_nf90.F90

    r11536 r13061  
    6060      CHARACTER(LEN=256) ::   clinfo           ! info character 
    6161      CHARACTER(LEN=256) ::   cltmp            ! temporary character 
     62      CHARACTER(LEN=12 ) ::   clfmt            ! writing format 
     63      INTEGER            ::   idg              ! number of digits 
    6264      INTEGER            ::   iln              ! lengths of character 
    6365      INTEGER            ::   istop            ! temporary storage of nstop 
     
    6971      INTEGER            ::   ihdf5            ! local variable for retrieval of value for NF90_HDF5 
    7072      LOGICAL            ::   llclobber        ! local definition of ln_clobber 
    71       INTEGER            ::   ilevels           ! vertical levels 
     73      INTEGER            ::   ilevels          ! vertical levels 
    7274      !--------------------------------------------------------------------- 
    7375      ! 
     
    104106         IF( ldwrt ) THEN              !* the file should be open in write mode so we create it... 
    105107            IF( jpnij > 1 ) THEN 
    106                WRITE(cltmp,'(a,a,i4.4,a)') cdname(1:iln-1), '_', narea-1, '.nc' 
     108               idg = MAX( INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1, 4 )          ! how many digits to we need to write? min=4, max=9 
     109               WRITE(clfmt, "('(a,a,i', i1, '.', i1, ',a)')") idg, idg          ! '(a,a,ix.x,a)' 
     110               WRITE(cltmp,clfmt) cdname(1:iln-1), '_', narea-1, '.nc' 
    107111               cdname = TRIM(cltmp) 
    108112            ENDIF 
Note: See TracChangeset for help on using the changeset viewer.