Changeset 10425 for NEMO/trunk/src/OCE/IOM
- Timestamp:
- 2018-12-19T22:54:16+01:00 (5 years ago)
- Location:
- NEMO/trunk/src/OCE/IOM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/trunk/src/OCE/IOM/in_out_manager.F90
r10068 r10425 122 122 INTEGER :: numtime = -1 !: logical unit for timing 123 123 INTEGER :: numout = 6 !: logical unit for output print; Set to stdout to ensure any 124 INTEGER :: numnul = -1 !: logical unit for /dev/null 124 125 ! ! early output can be collected; do not change 125 126 INTEGER :: numnam_ref = -1 !: logical unit for reference namelist -
NEMO/trunk/src/OCE/IOM/iom.F90
r10361 r10425 58 58 #endif 59 59 PUBLIC iom_init, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get 60 PUBLIC iom_ getatt, iom_putatt, iom_gettime, iom_rstput, iom_put60 PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_gettime, iom_rstput, iom_delay_rst, iom_put 61 61 PUBLIC iom_use, iom_context_finalize 62 62 … … 75 75 END INTERFACE 76 76 INTERFACE iom_getatt 77 MODULE PROCEDURE iom_g0d_iatt, iom_g 0d_ratt, iom_g0d_catt77 MODULE PROCEDURE iom_g0d_iatt, iom_g1d_iatt, iom_g0d_ratt, iom_g1d_ratt, iom_g0d_catt 78 78 END INTERFACE 79 79 INTERFACE iom_putatt 80 MODULE PROCEDURE iom_p0d_iatt, iom_p 0d_ratt, iom_p0d_catt80 MODULE PROCEDURE iom_p0d_iatt, iom_p1d_iatt, iom_p0d_ratt, iom_p1d_ratt, iom_p0d_catt 81 81 END INTERFACE 82 82 INTERFACE iom_rstput … … 286 286 !Warn if variable is not in defined in rst_wfields 287 287 IF(.NOT.llis_set) THEN 288 IF(lwp) THEN 289 write(numout,cform_err) 290 write(numout,*) 'iom_set_rstw_var_active: variable ', field ,' is available for writing but not defined' 291 ENDIF 292 nstop = nstop + 1 288 WRITE(ctmp1,*) 'iom_set_rstw_var_active: variable ', field ,' is available for writing but not defined' 289 CALL ctl_stop( 'iom_set_rstw_var_active:', ctmp1 ) 293 290 ENDIF 294 291 #else … … 518 515 519 516 IF( i-1 > max_rst_fields) THEN 520 IF(lwp) write(numout,*) 'E R R O R : iom_set_rst_vars SIZE of RST_FIELD array is too small'521 nstop = nstop + 1517 WRITE(ctmp1,*) 'E R R O R : iom_set_rst_vars SIZE of RST_FIELD array is too small' 518 CALL ctl_stop( 'iom_set_rst_vars:', ctmp1 ) 522 519 ENDIF 523 520 END SUBROUTINE iom_set_rst_vars … … 634 631 635 632 636 SUBROUTINE iom_open( cdname, kiomid, ldwrt, kdom, kiolib,ldstop, ldiof, kdlev )633 SUBROUTINE iom_open( cdname, kiomid, ldwrt, kdom, ldstop, ldiof, kdlev ) 637 634 !!--------------------------------------------------------------------- 638 635 !! *** SUBROUTINE iom_open *** … … 644 641 LOGICAL , INTENT(in ), OPTIONAL :: ldwrt ! open in write modeb (default = .FALSE.) 645 642 INTEGER , INTENT(in ), OPTIONAL :: kdom ! Type of domain to be written (default = jpdom_local_noovlap) 646 INTEGER , INTENT(in ), OPTIONAL :: kiolib ! library used to open the file (default = jpnf90)647 643 LOGICAL , INTENT(in ), OPTIONAL :: ldstop ! stop if open to read a non-existing file (default = .TRUE.) 648 644 LOGICAL , INTENT(in ), OPTIONAL :: ldiof ! Interp On the Fly, needed for AGRIF (default = .FALSE.) … … 659 655 LOGICAL :: llstop ! local definition of ldstop 660 656 LOGICAL :: lliof ! local definition of ldiof 661 INTEGER :: iolib ! library do we use to open the file662 657 INTEGER :: icnt ! counter for digits in clcpu (max = jpmax_digits) 663 658 INTEGER :: iln, ils ! lengths of character … … 692 687 ELSE ; llstop = .TRUE. 693 688 ENDIF 694 ! what library do we use to open the file?695 IF( PRESENT(kiolib) ) THEN ; iolib = kiolib696 ELSE ; iolib = jpnf90697 ENDIF698 689 ! are we using interpolation on the fly? 699 690 IF( PRESENT(ldiof) ) THEN ; lliof = ldiof … … 713 704 ENDIF 714 705 ! which suffix should we use? 715 SELECT CASE (iolib) 716 CASE (jpnf90 ) ; clsuffix = '.nc' 717 CASE DEFAULT ; clsuffix = '' 718 CALL ctl_stop( TRIM(clinfo), 'accepted IO library is only jpnf90 (jpioipsl option has been removed) ' ) 719 END SELECT 706 clsuffix = '.nc' 720 707 ! Add the suffix if needed 721 708 iln = LEN_TRIM(clname) … … 802 789 ENDIF 803 790 IF( istop == nstop ) THEN ! no error within this routine 804 SELECT CASE (iolib) 805 CASE (jpnf90 ) ; CALL iom_nf90_open( clname, kiomid, llwrt, llok, idompar, kdlev = kdlev ) 806 CASE DEFAULT 807 CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed) ' ) 808 END SELECT 791 CALL iom_nf90_open( clname, kiomid, llwrt, llok, idompar, kdlev = kdlev ) 809 792 ENDIF 810 793 ! … … 839 822 DO jf = i_s, i_e 840 823 IF( iom_file(jf)%nfid > 0 ) THEN 841 SELECT CASE (iom_file(jf)%iolib) 842 CASE (jpnf90 ) ; CALL iom_nf90_close( jf ) 843 CASE DEFAULT 844 CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 845 END SELECT 824 CALL iom_nf90_close( jf ) 846 825 iom_file(jf)%nfid = 0 ! free the id 847 826 IF( PRESENT(kiomid) ) kiomid = 0 ! return 0 as id to specify that the file was closed … … 896 875 iiv = iiv + 1 897 876 IF( iiv <= jpmax_vars ) THEN 898 SELECT CASE (iom_file(kiomid)%iolib) 899 CASE (jpnf90 ) ; iom_varid = iom_nf90_varid ( kiomid, cdvar, iiv, kdimsz, kndims ) 900 CASE DEFAULT 901 CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 902 END SELECT 877 iom_varid = iom_nf90_varid( kiomid, cdvar, iiv, kdimsz, kndims ) 903 878 ELSE 904 879 CALL ctl_stop( trim(clinfo), 'Too many variables in the file '//iom_file(kiomid)%name, & 905 & 880 & 'increase the parameter jpmax_vars') 906 881 ENDIF 907 882 IF( llstop .AND. iom_varid == -1 ) CALL ctl_stop( TRIM(clinfo)//' not found' ) … … 962 937 & 'with 1 or more spatial dimensions: '//cldmspc//' were found.' , & 963 938 & 'Use ncwa -a to suppress the unnecessary dimensions' ) 964 SELECT CASE (iom_file(kiomid)%iolib) 965 CASE (jpnf90 ) ; CALL iom_nf90_get( kiomid, idvar, pvar, itime ) 966 CASE DEFAULT 967 CALL ctl_stop( 'iom_g0d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 968 END SELECT 939 CALL iom_nf90_get( kiomid, idvar, pvar, itime ) 969 940 ENDIF 970 941 ENDIF … … 976 947 CALL iom_swap( TRIM(cxios_context) ) 977 948 #else 978 nstop = nstop + 1979 clinfo = 'Can not use XIOS in iom_g0d, file: '//trim(clname)//', var:'//trim(cdvar)949 WRITE(ctmp1,*) 'Can not use XIOS in iom_g0d, file: '//trim(clname)//', var:'//trim(cdvar) 950 CALL ctl_stop( 'iom_g0d', ctmp1 ) 980 951 #endif 981 952 ENDIF … … 1122 1093 IF( lrowattr .AND. idom /= jpdom_data ) CALL ctl_stop(trim(clinfo), 'lrowattr present and true needs kdom = jpdom_data') 1123 1094 IF( lrowattr .AND. idom == jpdom_data ) luse_jattr = .true. 1124 ENDIF1125 IF( luse_jattr ) THEN1126 SELECT CASE (iom_file(kiomid)%iolib)1127 CASE (jpnf90 )1128 ! Ok1129 CASE DEFAULT1130 CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed)' )1131 END SELECT1132 1095 ENDIF 1133 1096 … … 1301 1264 ENDIF 1302 1265 1303 SELECT CASE (iom_file(kiomid)%iolib) 1304 CASE (jpnf90 ) ; CALL iom_nf90_get( kiomid, idvar, inbdim, istart, icnt, ix1, ix2, iy1, iy2, & 1305 & pv_r1d, pv_r2d, pv_r3d ) 1306 CASE DEFAULT 1307 CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1308 END SELECT 1266 CALL iom_nf90_get( kiomid, idvar, inbdim, istart, icnt, ix1, ix2, iy1, iy2, pv_r1d, pv_r2d, pv_r3d ) 1309 1267 1310 1268 IF( istop == nstop ) THEN ! no additional errors until this point... … … 1313 1271 !--- overlap areas and extra hallows (mpp) 1314 1272 IF( PRESENT(pv_r2d) .AND. idom /= jpdom_unknown ) THEN 1315 CALL lbc_lnk( pv_r2d,'Z',-999.,'no0' )1273 CALL lbc_lnk( 'iom', pv_r2d,'Z',-999.,'no0' ) 1316 1274 ELSEIF( PRESENT(pv_r3d) .AND. idom /= jpdom_unknown ) THEN 1317 1275 ! this if could be simplified with the new lbc_lnk that works with any size of the 3rd dimension 1318 1276 IF( icnt(3) == inlev ) THEN 1319 CALL lbc_lnk( pv_r3d,'Z',-999.,'no0' )1277 CALL lbc_lnk( 'iom', pv_r3d,'Z',-999.,'no0' ) 1320 1278 ELSE ! put some arbitrary value (a call to lbc_lnk will be done later...) 1321 1279 DO jj = nlcj+1, jpj ; pv_r3d(1:nlci, jj, :) = pv_r3d(1:nlci, nlej, :) ; END DO … … 1342 1300 CALL xios_recv_field( trim(cdvar), pv_r3d) 1343 1301 IF(idom /= jpdom_unknown ) then 1344 CALL lbc_lnk( pv_r3d,'Z',-999.,'no0' )1302 CALL lbc_lnk( 'iom', pv_r3d,'Z',-999.,'no0' ) 1345 1303 ENDIF 1346 1304 ELSEIF( PRESENT(pv_r2d) ) THEN … … 1349 1307 CALL xios_recv_field( trim(cdvar), pv_r2d) 1350 1308 IF(idom /= jpdom_unknown ) THEN 1351 CALL lbc_lnk( pv_r2d,'Z',-999.,'no0')1309 CALL lbc_lnk('iom', pv_r2d,'Z',-999.,'no0') 1352 1310 ENDIF 1353 1311 ELSEIF( PRESENT(pv_r1d) ) THEN … … 1364 1322 !some final adjustments 1365 1323 ! C1D case : always call lbc_lnk to replicate the central value over the whole 3X3 domain 1366 IF( lk_c1d .AND. PRESENT(pv_r2d) ) CALL lbc_lnk( pv_r2d,'Z',1. )1367 IF( lk_c1d .AND. PRESENT(pv_r3d) ) CALL lbc_lnk( pv_r3d,'Z',1. )1324 IF( lk_c1d .AND. PRESENT(pv_r2d) ) CALL lbc_lnk( 'iom', pv_r2d,'Z',1. ) 1325 IF( lk_c1d .AND. PRESENT(pv_r3d) ) CALL lbc_lnk( 'iom', pv_r3d,'Z',1. ) 1368 1326 1369 1327 !--- Apply scale_factor and offset … … 1422 1380 IF( iom_file(kiomid)%luld(idvar) ) THEN 1423 1381 IF( iom_file(kiomid)%dimsz(1,idvar) <= size(ptime) ) THEN 1424 SELECT CASE (iom_file(kiomid)%iolib) 1425 CASE (jpnf90 ) ; CALL iom_nf90_gettime( kiomid, idvar, ptime, cdunits, cdcalendar ) 1426 CASE DEFAULT 1427 CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1428 END SELECT 1382 CALL iom_nf90_gettime( kiomid, idvar, ptime, cdunits, cdcalendar ) 1429 1383 ELSE 1430 1384 WRITE(ctmp1,*) 'error with the size of ptime ',size(ptime),iom_file(kiomid)%dimsz(1,idvar) … … 1444 1398 END SUBROUTINE iom_gettime 1445 1399 1400 !!---------------------------------------------------------------------- 1401 !! INTERFACE iom_chkatt 1402 !!---------------------------------------------------------------------- 1403 SUBROUTINE iom_chkatt( kiomid, cdatt, llok, ksize, cdvar ) 1404 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1405 CHARACTER(len=*), INTENT(in ) :: cdatt ! Name of the attribute 1406 LOGICAL , INTENT( out) :: llok ! Error code 1407 INTEGER , INTENT( out), OPTIONAL :: ksize ! Size of the attribute array 1408 CHARACTER(len=*), INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1409 ! 1410 IF( kiomid > 0 ) THEN 1411 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_chkatt( kiomid, cdatt, llok, ksize=ksize, cdvar=cdvar ) 1412 ENDIF 1413 ! 1414 END SUBROUTINE iom_chkatt 1446 1415 1447 1416 !!---------------------------------------------------------------------- 1448 1417 !! INTERFACE iom_getatt 1449 1418 !!---------------------------------------------------------------------- 1450 SUBROUTINE iom_g0d_iatt( kiomid, cdatt, pvar, cdvar )1451 INTEGER , INTENT(in ):: kiomid ! Identifier of the file1452 CHARACTER(len=*) , INTENT(in ):: cdatt ! Name of the attribute1453 INTEGER , INTENT( out) :: pvar! read field1454 CHARACTER(len=*) , INTENT(in ), OPTIONAL:: cdvar ! Name of the variable1419 SUBROUTINE iom_g0d_iatt( kiomid, cdatt, katt0d, cdvar ) 1420 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1421 CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute 1422 INTEGER , INTENT( out) :: katt0d ! read field 1423 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1455 1424 ! 1456 1425 IF( kiomid > 0 ) THEN 1457 IF( iom_file(kiomid)%nfid > 0 ) THEN 1458 SELECT CASE (iom_file(kiomid)%iolib) 1459 CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN 1460 CALL iom_nf90_getatt( kiomid, cdatt, pvar, cdvar=cdvar ) 1461 ELSE 1462 CALL iom_nf90_getatt( kiomid, cdatt, pvar ) 1463 ENDIF 1464 CASE DEFAULT 1465 CALL ctl_stop( 'iom_g0d_iatt: accepted IO library is only jpnf90' ) 1466 END SELECT 1467 ENDIF 1426 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_getatt( kiomid, cdatt, katt0d = katt0d, cdvar=cdvar ) 1468 1427 ENDIF 1469 1428 END SUBROUTINE iom_g0d_iatt 1470 1429 1471 SUBROUTINE iom_g 0d_ratt( kiomid, cdatt, pvar, cdvar )1472 INTEGER , INTENT(in ):: kiomid ! Identifier of the file1473 CHARACTER(len=*) , INTENT(in ):: cdatt ! Name of the attribute1474 REAL(wp) , INTENT( out) :: pvar ! writtenfield1475 CHARACTER(len=*) , INTENT(in ), OPTIONAL:: cdvar ! Name of the variable1430 SUBROUTINE iom_g1d_iatt( kiomid, cdatt, katt1d, cdvar ) 1431 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1432 CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute 1433 INTEGER, DIMENSION(:) , INTENT( out) :: katt1d ! read field 1434 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1476 1435 ! 1477 1436 IF( kiomid > 0 ) THEN 1478 IF( iom_file(kiomid)%nfid > 0 ) THEN 1479 SELECT CASE (iom_file(kiomid)%iolib) 1480 CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN 1481 CALL iom_nf90_getatt( kiomid, cdatt, pvar, cdvar=cdvar ) 1482 ELSE 1483 CALL iom_nf90_getatt( kiomid, cdatt, pvar ) 1484 ENDIF 1485 CASE DEFAULT 1486 CALL ctl_stop( 'iom_g0d_ratt: accepted IO library is only jpnf90' ) 1487 END SELECT 1488 ENDIF 1437 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_getatt( kiomid, cdatt, katt1d = katt1d, cdvar=cdvar ) 1438 ENDIF 1439 END SUBROUTINE iom_g1d_iatt 1440 1441 SUBROUTINE iom_g0d_ratt( kiomid, cdatt, patt0d, cdvar ) 1442 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1443 CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute 1444 REAL(wp) , INTENT( out) :: patt0d ! read field 1445 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1446 ! 1447 IF( kiomid > 0 ) THEN 1448 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_getatt( kiomid, cdatt, patt0d = patt0d, cdvar=cdvar ) 1489 1449 ENDIF 1490 1450 END SUBROUTINE iom_g0d_ratt 1491 1451 1492 SUBROUTINE iom_g 0d_catt( kiomid, cdatt, pvar, cdvar )1493 INTEGER , INTENT(in ):: kiomid ! Identifier of the file1494 CHARACTER(len=*) , INTENT(in ):: cdatt ! Name of the attribute1495 CHARACTER(len=*), INTENT( out) :: pvar ! writtenfield1496 CHARACTER(len=*) , INTENT(in ), OPTIONAL:: cdvar ! Name of the variable1452 SUBROUTINE iom_g1d_ratt( kiomid, cdatt, patt1d, cdvar ) 1453 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1454 CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute 1455 REAL(wp), DIMENSION(:), INTENT( out) :: patt1d ! read field 1456 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1497 1457 ! 1498 1458 IF( kiomid > 0 ) THEN 1499 IF( iom_file(kiomid)%nfid > 0 ) THEN 1500 SELECT CASE (iom_file(kiomid)%iolib) 1501 CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN 1502 CALL iom_nf90_getatt( kiomid, cdatt, pvar, cdvar=cdvar ) 1503 ELSE 1504 CALL iom_nf90_getatt( kiomid, cdatt, pvar ) 1505 ENDIF 1506 CASE DEFAULT 1507 CALL ctl_stop( 'iom_g0d_ratt: accepted IO library is only jpnf90' ) 1508 END SELECT 1509 ENDIF 1459 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_getatt( kiomid, cdatt, patt1d = patt1d, cdvar=cdvar ) 1460 ENDIF 1461 END SUBROUTINE iom_g1d_ratt 1462 1463 SUBROUTINE iom_g0d_catt( kiomid, cdatt, cdatt0d, cdvar ) 1464 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1465 CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute 1466 CHARACTER(len=*) , INTENT( out) :: cdatt0d ! read field 1467 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1468 ! 1469 IF( kiomid > 0 ) THEN 1470 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_getatt( kiomid, cdatt, cdatt0d = cdatt0d, cdvar=cdvar ) 1510 1471 ENDIF 1511 1472 END SUBROUTINE iom_g0d_catt 1473 1512 1474 1513 1475 !!---------------------------------------------------------------------- 1514 1476 !! INTERFACE iom_putatt 1515 1477 !!---------------------------------------------------------------------- 1516 SUBROUTINE iom_p0d_iatt( kiomid, cdatt, pvar, cdvar )1517 INTEGER , INTENT(in ):: kiomid ! Identifier of the file1518 CHARACTER(len=*) , INTENT(in ):: cdatt ! Name of the attribute1519 INTEGER , INTENT(in ) :: pvar ! writefield1520 CHARACTER(len=*) , INTENT(in ), OPTIONAL:: cdvar ! Name of the variable1478 SUBROUTINE iom_p0d_iatt( kiomid, cdatt, katt0d, cdvar ) 1479 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1480 CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute 1481 INTEGER , INTENT(in ) :: katt0d ! written field 1482 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1521 1483 ! 1522 1484 IF( kiomid > 0 ) THEN 1523 IF( iom_file(kiomid)%nfid > 0 ) THEN 1524 SELECT CASE (iom_file(kiomid)%iolib) 1525 CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN 1526 CALL iom_nf90_putatt( kiomid, cdatt, pvar, cdvar=cdvar ) 1527 ELSE 1528 CALL iom_nf90_putatt( kiomid, cdatt, pvar ) 1529 ENDIF 1530 CASE DEFAULT 1531 CALL ctl_stop( 'iom_p0d_iatt: accepted IO library is only jpnf90' ) 1532 END SELECT 1533 ENDIF 1485 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_putatt( kiomid, cdatt, katt0d = katt0d, cdvar=cdvar ) 1534 1486 ENDIF 1535 1487 END SUBROUTINE iom_p0d_iatt 1536 1488 1537 SUBROUTINE iom_p 0d_ratt( kiomid, cdatt, pvar, cdvar )1538 INTEGER , INTENT(in ):: kiomid ! Identifier of the file1539 CHARACTER(len=*) , INTENT(in ):: cdatt ! Name of the attribute1540 REAL(wp) , INTENT(in ) :: pvar ! writefield1541 CHARACTER(len=*) , INTENT(in ), OPTIONAL:: cdvar ! Name of the variable1489 SUBROUTINE iom_p1d_iatt( kiomid, cdatt, katt1d, cdvar ) 1490 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1491 CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute 1492 INTEGER, DIMENSION(:) , INTENT(in ) :: katt1d ! written field 1493 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1542 1494 ! 1543 1495 IF( kiomid > 0 ) THEN 1544 IF( iom_file(kiomid)%nfid > 0 ) THEN 1545 SELECT CASE (iom_file(kiomid)%iolib) 1546 CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN 1547 CALL iom_nf90_putatt( kiomid, cdatt, pvar, cdvar=cdvar ) 1548 ELSE 1549 CALL iom_nf90_putatt( kiomid, cdatt, pvar ) 1550 ENDIF 1551 CASE DEFAULT 1552 CALL ctl_stop( 'iom_p0d_ratt: accepted IO library is only jpnf90' ) 1553 END SELECT 1554 ENDIF 1496 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_putatt( kiomid, cdatt, katt1d = katt1d, cdvar=cdvar ) 1497 ENDIF 1498 END SUBROUTINE iom_p1d_iatt 1499 1500 SUBROUTINE iom_p0d_ratt( kiomid, cdatt, patt0d, cdvar ) 1501 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1502 CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute 1503 REAL(wp) , INTENT(in ) :: patt0d ! written field 1504 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1505 ! 1506 IF( kiomid > 0 ) THEN 1507 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_putatt( kiomid, cdatt, patt0d = patt0d, cdvar=cdvar ) 1555 1508 ENDIF 1556 1509 END SUBROUTINE iom_p0d_ratt 1557 1510 1558 SUBROUTINE iom_p 0d_catt( kiomid, cdatt, pvar, cdvar )1559 INTEGER , INTENT(in ):: kiomid ! Identifier of the file1560 CHARACTER(len=*) , INTENT(in ):: cdatt ! Name of the attribute1561 CHARACTER(len=*), INTENT(in ) :: pvar ! writefield1562 CHARACTER(len=*) , INTENT(in ), OPTIONAL:: cdvar ! Name of the variable1511 SUBROUTINE iom_p1d_ratt( kiomid, cdatt, patt1d, cdvar ) 1512 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1513 CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute 1514 REAL(wp), DIMENSION(:), INTENT(in ) :: patt1d ! written field 1515 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1563 1516 ! 1564 1517 IF( kiomid > 0 ) THEN 1565 IF( iom_file(kiomid)%nfid > 0 ) THEN 1566 SELECT CASE (iom_file(kiomid)%iolib) 1567 CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN 1568 CALL iom_nf90_putatt( kiomid, cdatt, pvar, cdvar=cdvar ) 1569 ELSE 1570 CALL iom_nf90_putatt( kiomid, cdatt, pvar ) 1571 ENDIF 1572 CASE DEFAULT 1573 CALL ctl_stop( 'iom_p0d_ratt: accepted IO library is only jpnf90' ) 1574 END SELECT 1575 ENDIF 1518 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_putatt( kiomid, cdatt, patt1d = patt1d, cdvar=cdvar ) 1519 ENDIF 1520 END SUBROUTINE iom_p1d_ratt 1521 1522 SUBROUTINE iom_p0d_catt( kiomid, cdatt, cdatt0d, cdvar ) 1523 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 1524 CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute 1525 CHARACTER(len=*) , INTENT(in ) :: cdatt0d ! written field 1526 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable 1527 ! 1528 IF( kiomid > 0 ) THEN 1529 IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_putatt( kiomid, cdatt, cdatt0d = cdatt0d, cdvar=cdvar ) 1576 1530 ENDIF 1577 1531 END SUBROUTINE iom_p0d_catt 1532 1578 1533 1579 1534 !!---------------------------------------------------------------------- … … 1604 1559 IF( iom_file(kiomid)%nfid > 0 ) THEN 1605 1560 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1606 SELECT CASE (iom_file(kiomid)%iolib) 1607 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r0d = pvar ) 1608 CASE DEFAULT 1609 CALL ctl_stop( 'iom_rp0d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1610 END SELECT 1561 CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r0d = pvar ) 1611 1562 ENDIF 1612 1563 ENDIF … … 1638 1589 IF( iom_file(kiomid)%nfid > 0 ) THEN 1639 1590 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1640 SELECT CASE (iom_file(kiomid)%iolib) 1641 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r1d = pvar ) 1642 CASE DEFAULT 1643 CALL ctl_stop( 'iom_rp1d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1644 END SELECT 1591 CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r1d = pvar ) 1645 1592 ENDIF 1646 1593 ENDIF … … 1672 1619 IF( iom_file(kiomid)%nfid > 0 ) THEN 1673 1620 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1674 SELECT CASE (iom_file(kiomid)%iolib) 1675 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r2d = pvar ) 1676 CASE DEFAULT 1677 CALL ctl_stop( 'iom_rp2d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1678 END SELECT 1621 CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r2d = pvar ) 1679 1622 ENDIF 1680 1623 ENDIF … … 1706 1649 IF( iom_file(kiomid)%nfid > 0 ) THEN 1707 1650 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1708 SELECT CASE (iom_file(kiomid)%iolib) 1709 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r3d = pvar ) 1710 CASE DEFAULT 1711 CALL ctl_stop( 'iom_rp3d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1712 END SELECT 1651 CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r3d = pvar ) 1713 1652 ENDIF 1714 1653 ENDIF … … 1716 1655 END SUBROUTINE iom_rp3d 1717 1656 1657 1658 SUBROUTINE iom_delay_rst( cdaction, cdcpnt, kncid ) 1659 !!--------------------------------------------------------------------- 1660 !! Routine iom_delay_rst: used read/write restart related to mpp_delay 1661 !! 1662 !!--------------------------------------------------------------------- 1663 CHARACTER(len=*), INTENT(in ) :: cdaction ! 1664 CHARACTER(len=*), INTENT(in ) :: cdcpnt 1665 INTEGER , INTENT(in ) :: kncid 1666 ! 1667 INTEGER :: ji 1668 INTEGER :: indim 1669 LOGICAL :: llattexist 1670 REAL(wp), ALLOCATABLE, DIMENSION(:) :: zreal1d 1671 !!--------------------------------------------------------------------- 1672 ! 1673 ! =================================== 1674 IF( TRIM(cdaction) == 'READ' ) THEN ! read restart related to mpp_delay ! 1675 ! =================================== 1676 DO ji = 1, nbdelay 1677 IF ( c_delaycpnt(ji) == cdcpnt ) THEN 1678 CALL iom_chkatt( kncid, 'DELAY_'//c_delaylist(ji), llattexist, indim ) 1679 IF( llattexist ) THEN 1680 ALLOCATE( todelay(ji)%z1d(indim) ) 1681 CALL iom_getatt( kncid, 'DELAY_'//c_delaylist(ji), todelay(ji)%z1d(:) ) 1682 ndelayid(ji) = 0 ! set to 0 to specify that the value was read in the restart 1683 ENDIF 1684 ENDIF 1685 END DO 1686 ! ==================================== 1687 ELSE ! write restart related to mpp_delay ! 1688 ! ==================================== 1689 DO ji = 1, nbdelay ! save only ocean delayed global communication variables 1690 IF ( c_delaycpnt(ji) == cdcpnt ) THEN 1691 IF( ASSOCIATED(todelay(ji)%z1d) ) THEN 1692 CALL mpp_delay_rcv(ji) ! make sure %z1d is received 1693 CALL iom_putatt( kncid, 'DELAY_'//c_delaylist(ji), todelay(ji)%z1d(:) ) 1694 ENDIF 1695 ENDIF 1696 END DO 1697 ! 1698 ENDIF 1699 1700 END SUBROUTINE iom_delay_rst 1701 1702 1718 1703 1719 1704 !!---------------------------------------------------------------------- … … 1971 1956 SELECT CASE ( cdgrd ) 1972 1957 CASE('T') ; zmask(:,:,:) = tmask(:,:,:) 1973 CASE('U') ; zmask(2:jpim1,:,:) = tmask(2:jpim1,:,:) + tmask(3:jpi,:,:) ; CALL lbc_lnk( zmask, 'U', 1. )1974 CASE('V') ; zmask(:,2:jpjm1,:) = tmask(:,2:jpjm1,:) + tmask(:,3:jpj,:) ; CALL lbc_lnk( zmask, 'V', 1. )1958 CASE('U') ; zmask(2:jpim1,:,:) = tmask(2:jpim1,:,:) + tmask(3:jpi,:,:) ; CALL lbc_lnk( 'iom', zmask, 'U', 1. ) 1959 CASE('V') ; zmask(:,2:jpjm1,:) = tmask(:,2:jpjm1,:) + tmask(:,3:jpj,:) ; CALL lbc_lnk( 'iom', zmask, 'V', 1. ) 1975 1960 CASE('W') ; zmask(:,:,2:jpk ) = tmask(:,:,1:jpkm1) + tmask(:,:,2:jpk) ; zmask(:,:,1) = tmask(:,:,1) 1976 1961 END SELECT … … 2015 2000 ! 2016 2001 z_fld(:,:) = 1._wp 2017 CALL lbc_lnk( z_fld, cdgrd, -1. ) ! Working array for location of northfold2002 CALL lbc_lnk( 'iom', z_fld, cdgrd, -1. ) ! Working array for location of northfold 2018 2003 ! 2019 2004 ! Cell vertices that can be defined … … 2033 2018 ! Cell vertices on boundries 2034 2019 DO jn = 1, 4 2035 CALL lbc_lnk( z_bnds(jn,:,:,1), cdgrd, 1., pval=999._wp )2036 CALL lbc_lnk( z_bnds(jn,:,:,2), cdgrd, 1., pval=999._wp )2020 CALL lbc_lnk( 'iom', z_bnds(jn,:,:,1), cdgrd, 1., pval=999._wp ) 2021 CALL lbc_lnk( 'iom', z_bnds(jn,:,:,2), cdgrd, 1., pval=999._wp ) 2037 2022 END DO 2038 2023 ! -
NEMO/trunk/src/OCE/IOM/iom_def.F90
r10068 r10425 23 23 INTEGER, PARAMETER, PUBLIC :: jpdom_autoglo_xy = 9 !: Automatically set horizontal dimensions only 24 24 INTEGER, PARAMETER, PUBLIC :: jpdom_autodta = 10 !: 25 26 INTEGER, PARAMETER, PUBLIC :: jpnf90 = 101 !: Use nf90 library27 28 INTEGER, PARAMETER, PUBLIC :: jprstlib = jpnf90 !: restarts io library29 25 30 26 INTEGER, PARAMETER, PUBLIC :: jp_r8 = 200 !: write REAL(8) … … 55 51 CHARACTER(LEN=240) :: name !: name of the file 56 52 INTEGER :: nfid !: identifier of the file (0 if closed) 57 INTEGER :: iolib !: library used to read the file (jpnf90 or new formats,58 53 !: jpioipsl option has been removed) 59 54 INTEGER :: nvars !: number of identified varibles in the file -
NEMO/trunk/src/OCE/IOM/iom_nf90.F90
r10068 r10425 30 30 31 31 PUBLIC iom_nf90_open , iom_nf90_close, iom_nf90_varid, iom_nf90_get, iom_nf90_gettime, iom_nf90_rstput 32 PUBLIC iom_nf90_ getatt, iom_nf90_putatt32 PUBLIC iom_nf90_chkatt, iom_nf90_getatt, iom_nf90_putatt 33 33 34 34 INTERFACE iom_nf90_get 35 35 MODULE PROCEDURE iom_nf90_g0d, iom_nf90_g123d 36 END INTERFACE37 INTERFACE iom_nf90_getatt38 MODULE PROCEDURE iom_nf90_giatt, iom_nf90_gratt, iom_nf90_gcatt39 END INTERFACE40 INTERFACE iom_nf90_putatt41 MODULE PROCEDURE iom_nf90_piatt, iom_nf90_pratt, iom_nf90_pcatt42 36 END INTERFACE 43 37 INTERFACE iom_nf90_rstput … … 129 123 CALL iom_nf90_check(NF90_CREATE( TRIM(cdname), imode, if90id, chunksize = ichunk ), clinfo) 130 124 ENDIF 131 CALL iom_nf90_check(NF90_SET_FILL( if90id, NF90_NOFILL, idmy), clinfo)125 CALL iom_nf90_check(NF90_SET_FILL( if90id, NF90_NOFILL, idmy ), clinfo) 132 126 ! define dimensions 133 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'x' , kdompar(1,1) , idmy ), clinfo) 134 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'y' , kdompar(2,1) , idmy ), clinfo) 135 IF( PRESENT(kdlev) ) THEN 136 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'numcat' , ilevels , idmy ), clinfo) 137 ELSE 138 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'nav_lev', ilevels , idmy ), clinfo) 139 ENDIF 127 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'x', kdompar(1,1), idmy ), clinfo) 128 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'y', kdompar(2,1), idmy ), clinfo) 129 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'nav_lev', jpk, idmy ), clinfo) 140 130 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'time_counter', NF90_UNLIMITED, idmy ), clinfo) 131 IF( PRESENT(kdlev) ) & 132 CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'numcat', kdlev, idmy ), clinfo) 141 133 ! global attributes 142 134 CALL iom_nf90_check(NF90_PUT_ATT( if90id, NF90_GLOBAL, 'DOMAIN_number_total' , jpnij ), clinfo) … … 165 157 iom_file(kiomid)%name = TRIM(cdname) 166 158 iom_file(kiomid)%nfid = if90id 167 iom_file(kiomid)%iolib = jpnf90168 159 iom_file(kiomid)%nvars = 0 169 160 iom_file(kiomid)%irec = -1 ! useless for NetCDF files, used to know if the file is in define mode … … 329 320 END SUBROUTINE iom_nf90_g123d 330 321 331 !!---------------------------------------------------------------------- 332 !! INTERFACE iom_nf90_getatt 333 !!---------------------------------------------------------------------- 334 335 SUBROUTINE iom_nf90_giatt( kiomid, cdatt, pv_i0d, cdvar) 336 !!----------------------------------------------------------------------- 337 !! *** ROUTINE iom_nf90_giatt *** 338 !! 339 !! ** Purpose : read an integer attribute with NF90 322 323 SUBROUTINE iom_nf90_chkatt( kiomid, cdatt, llok, ksize, cdvar ) 324 !!----------------------------------------------------------------------- 325 !! *** ROUTINE iom_nf90_chkatt *** 326 !! 327 !! ** Purpose : check existence of attribute with NF90 340 328 !! (either a global attribute (default) or a variable 341 329 !! attribute if optional variable name is supplied (cdvar)) … … 343 331 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 344 332 CHARACTER(len=*), INTENT(in ) :: cdatt ! attribute name 345 INTEGER , INTENT( out) :: pv_i0d ! read field 333 LOGICAL , INTENT( out) :: llok ! error code 334 INTEGER , INTENT( out), OPTIONAL & 335 & :: ksize ! attribute size 346 336 CHARACTER(len=*), INTENT(in ), OPTIONAL & 347 337 & :: cdvar ! name of the variable 338 ! 339 INTEGER :: if90id ! temporary integer 340 INTEGER :: isize ! temporary integer 341 INTEGER :: ivarid ! NetCDF variable Id 342 !--------------------------------------------------------------------- 343 ! 344 if90id = iom_file(kiomid)%nfid 345 IF( PRESENT(cdvar) ) THEN 346 ! check the variable exists in the file 347 llok = NF90_INQ_VARID( if90id, TRIM(cdvar), ivarid ) == nf90_noerr 348 IF( llok ) & 349 ! check the variable has the attribute required 350 llok = NF90_Inquire_attribute(if90id, ivarid, cdatt, len=isize ) == nf90_noerr 351 ELSE 352 llok = NF90_Inquire_attribute(if90id, NF90_GLOBAL, cdatt, len=isize ) == nf90_noerr 353 ENDIF 354 ! 355 IF( PRESENT(ksize) ) ksize = isize 356 ! 357 IF( .not. llok) & 358 CALL ctl_warn('iom_nf90_chkatt: no attribute '//cdatt//' found') 359 ! 360 END SUBROUTINE iom_nf90_chkatt 361 362 363 !!---------------------------------------------------------------------- 364 !! INTERFACE iom_nf90_getatt 365 !!---------------------------------------------------------------------- 366 367 SUBROUTINE iom_nf90_getatt( kiomid, cdatt, katt0d, katt1d, patt0d, patt1d, cdatt0d, cdvar) 368 !!----------------------------------------------------------------------- 369 !! *** ROUTINE iom_nf90_getatt *** 370 !! 371 !! ** Purpose : read an attribute with NF90 372 !! (either a global attribute (default) or a variable 373 !! attribute if optional variable name is supplied (cdvar)) 374 !!----------------------------------------------------------------------- 375 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 376 CHARACTER(len=*) , INTENT(in ) :: cdatt ! attribute name 377 INTEGER , INTENT( out), OPTIONAL :: katt0d ! read scalar integer 378 INTEGER, DIMENSION(:) , INTENT( out), OPTIONAL :: katt1d ! read 1d array integer 379 REAL(wp) , INTENT( out), OPTIONAL :: patt0d ! read scalar real 380 REAL(wp), DIMENSION(:), INTENT( out), OPTIONAL :: patt1d ! read 1d array real 381 CHARACTER(len=*) , INTENT( out), OPTIONAL :: cdatt0d ! read character 382 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! name of the variable 348 383 ! 349 384 INTEGER :: if90id ! temporary integer … … 361 396 llok = NF90_Inquire_attribute(if90id, ivarid, cdatt) == nf90_noerr 362 397 ELSE 363 CALL ctl_warn('iom_nf90_getatt: no variable '// cdvar//' found')398 CALL ctl_warn('iom_nf90_getatt: no variable '//TRIM(cdvar)//' found') 364 399 ENDIF 365 400 ELSE … … 369 404 ! 370 405 IF( llok) THEN 371 clinfo = 'iom_nf90_getatt, file: '//TRIM(iom_file(kiomid)%name)//', giatt: '//TRIM(cdatt) 372 CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values=pv_i0d), clinfo) 406 clinfo = 'iom_nf90_getatt, file: '//TRIM(iom_file(kiomid)%name)//', att: '//TRIM(cdatt) 407 IF(PRESENT( katt0d)) CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values = katt0d), clinfo) 408 IF(PRESENT( katt1d)) CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values = katt1d), clinfo) 409 IF(PRESENT( patt0d)) CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values = patt0d), clinfo) 410 IF(PRESENT( patt1d)) CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values = patt1d), clinfo) 411 IF(PRESENT(cdatt0d)) CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values = cdatt0d), clinfo) 373 412 ELSE 374 CALL ctl_warn('iom_nf90_getatt: no attribute '//cdatt//' found') 375 pv_i0d = -999 376 ENDIF 377 ! 378 END SUBROUTINE iom_nf90_giatt 379 380 381 SUBROUTINE iom_nf90_gratt( kiomid, cdatt, pv_r0d, cdvar ) 382 !!----------------------------------------------------------------------- 383 !! *** ROUTINE iom_nf90_gratt *** 384 !! 385 !! ** Purpose : read a real attribute with NF90 413 CALL ctl_warn('iom_nf90_getatt: no attribute '//TRIM(cdatt)//' found') 414 IF(PRESENT( katt0d)) katt0d = -999 415 IF(PRESENT( katt1d)) katt1d(:) = -999 416 IF(PRESENT( patt0d)) patt0d = -999._wp 417 IF(PRESENT( patt1d)) patt1d(:) = -999._wp 418 IF(PRESENT(cdatt0d)) cdatt0d = '!' 419 ENDIF 420 ! 421 END SUBROUTINE iom_nf90_getatt 422 423 424 SUBROUTINE iom_nf90_putatt( kiomid, cdatt, katt0d, katt1d, patt0d, patt1d, cdatt0d, cdvar) 425 !!----------------------------------------------------------------------- 426 !! *** ROUTINE iom_nf90_putatt *** 427 !! 428 !! ** Purpose : write an attribute with NF90 386 429 !! (either a global attribute (default) or a variable 387 430 !! attribute if optional variable name is supplied (cdvar)) 388 431 !!----------------------------------------------------------------------- 389 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 390 CHARACTER(len=*) , INTENT(in ) :: cdatt ! attribute name 391 REAL(wp) , INTENT( out) :: pv_r0d ! read field 392 CHARACTER(len=*), OPTIONAL, INTENT(in ) :: cdvar ! name of the variable 393 ! 394 INTEGER :: if90id ! temporary integer 395 INTEGER :: ivarid ! NetCDF variable Id 396 LOGICAL :: llok ! temporary logical 397 CHARACTER(LEN=100) :: clinfo ! info character 432 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 433 CHARACTER(len=*) , INTENT(in ) :: cdatt ! attribute name 434 INTEGER , INTENT(in ), OPTIONAL :: katt0d ! read scalar integer 435 INTEGER, DIMENSION(:) , INTENT(in ), OPTIONAL :: katt1d ! read 1d array integer 436 REAL(wp) , INTENT(in ), OPTIONAL :: patt0d ! read scalar real 437 REAL(wp), DIMENSION(:), INTENT(in ), OPTIONAL :: patt1d ! read 1d array real 438 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdatt0d ! read character 439 CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! name of the variable 440 ! 441 INTEGER :: if90id ! temporary integer 442 INTEGER :: ivarid ! NetCDF variable Id 443 INTEGER :: isize ! Attribute size 444 INTEGER :: itype ! Attribute type 445 LOGICAL :: llok ! temporary logical 446 LOGICAL :: llatt ! temporary logical 447 LOGICAL :: lldata ! temporary logical 448 CHARACTER(LEN=100) :: clinfo ! info character 398 449 !--------------------------------------------------------------------- 399 450 ! 400 451 if90id = iom_file(kiomid)%nfid 401 452 IF( PRESENT(cdvar) ) THEN 402 ! check the variable exists in the file 403 llok = NF90_INQ_VARID( if90id, TRIM(cdvar), ivarid ) == nf90_noerr 404 IF( llok ) THEN 405 ! check the variable has the attribute required 406 llok = NF90_Inquire_attribute(if90id, ivarid, cdatt) == nf90_noerr 407 ELSE 408 CALL ctl_warn('iom_nf90_getatt: no variable '//cdvar//' found') 453 llok = NF90_INQ_VARID( if90id, TRIM(cdvar), ivarid ) == nf90_noerr ! is the variable in the file? 454 IF( .NOT. llok ) THEN 455 CALL ctl_warn('iom_nf90_putatt: no variable '//TRIM(cdvar)//' found' & 456 & , ' no attribute '//cdatt//' written' ) 457 RETURN 409 458 ENDIF 410 459 ELSE 411 llok = NF90_Inquire_attribute(if90id, NF90_GLOBAL, cdatt) == nf90_noerr412 460 ivarid = NF90_GLOBAL 413 461 ENDIF 414 ! 415 IF( llok) THEN 416 clinfo = 'iom_nf90_getatt, file: '//TRIM(iom_file(kiomid)%name)//', gratt: '//TRIM(cdatt) 417 CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values=pv_r0d), clinfo) 418 ELSE 419 CALL ctl_warn('iom_nf90_getatt: no attribute '//cdatt//' found') 420 pv_r0d = -999._wp 421 ENDIF 422 ! 423 END SUBROUTINE iom_nf90_gratt 424 425 426 SUBROUTINE iom_nf90_gcatt( kiomid, cdatt, pv_c0d, cdvar ) 427 !!----------------------------------------------------------------------- 428 !! *** ROUTINE iom_nf90_gcatt *** 429 !! 430 !! ** Purpose : read a character attribute with NF90 431 !! (either a global attribute (default) or a variable 432 !! attribute if optional variable name is supplied (cdvar)) 433 !!----------------------------------------------------------------------- 434 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 435 CHARACTER(len=*) , INTENT(in ) :: cdatt ! attribute name 436 CHARACTER(len=*) , INTENT( out) :: pv_c0d ! read field 437 CHARACTER(len=*), OPTIONAL, INTENT(in ) :: cdvar ! name of the variable 438 ! 439 INTEGER :: if90id ! temporary integer 440 INTEGER :: ivarid ! NetCDF variable Id 441 LOGICAL :: llok ! temporary logical 442 CHARACTER(LEN=100) :: clinfo ! info character 443 !--------------------------------------------------------------------- 444 ! 445 if90id = iom_file(kiomid)%nfid 446 IF( PRESENT(cdvar) ) THEN 447 ! check the variable exists in the file 448 llok = NF90_INQ_VARID( if90id, TRIM(cdvar), ivarid ) == nf90_noerr 449 IF( llok ) THEN 450 ! check the variable has the attribute required 451 llok = NF90_Inquire_attribute(if90id, ivarid, cdatt) == nf90_noerr 452 ELSE 453 CALL ctl_warn('iom_nf90_getatt: no variable '//cdvar//' found') 454 ENDIF 455 ELSE 456 llok = NF90_Inquire_attribute(if90id, NF90_GLOBAL, cdatt) == nf90_noerr 457 ivarid = NF90_GLOBAL 458 ENDIF 459 ! 460 IF( llok) THEN 461 clinfo = 'iom_nf90_getatt, file: '//TRIM(iom_file(kiomid)%name)//', gcatt: '//TRIM(cdatt) 462 CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values=pv_c0d), clinfo) 463 ELSE 464 CALL ctl_warn('iom_nf90_getatt: no attribute '//cdatt//' found') 465 pv_c0d = '!' 466 ENDIF 467 ! 468 END SUBROUTINE iom_nf90_gcatt 469 470 471 !!---------------------------------------------------------------------- 472 !! INTERFACE iom_nf90_putatt 473 !!---------------------------------------------------------------------- 474 475 SUBROUTINE iom_nf90_piatt( kiomid, cdatt, pv_i0d, cdvar) 476 !!----------------------------------------------------------------------- 477 !! *** ROUTINE iom_nf90_piatt *** 478 !! 479 !! ** Purpose : write an integer attribute with NF90 480 !! (either a global attribute (default) or a variable 481 !! attribute if optional variable name is supplied (cdvar)) 482 !!----------------------------------------------------------------------- 483 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 484 CHARACTER(len=*), INTENT(in ) :: cdatt ! attribute name 485 INTEGER , INTENT(in ) :: pv_i0d ! write field 486 CHARACTER(len=*), INTENT(in ), OPTIONAL & 487 & :: cdvar ! name of the variable 488 ! 489 INTEGER :: if90id ! temporary integer 490 INTEGER :: ivarid ! NetCDF variable Id 491 LOGICAL :: llok ! temporary logical 492 LOGICAL :: lenddef ! temporary logical 493 CHARACTER(LEN=100) :: clinfo ! info character 494 !--------------------------------------------------------------------- 495 ! 496 if90id = iom_file(kiomid)%nfid 497 lenddef = .false. 498 IF( PRESENT(cdvar) ) THEN 499 ! check the variable exists in the file 500 llok = NF90_INQ_VARID( if90id, TRIM(cdvar), ivarid ) == nf90_noerr 501 IF( .NOT. llok ) THEN 502 CALL ctl_warn('iom_nf90_putatt: no variable '//cdvar//' found') 503 ENDIF 504 ELSE 505 llok = .true. 506 ivarid = NF90_GLOBAL 507 ENDIF 508 ! 509 IF( llok) THEN 510 clinfo = 'iom_nf90_putatt, file: '//TRIM(iom_file(kiomid)%name)//', piatt: '//TRIM(cdatt) 511 IF( iom_file(kiomid)%irec /= -1 ) THEN 512 ! trick: irec used to know if the file is in define mode or not 513 ! if it is not then temporarily put it into define mode 514 CALL iom_nf90_check(NF90_REDEF( if90id ), clinfo) 515 lenddef = .true. 516 ENDIF 462 llatt = NF90_Inquire_attribute(if90id, ivarid, cdatt, len = isize, xtype = itype ) == nf90_noerr 463 ! 464 ! trick: irec used to know if the file is in define mode or not 465 lldata = iom_file(kiomid)%irec /= -1 ! default: go back in define mode if in data mode 466 IF( lldata .AND. llatt ) THEN ! attribute already there. Do we really need to go back in define mode? 467 ! do we have the appropriate type? 468 IF(PRESENT( katt0d) .OR. PRESENT( katt1d)) llok = itype == NF90_INT 469 IF(PRESENT( patt0d) .OR. PRESENT( patt1d)) llok = itype == NF90_DOUBLE 470 IF(PRESENT(cdatt0d) ) llok = itype == NF90_CHAR 471 ! and do we have the appropriate size? 472 IF(PRESENT( katt0d)) llok = llok .AND. isize == 1 473 IF(PRESENT( katt1d)) llok = llok .AND. isize == SIZE(katt1d) 474 IF(PRESENT( patt0d)) llok = llok .AND. isize == 1 475 IF(PRESENT( patt1d)) llok = llok .AND. isize == SIZE(patt1d) 476 IF(PRESENT(cdatt0d)) llok = llok .AND. isize == LEN_TRIM(cdatt0d) 517 477 ! 518 CALL iom_nf90_check(NF90_PUT_ATT(if90id, ivarid, cdatt, values=pv_i0d), clinfo) 519 ! 520 IF( lenddef ) THEN 521 ! file was in data mode on entry; put it back in that mode 522 CALL iom_nf90_check(NF90_ENDDEF( if90id ), clinfo) 523 ENDIF 524 ELSE 525 CALL ctl_warn('iom_nf90_putatt: no attribute '//cdatt//' written') 526 ENDIF 527 ! 528 END SUBROUTINE iom_nf90_piatt 529 530 531 SUBROUTINE iom_nf90_pratt( kiomid, cdatt, pv_r0d, cdvar ) 532 !!----------------------------------------------------------------------- 533 !! *** ROUTINE iom_nf90_pratt *** 534 !! 535 !! ** Purpose : write a real attribute with NF90 536 !! (either a global attribute (default) or a variable 537 !! attribute if optional variable name is supplied (cdvar)) 538 !!----------------------------------------------------------------------- 539 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 540 CHARACTER(len=*) , INTENT(in ) :: cdatt ! attribute name 541 REAL(wp) , INTENT(in ) :: pv_r0d ! write field 542 CHARACTER(len=*), OPTIONAL, INTENT(in ) :: cdvar ! name of the variable 543 ! 544 INTEGER :: if90id ! temporary integer 545 INTEGER :: ivarid ! NetCDF variable Id 546 LOGICAL :: llok ! temporary logical 547 LOGICAL :: lenddef ! temporary logical 548 CHARACTER(LEN=100) :: clinfo ! info character 549 !--------------------------------------------------------------------- 550 ! 551 if90id = iom_file(kiomid)%nfid 552 lenddef = .false. 553 IF( PRESENT(cdvar) ) THEN 554 ! check the variable exists in the file 555 llok = NF90_INQ_VARID( if90id, TRIM(cdvar), ivarid ) == nf90_noerr 556 IF( .NOT. llok ) THEN 557 CALL ctl_warn('iom_nf90_putatt: no variable '//cdvar//' found') 558 ENDIF 559 ELSE 560 llok = .true. 561 ivarid = NF90_GLOBAL 562 ENDIF 563 ! 564 IF( llok) THEN 565 clinfo = 'iom_nf90_putatt, file: '//TRIM(iom_file(kiomid)%name)//', pratt: '//TRIM(cdatt) 566 IF( iom_file(kiomid)%irec /= -1 ) THEN 567 ! trick: irec used to know if the file is in define mode or not 568 ! if it is not then temporarily put it into define mode 569 CALL iom_nf90_check(NF90_REDEF( if90id ), clinfo) 570 lenddef = .true. 571 ENDIF 572 ! 573 CALL iom_nf90_check(NF90_PUT_ATT(if90id, ivarid, cdatt, values=pv_r0d), clinfo) 574 ! 575 IF( lenddef ) THEN 576 ! file was in data mode on entry; put it back in that mode 577 CALL iom_nf90_check(NF90_ENDDEF( if90id ), clinfo) 578 ENDIF 579 ELSE 580 CALL ctl_warn('iom_nf90_putatt: no attribute '//cdatt//' written') 581 ENDIF 582 ! 583 END SUBROUTINE iom_nf90_pratt 584 585 586 SUBROUTINE iom_nf90_pcatt( kiomid, cdatt, pv_c0d, cdvar ) 587 !!----------------------------------------------------------------------- 588 !! *** ROUTINE iom_nf90_pcatt *** 589 !! 590 !! ** Purpose : write a character attribute with NF90 591 !! (either a global attribute (default) or a variable 592 !! attribute if optional variable name is supplied (cdvar)) 593 !!----------------------------------------------------------------------- 594 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 595 CHARACTER(len=*) , INTENT(in ) :: cdatt ! attribute name 596 CHARACTER(len=*) , INTENT(in ) :: pv_c0d ! write field 597 CHARACTER(len=*), OPTIONAL, INTENT(in ) :: cdvar ! name of the variable 598 ! 599 INTEGER :: if90id ! temporary integer 600 INTEGER :: ivarid ! NetCDF variable Id 601 LOGICAL :: llok ! temporary logical 602 LOGICAL :: lenddef ! temporary logical 603 CHARACTER(LEN=100) :: clinfo ! info character 604 !--------------------------------------------------------------------- 605 ! 606 if90id = iom_file(kiomid)%nfid 607 lenddef = .false. 608 IF( PRESENT(cdvar) ) THEN 609 ! check the variable exists in the file 610 llok = NF90_INQ_VARID( if90id, TRIM(cdvar), ivarid ) == nf90_noerr 611 IF( .NOT. llok ) THEN 612 CALL ctl_warn('iom_nf90_putatt: no variable '//cdvar//' found') 613 ENDIF 614 ELSE 615 llok = .true. 616 ivarid = NF90_GLOBAL 617 ENDIF 618 ! 619 IF( llok) THEN 620 clinfo = 'iom_nf90_putatt, file: '//TRIM(iom_file(kiomid)%name)//', pcatt: '//TRIM(cdatt) 621 IF( iom_file(kiomid)%irec /= -1 ) THEN 622 ! trick: irec used to know if the file is in define mode or not 623 ! if it is not then temporarily put it into define mode 624 CALL iom_nf90_check(NF90_REDEF( if90id ), clinfo) 625 lenddef = .true. 626 ENDIF 627 ! 628 CALL iom_nf90_check(NF90_PUT_ATT(if90id, ivarid, cdatt, values=pv_c0d), clinfo) 629 ! 630 IF( lenddef ) THEN 631 ! file was in data mode on entry; put it back in that mode 632 CALL iom_nf90_check(NF90_ENDDEF( if90id ), clinfo) 633 ENDIF 634 ELSE 635 CALL ctl_warn('iom_nf90_putatt: no attribute '//cdatt//' written') 636 ENDIF 637 ! 638 END SUBROUTINE iom_nf90_pcatt 478 lldata = .NOT. llok 479 ENDIF 480 ! 481 clinfo = 'iom_nf90_putatt, file: '//TRIM(iom_file(kiomid)%name)//', att: '//TRIM(cdatt) 482 IF(lldata) CALL iom_nf90_check(NF90_REDEF( if90id ), clinfo) ! leave data mode to define mode 483 ! 484 IF(PRESENT( katt0d)) CALL iom_nf90_check(NF90_PUT_ATT(if90id, ivarid, cdatt, values = katt0d) , clinfo) 485 IF(PRESENT( katt1d)) CALL iom_nf90_check(NF90_PUT_ATT(if90id, ivarid, cdatt, values = katt1d) , clinfo) 486 IF(PRESENT( patt0d)) CALL iom_nf90_check(NF90_PUT_ATT(if90id, ivarid, cdatt, values = patt0d) , clinfo) 487 IF(PRESENT( patt1d)) CALL iom_nf90_check(NF90_PUT_ATT(if90id, ivarid, cdatt, values = patt1d) , clinfo) 488 IF(PRESENT(cdatt0d)) CALL iom_nf90_check(NF90_PUT_ATT(if90id, ivarid, cdatt, values = trim(cdatt0d)), clinfo) 489 ! 490 IF(lldata) CALL iom_nf90_check(NF90_ENDDEF( if90id ), clinfo) ! leave define mode to data mode 491 ! 492 END SUBROUTINE iom_nf90_putatt 639 493 640 494 … … 693 547 INTEGER, DIMENSION(4) :: idimid ! dimensions id 694 548 CHARACTER(LEN=256) :: clinfo ! info character 695 CHARACTER(LEN= 12), DIMENSION( 4) :: cltmp ! temporary character549 CHARACTER(LEN= 12), DIMENSION(5) :: cltmp ! temporary character 696 550 INTEGER :: if90id ! nf90 file identifier 697 551 INTEGER :: idmy ! dummy variable … … 704 558 ! ! when appropriate (currently chunking is applied to 4d fields only) 705 559 INTEGER :: idlv ! local variable 560 INTEGER :: idim3 ! id of the third dimension 706 561 !--------------------------------------------------------------------- 707 562 ! … … 717 572 ENDIF 718 573 ! define the dimension variables if it is not already done 719 IF(iom_file(kiomid)%nlev == jpk ) THEN 720 cltmp = (/ 'nav_lon ', 'nav_lat ', 'nav_lev ', 'time_counter' /) 721 ELSE 722 cltmp = (/ 'nav_lon ', 'nav_lat ', 'numcat ', 'time_counter' /) 723 ENDIF 574 cltmp = (/ 'nav_lon', 'nav_lat', 'nav_lev', 'time_counter', 'numcat' /) 724 575 CALL iom_nf90_check(NF90_DEF_VAR( if90id, TRIM(cltmp(1)), NF90_FLOAT , (/ 1, 2 /), iom_file(kiomid)%nvid(1) ), clinfo) 725 576 CALL iom_nf90_check(NF90_DEF_VAR( if90id, TRIM(cltmp(2)), NF90_FLOAT , (/ 1, 2 /), iom_file(kiomid)%nvid(2) ), clinfo) … … 729 580 iom_file(kiomid)%nvars = 4 730 581 iom_file(kiomid)%luld(1:4) = (/ .FALSE., .FALSE., .FALSE., .TRUE. /) 731 iom_file(kiomid)%cn_var(1:4) = cltmp 732 iom_file(kiomid)%ndims(1:4) = (/ 2, 2, 1, 1 /) 582 iom_file(kiomid)%cn_var(1:4) = cltmp(1:4) 583 iom_file(kiomid)%ndims(1:4) = (/ 2, 2, 1, 1 /) 584 IF( NF90_INQ_DIMID( if90id, 'numcat', idmy ) == nf90_noerr ) THEN ! add a 5th variable corresponding to the 5th dimension 585 CALL iom_nf90_check(NF90_DEF_VAR( if90id, TRIM(cltmp(5)), NF90_FLOAT , (/ 5 /), iom_file(kiomid)%nvid(5) ), clinfo) 586 iom_file(kiomid)%nvars = 5 587 iom_file(kiomid)%luld(5) = .FALSE. 588 iom_file(kiomid)%cn_var(5) = cltmp(5) 589 iom_file(kiomid)%ndims(5) = 1 590 ENDIF 733 591 ! trick: defined to 0 to say that dimension variables are defined but not yet written 734 592 iom_file(kiomid)%dimsz(1, 1) = 0 … … 752 610 ! variable definition 753 611 IF( PRESENT(pv_r0d) ) THEN ; idims = 0 754 ELSEIF( PRESENT(pv_r1d) ) THEN ; idims = 2 ; idimid(1:idims) = (/ 3,4/) 612 ELSEIF( PRESENT(pv_r1d) ) THEN 613 IF( SIZE(pv_r1d,1) == jpk ) THEN ; idim3 = 3 614 ELSE ; idim3 = 5 615 ENDIF 616 idims = 2 ; idimid(1:idims) = (/idim3,4/) 755 617 ELSEIF( PRESENT(pv_r2d) ) THEN ; idims = 3 ; idimid(1:idims) = (/1,2 ,4/) 756 ELSEIF( PRESENT(pv_r3d) ) THEN ; idims = 4 ; idimid(1:idims) = (/1,2,3,4/) 618 ELSEIF( PRESENT(pv_r3d) ) THEN 619 IF( SIZE(pv_r3d,3) == jpk ) THEN ; idim3 = 3 620 ELSE ; idim3 = 5 621 ENDIF 622 idims = 4 ; idimid(1:idims) = (/1,2,idim3,4/) 757 623 ENDIF 758 624 IF( PRESENT(ktype) ) THEN ! variable external type 759 625 SELECT CASE (ktype) 760 CASE (jp_r8) ; itype = NF90_DOUBLE761 CASE (jp_r4) ; itype = NF90_FLOAT762 CASE (jp_i4) ; itype = NF90_INT763 CASE (jp_i2) ; itype = NF90_SHORT764 CASE (jp_i1) ; itype = NF90_BYTE626 CASE (jp_r8) ; itype = NF90_DOUBLE 627 CASE (jp_r4) ; itype = NF90_FLOAT 628 CASE (jp_i4) ; itype = NF90_INT 629 CASE (jp_i2) ; itype = NF90_SHORT 630 CASE (jp_i1) ; itype = NF90_BYTE 765 631 CASE DEFAULT ; CALL ctl_stop( TRIM(clinfo)//' unknown variable type' ) 766 632 END SELECT … … 834 700 CALL iom_nf90_check( NF90_INQ_VARID( if90id, 'nav_lat' , idmy ) , clinfo ) 835 701 CALL iom_nf90_check( NF90_PUT_VAR ( if90id, idmy, gphit(ix1:ix2, iy1:iy2) ), clinfo ) 836 IF(iom_file(kiomid)%nlev == jpk ) THEN 837 !NEMO 838 CALL iom_nf90_check( NF90_INQ_VARID( if90id, 'nav_lev' , idmy ), clinfo ) 839 CALL iom_nf90_check( NF90_PUT_VAR ( if90id, idmy, gdept_1d ), clinfo ) 840 ELSE 841 CALL iom_nf90_check( NF90_INQ_VARID( if90id, 'numcat' , idmy ), clinfo) 702 CALL iom_nf90_check( NF90_INQ_VARID( if90id, 'nav_lev' , idmy ), clinfo ) 703 CALL iom_nf90_check( NF90_PUT_VAR ( if90id, idmy, gdept_1d ), clinfo ) 704 IF( NF90_INQ_VARID( if90id, 'numcat', idmy ) == nf90_noerr ) THEN 842 705 CALL iom_nf90_check( NF90_PUT_VAR ( if90id, idmy, (/ (idlv, idlv = 1,iom_file(kiomid)%nlev) /)), clinfo ) 843 706 ENDIF -
NEMO/trunk/src/OCE/IOM/restart.F90
r10068 r10425 28 28 USE iom ! I/O module 29 29 USE diurnal_bulk 30 USE lib_mpp ! distribued memory computing library 30 31 31 32 IMPLICIT NONE … … 97 98 WRITE(numout,*) 98 99 IF(.NOT.lwxios) THEN 99 SELECT CASE ( jprstlib ) 100 CASE DEFAULT ; WRITE(numout,*) & 101 ' open ocean restart NetCDF file: ',TRIM(clpath)//TRIM(clname) 102 END SELECT 100 WRITE(numout,*) ' open ocean restart NetCDF file: ',TRIM(clpath)//TRIM(clname) 103 101 IF ( snc4set%luse ) WRITE(numout,*) ' opened for NetCDF4 chunking and compression' 104 102 IF( kt == nitrst - 1 ) THEN ; WRITE(numout,*) ' kt = nitrst - 1 = ', kt … … 109 107 ! 110 108 IF(.NOT.lwxios) THEN 111 CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE. , kiolib = jprstlib)109 CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE. ) 112 110 ELSE 113 111 #if defined key_iomput … … 137 135 !! *** ROUTINE rstwrite *** 138 136 !! 139 !! ** Purpose : Write restart fields in the format corresponding to jprstlib137 !! ** Purpose : Write restart fields in NetCDF format 140 138 !! 141 139 !! ** Method : Write in numrow when kt == nitrst in NetCDF … … 146 144 IF(lwxios) CALL iom_swap( cwxios_context ) 147 145 CALL iom_rstput( kt, nitrst, numrow, 'rdt' , rdt , ldxios = lwxios) ! dynamics time step 146 CALL iom_delay_rst( 'WRITE', 'OCE', numrow ) ! save only ocean delayed global communication variables 148 147 149 148 IF ( .NOT. ln_diurnal_only ) THEN … … 197 196 !! *** ROUTINE rst_read_open *** 198 197 !! 199 !! ** Purpose : Open read files for restart (format fixed by jprstlib )198 !! ** Purpose : Open read files for NetCDF restart 200 199 !! 201 200 !! ** Method : Use a non-zero, positive value of numror to assess whether or not 202 201 !! the file has already been opened 203 202 !!---------------------------------------------------------------------- 204 INTEGER :: jlibalt = jprstlib205 203 LOGICAL :: llok 206 204 CHARACTER(lc) :: clpath ! full path to ocean output restart file … … 210 208 IF(lwp) THEN ! Contol prints 211 209 WRITE(numout,*) 212 SELECT CASE ( jprstlib ) 213 CASE ( jpnf90 ) ; WRITE(numout,*) 'rst_read : read oce NetCDF restart file' 214 END SELECT 210 WRITE(numout,*) 'rst_read : read oce NetCDF restart file' 215 211 IF ( snc4set%luse ) WRITE(numout,*) 'rst_read : configured with NetCDF4 support' 216 212 WRITE(numout,*) '~~~~~~~~' … … 219 215 clpath = TRIM(cn_ocerst_indir) 220 216 IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 221 CALL iom_open( TRIM(clpath)//cn_ocerst_in, numror , kiolib = jlibalt)217 CALL iom_open( TRIM(clpath)//cn_ocerst_in, numror ) 222 218 ! are we using XIOS to read the data? Part above will have to modified once XIOS 223 219 ! can handle checking if variable is in the restart file (there will be no need to open … … 246 242 !! *** ROUTINE rst_read *** 247 243 !! 248 !! ** Purpose : Read files for restart (format fixed by jprstlib )244 !! ** Purpose : Read files for NetCDF restart 249 245 !! 250 246 !! ** Method : Read in restart.nc file fields which are necessary for restart … … 263 259 ENDIF 264 260 261 CALL iom_delay_rst( 'READ', 'OCE', numror ) ! read only ocean delayed global communication variables 262 265 263 ! Diurnal DSST 266 264 IF( ln_diurnal ) CALL iom_get( numror, jpdom_autoglo, 'Dsst' , x_dsst, ldxios = lrxios )
Note: See TracChangeset
for help on using the changeset viewer.