Changeset 10522 for NEMO/trunk/src/OCE/IOM/iom.F90
- Timestamp:
- 2019-01-16T09:35:15+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/trunk/src/OCE/IOM/iom.F90
r10425 r10522 17 17 !! iom_close : close a file or all files opened by iom 18 18 !! iom_get : read a field (interfaced to several routines) 19 !! iom_gettime : read the time axis cdvar in the file20 19 !! iom_varid : get the id of a variable in a file 21 20 !! iom_rstput : write a field in a restart file (interfaced to several routines) … … 58 57 #endif 59 58 PUBLIC iom_init, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get 60 PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_get time, iom_rstput, iom_delay_rst, iom_put59 PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_getszuld, iom_rstput, iom_delay_rst, iom_put 61 60 PUBLIC iom_use, iom_context_finalize 62 61 … … 1342 1341 1343 1342 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 1368 1355 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 1375 1358 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 1399 1362 1400 1363 !!----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.