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 1488 for trunk/NEMO/OPA_SRC/IOM/iom_ioipsl.F90 – NEMO

Ignore:
Timestamp:
2009-07-16T11:19:46+02:00 (15 years ago)
Author:
smasson
Message:

Addition of clobber and chunksize when opening NetCDF files, see ticket:374

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/OPA_SRC/IOM/iom_ioipsl.F90

    r1271 r1488  
    4848      !! ** Purpose :  open an input file with IOIPSL (only fliocom module) 
    4949      !!--------------------------------------------------------------------- 
    50       CHARACTER(len=*)       , INTENT(inout)           ::   cdname    ! File name 
    51       INTEGER                , INTENT(  out)           ::   kiomid    ! ioipsl identifier of the opened file 
    52       LOGICAL                , INTENT(in   )           ::   ldwrt     ! read or write the file? 
    53       LOGICAL                , INTENT(in   )           ::   ldok      ! check the existence  
    54       INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar   ! domain parameters:  
    55  
    56       CHARACTER(LEN=100) ::   clinfo     ! info character 
    57       INTEGER            ::   iln        ! lengths of character 
    58       INTEGER            ::   istop      ! temporary storage of nstop 
    59       INTEGER            ::   ifliodom   ! model domain identifier (see flio_dom_set) 
    60       INTEGER            ::   ioipslid   ! ioipsl identifier of the opened file 
    61       INTEGER            ::   jl         ! loop variable 
     50      CHARACTER(len=*)       , INTENT(inout)           ::   cdname      ! File name 
     51      INTEGER                , INTENT(  out)           ::   kiomid      ! ioipsl identifier of the opened file 
     52      LOGICAL                , INTENT(in   )           ::   ldwrt       ! read or write the file? 
     53      LOGICAL                , INTENT(in   )           ::   ldok        ! check the existence  
     54      INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar     ! domain parameters:  
     55 
     56      CHARACTER(LEN=100) ::   clinfo      ! info character 
     57      CHARACTER(LEN=10 ) ::   clstatus    ! status of opened file (REPLACE or NEW) 
     58      INTEGER            ::   iln         ! lengths of character 
     59      INTEGER            ::   istop       ! temporary storage of nstop 
     60      INTEGER            ::   ifliodom    ! model domain identifier (see flio_dom_set) 
     61      INTEGER            ::   ioipslid    ! ioipsl identifier of the opened file 
     62      INTEGER            ::   jl          ! loop variable 
     63      LOGICAL            ::   llclobber   ! local definition of ln_clobber 
    6264      !--------------------------------------------------------------------- 
    6365 
     
    6567      istop = nstop 
    6668      ! 
    67       IF( ldok ) THEN      ! Open existing file... 
     69      llclobber = ldwrt .AND. ln_clobber 
     70      IF( ldok .AND. .NOT. llclobber ) THEN      ! Open existing file... 
    6871         !                 ! ============= 
    6972         IF( ldwrt ) THEN  ! ... in write mode 
     
    7881         iln = INDEX( cdname, '.nc' ) 
    7982         IF( ldwrt ) THEN  ! the file should be open in write mode so we create it... 
     83            IF( llclobber ) THEN   ;   clstatus = 'REPLACE'  
     84            ELSE                   ;   clstatus = 'NEW' 
     85            ENDIF 
    8086            IF( jpnij > 1 ) THEN 
    8187               ! define the domain position regarding to the global domain (mainly useful in mpp) 
     
    8692               IF(lwp) WRITE(numout,*) TRIM(clinfo)//' create new file: '//cdname(1:iln-1)//'... in WRITE mode' 
    8793               CALL fliocrfd( cdname, (/'x'         , 'y'         , 'z', 't'/)   & 
    88                   &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid, ifliodom ) 
     94                  &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid, ifliodom, mode = clstatus ) 
    8995            ELSE              ! the file should be open for read mode so it must exist... 
    9096               IF(lwp) WRITE(numout,*) TRIM(clinfo)//' create new file: '//cdname//' in WRITE mode' 
    9197               CALL fliocrfd( cdname, (/'x'         , 'y'         , 'z', 't'/)   & 
    92                   &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid ) 
     98                  &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid,           mode = clstatus ) 
    9399            ENDIF 
    94100         ELSE              ! the file should be open for read mode so it must exist... 
Note: See TracChangeset for help on using the changeset viewer.