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 10522 for NEMO/trunk/src/OCE/IOM/iom.F90 – NEMO

Ignore:
Timestamp:
2019-01-16T09:35:15+01:00 (5 years ago)
Author:
smasson
Message:

trunk: replace iom_gettime by iom_getszuld, see #2212

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/IOM/iom.F90

    r10425 r10522  
    1717   !!   iom_close      : close a file or all files opened by iom 
    1818   !!   iom_get        : read a field (interfaced to several routines) 
    19    !!   iom_gettime    : read the time axis cdvar in the file 
    2019   !!   iom_varid      : get the id of a variable in a file 
    2120   !!   iom_rstput     : write a field in a restart file (interfaced to several routines) 
     
    5857#endif 
    5958   PUBLIC iom_init, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get 
    60    PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_gettime, iom_rstput, iom_delay_rst, iom_put 
     59   PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_getszuld, iom_rstput, iom_delay_rst, iom_put 
    6160   PUBLIC iom_use, iom_context_finalize 
    6261 
     
    13421341 
    13431342 
    1344    SUBROUTINE iom_gettime( kiomid, ptime, cdvar, kntime, cdunits, cdcalendar ) 
    1345       !!-------------------------------------------------------------------- 
    1346       !!                   ***  SUBROUTINE iom_gettime  *** 
    1347       !! 
    1348       !! ** Purpose : read the time axis cdvar in the file  
    1349       !!-------------------------------------------------------------------- 
    1350       INTEGER                    , INTENT(in   ) ::   kiomid     ! file Identifier 
    1351       REAL(wp), DIMENSION(:)     , INTENT(  out) ::   ptime      ! the time axis 
    1352       CHARACTER(len=*), OPTIONAL , INTENT(in   ) ::   cdvar      ! time axis name 
    1353       INTEGER         , OPTIONAL , INTENT(  out) ::   kntime     ! number of times in file 
    1354       CHARACTER(len=*), OPTIONAL , INTENT(  out) ::   cdunits    ! units attribute of time coordinate 
    1355       CHARACTER(len=*), OPTIONAL , INTENT(  out) ::   cdcalendar ! calendar attribute of  
    1356       ! 
    1357       INTEGER, DIMENSION(1) :: kdimsz 
    1358       INTEGER            ::   idvar    ! id of the variable 
    1359       CHARACTER(LEN=32)  ::   tname    ! local name of time coordinate 
    1360       CHARACTER(LEN=100) ::   clinfo   ! info character 
    1361       !--------------------------------------------------------------------- 
    1362       ! 
    1363       IF ( PRESENT(cdvar) ) THEN 
    1364          tname = cdvar 
    1365       ELSE 
    1366          tname = iom_file(kiomid)%uldname 
    1367       ENDIF 
     1343   FUNCTION iom_getszuld ( kiomid )   
     1344      !!----------------------------------------------------------------------- 
     1345      !!                  ***  FUNCTION  iom_getszuld  *** 
     1346      !! 
     1347      !! ** Purpose : get the size of the unlimited dimension in a file 
     1348      !!              (return -1 if not found) 
     1349      !!----------------------------------------------------------------------- 
     1350      INTEGER, INTENT(in   ) ::   kiomid   ! file Identifier 
     1351      ! 
     1352      INTEGER                ::   iom_getszuld 
     1353      !!----------------------------------------------------------------------- 
     1354      iom_getszuld = -1 
    13681355      IF( kiomid > 0 ) THEN 
    1369          clinfo = 'iom_gettime, file: '//trim(iom_file(kiomid)%name)//', var: '//trim(tname) 
    1370          IF ( PRESENT(kntime) ) THEN 
    1371             idvar  = iom_varid( kiomid, tname, kdimsz = kdimsz ) 
    1372             kntime = kdimsz(1) 
    1373          ELSE 
    1374             idvar = iom_varid( kiomid, tname ) 
     1356         IF( iom_file(kiomid)%iduld .GE. 0 ) THEN 
     1357            iom_getszuld = iom_file(kiomid)%lenuld 
    13751358         ENDIF 
    1376          ! 
    1377          ptime(:) = 0. ! default definition 
    1378          IF( idvar > 0 ) THEN 
    1379             IF( iom_file(kiomid)%ndims(idvar) == 1 ) THEN 
    1380                IF( iom_file(kiomid)%luld(idvar) ) THEN 
    1381                   IF( iom_file(kiomid)%dimsz(1,idvar) <= size(ptime) ) THEN 
    1382                      CALL iom_nf90_gettime(   kiomid, idvar, ptime, cdunits, cdcalendar ) 
    1383                   ELSE 
    1384                      WRITE(ctmp1,*) 'error with the size of ptime ',size(ptime),iom_file(kiomid)%dimsz(1,idvar) 
    1385                      CALL ctl_stop( trim(clinfo), trim(ctmp1) ) 
    1386                   ENDIF 
    1387                ELSE 
    1388                   CALL ctl_stop( trim(clinfo), 'variable dimension is not unlimited... use iom_get' ) 
    1389                ENDIF 
    1390             ELSE 
    1391                CALL ctl_stop( trim(clinfo), 'the variable has more than 1 dimension' ) 
    1392             ENDIF 
    1393          ELSE 
    1394             CALL ctl_stop( trim(clinfo), 'variable not found in '//iom_file(kiomid)%name ) 
    1395          ENDIF 
    1396       ENDIF 
    1397       ! 
    1398    END SUBROUTINE iom_gettime 
     1359      ENDIF 
     1360   END FUNCTION iom_getszuld 
     1361    
    13991362 
    14001363   !!---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.