- Timestamp:
- 2016-12-01T11:30:29+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2016/dev_merge_2016/NEMOGCM/NEMO/OPA_SRC/IOM/iom_nf90.F90
r6140 r7412 7 7 !! 9.0 ! 06 02 (S. Masson) Adaptation to NEMO 8 8 !! " ! 07 07 (D. Storkey) Changes to iom_nf90_gettime 9 !! 3.6 ! 2015-15 (J. Harle) Added procedure to read REAL attributes 9 10 !!-------------------------------------------------------------------- 10 11 !!gm caution add !DIR nec: improved performance to be checked as well as no result changes … … 35 36 END INTERFACE 36 37 INTERFACE iom_nf90_getatt 37 MODULE PROCEDURE iom_nf90_ intatt38 MODULE PROCEDURE iom_nf90_att 38 39 END INTERFACE 39 40 INTERFACE iom_nf90_rstput … … 313 314 314 315 315 SUBROUTINE iom_nf90_ intatt( kiomid, cdatt, pvar)316 !!----------------------------------------------------------------------- 317 !! *** ROUTINE iom_nf90_ intatt ***316 SUBROUTINE iom_nf90_att( kiomid, cdatt, pv_i0d, pv_r0d, cdvar) 317 !!----------------------------------------------------------------------- 318 !! *** ROUTINE iom_nf90_att *** 318 319 !! 319 320 !! ** Purpose : read an integer attribute with NF90 … … 321 322 INTEGER , INTENT(in ) :: kiomid ! Identifier of the file 322 323 CHARACTER(len=*), INTENT(in ) :: cdatt ! attribute name 323 INTEGER , INTENT( out) :: pvar ! read field 324 INTEGER , INTENT( out), OPTIONAL :: pv_i0d ! read field 325 REAL(wp), INTENT( out), OPTIONAL :: pv_r0d ! read field 326 CHARACTER(len=*), INTENT(in ), OPTIONAL :: cdvar ! name of the variable 324 327 ! 325 328 INTEGER :: if90id ! temporary integer 329 INTEGER :: ivarid ! NetCDF variable Id 326 330 LOGICAL :: llok ! temporary logical 327 331 CHARACTER(LEN=100) :: clinfo ! info character … … 329 333 ! 330 334 if90id = iom_file(kiomid)%nfid 331 llok = NF90_Inquire_attribute(if90id, NF90_GLOBAL, cdatt) == nf90_noerr 335 IF( PRESENT(cdvar) ) THEN 336 llok = NF90_INQ_VARID( if90id, TRIM(cdvar), ivarid ) == nf90_noerr ! does the variable exist in the file 337 IF( llok ) THEN 338 llok = NF90_Inquire_attribute(if90id, ivarid, cdatt) == nf90_noerr 339 ELSE 340 CALL ctl_warn('iom_nf90_getatt: no variable '//cdvar//' found') 341 ENDIF 342 ELSE 343 llok = NF90_Inquire_attribute(if90id, NF90_GLOBAL, cdatt) == nf90_noerr 344 ENDIF 345 ! 332 346 IF( llok) THEN 333 347 clinfo = 'iom_nf90_getatt, file: '//TRIM(iom_file(kiomid)%name)//', att: '//TRIM(cdatt) 334 CALL iom_nf90_check(NF90_GET_ATT(if90id, NF90_GLOBAL, cdatt, values=pvar), clinfo) 348 IF( PRESENT(pv_r0d) ) THEN 349 IF( PRESENT(cdvar) ) THEN 350 CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values=pv_r0d), clinfo) 351 ELSE 352 CALL iom_nf90_check(NF90_GET_ATT(if90id, NF90_GLOBAL, cdatt, values=pv_r0d), clinfo) 353 ENDIF 354 ELSE 355 IF( PRESENT(cdvar) ) THEN 356 CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values=pv_i0d), clinfo) 357 ELSE 358 CALL iom_nf90_check(NF90_GET_ATT(if90id, NF90_GLOBAL, cdatt, values=pv_i0d), clinfo) 359 ENDIF 360 ENDIF 335 361 ELSE 336 362 CALL ctl_warn('iom_nf90_getatt: no attribute '//cdatt//' found') 337 pvar = -999 363 IF( PRESENT(pv_r0d) ) THEN 364 pv_r0d = -999._wp 365 ELSE 366 pv_i0d = -999 367 ENDIF 338 368 ENDIF 339 369 ! 340 END SUBROUTINE iom_nf90_ intatt370 END SUBROUTINE iom_nf90_att 341 371 342 372
Note: See TracChangeset
for help on using the changeset viewer.