Changeset 1609 for LMDZ5/trunk
- Timestamp:
- Jan 19, 2012, 7:31:39 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/phylmd/readaerosol.F90
r1492 r1609 247 247 248 248 WRITE(lunout,*) 'reading variable ',TRIM(varname),' in file ', TRIM(fname) 249 CALL check_err( nf90_open(TRIM(fname), NF90_NOWRITE, ncid) )249 CALL check_err( nf90_open(TRIM(fname), NF90_NOWRITE, ncid), "pb open "//trim(varname) ) 250 250 251 251 ! Test for equal longitudes and latitudes in file and model 252 252 !**************************************************************************************** 253 253 ! Read and test longitudes 254 CALL check_err( nf90_inq_varid(ncid, 'lon', varid) )255 CALL check_err( nf90_get_var(ncid, varid, lon_src(:)) )254 CALL check_err( nf90_inq_varid(ncid, 'lon', varid),"pb inq lon" ) 255 CALL check_err( nf90_get_var(ncid, varid, lon_src(:)),"pb get lon" ) 256 256 257 257 IF (maxval(ABS(lon_src - io_lon)) > 0.001) THEN … … 264 264 265 265 ! Read and test latitudes 266 CALL check_err( nf90_inq_varid(ncid, 'lat', varid) )267 CALL check_err( nf90_get_var(ncid, varid, lat_src(:)) )266 CALL check_err( nf90_inq_varid(ncid, 'lat', varid),"pb inq lat" ) 267 CALL check_err( nf90_get_var(ncid, varid, lat_src(:)),"pb get lat" ) 268 268 269 269 ! Invert source latitudes … … 311 311 ! 2) Find vertical dimension klev_src 312 312 !**************************************************************************************** 313 CALL check_err( nf90_inquire_dimension(ncid, dimid, len = klev_src) )313 CALL check_err( nf90_inquire_dimension(ncid, dimid, len = klev_src),"pb inq dim for PRESNIVS or lev" ) 314 314 315 315 ! Allocate variables depending on the number of vertical levels … … 330 330 !************************************************************************************************** 331 331 ierr = nf90_inq_dimid(ncid, 'TIME',dimid) 332 CALL check_err( nf90_inquire_dimension(ncid, dimid, len = nbr_tsteps) )332 CALL check_err( nf90_inquire_dimension(ncid, dimid, len = nbr_tsteps),"pb inq dim TIME" ) 333 333 ! IF (nbr_tsteps /= 12 .AND. nbr_tsteps /= 14) THEN 334 334 IF (nbr_tsteps /= 12 ) THEN … … 339 339 !**************************************************************************************** 340 340 ! Get variable id 341 CALL check_err( nf90_inq_varid(ncid, TRIM(varname), varid) )341 CALL check_err( nf90_inq_varid(ncid, TRIM(varname), varid),"pb inq var "//TRIM(varname) ) 342 342 343 343 ! Get the variable 344 CALL check_err( nf90_get_var(ncid, varid, varyear(:,:,:,:)) )344 CALL check_err( nf90_get_var(ncid, varid, varyear(:,:,:,:)),"pb get var "//TRIM(varname) ) 345 345 346 346 ! ++) Read surface pression, 12 month in one variable 347 347 !**************************************************************************************** 348 348 ! Get variable id 349 CALL check_err( nf90_inq_varid(ncid, "ps", varid) )349 CALL check_err( nf90_inq_varid(ncid, "ps", varid),"pb inq var ps" ) 350 350 ! Get the variable 351 CALL check_err( nf90_get_var(ncid, varid, psurf_glo2D) )351 CALL check_err( nf90_get_var(ncid, varid, psurf_glo2D),"pb get var ps" ) 352 352 353 353 ! ++) Read mass load, 12 month in one variable 354 354 !**************************************************************************************** 355 355 ! Get variable id 356 CALL check_err( nf90_inq_varid(ncid, "load_"//TRIM(varname), varid) )356 CALL check_err( nf90_inq_varid(ncid, "load_"//TRIM(varname), varid) ,"pb inq var load_"//TRIM(varname)) 357 357 ! Get the variable 358 CALL check_err( nf90_get_var(ncid, varid, load_glo2D) )358 CALL check_err( nf90_get_var(ncid, varid, load_glo2D),"pb get var load_"//TRIM(varname) ) 359 359 360 360 ! ++) Read ap 361 361 !**************************************************************************************** 362 362 ! Get variable id 363 CALL check_err( nf90_inq_varid(ncid, "ap", varid) )363 CALL check_err( nf90_inq_varid(ncid, "ap", varid),"pb inq var ap" ) 364 364 ! Get the variable 365 CALL check_err( nf90_get_var(ncid, varid, pt_ap) )365 CALL check_err( nf90_get_var(ncid, varid, pt_ap),"pb get var ap" ) 366 366 367 367 ! ++) Read b 368 368 !**************************************************************************************** 369 369 ! Get variable id 370 CALL check_err( nf90_inq_varid(ncid, "b", varid) )370 CALL check_err( nf90_inq_varid(ncid, "b", varid),"pb inq var b" ) 371 371 ! Get the variable 372 CALL check_err( nf90_get_var(ncid, varid, pt_b) )372 CALL check_err( nf90_get_var(ncid, varid, pt_b),"pb get var b" ) 373 373 374 374 ! ++) Read p0 : reference pressure 375 375 !**************************************************************************************** 376 376 ! Get variable id 377 CALL check_err( nf90_inq_varid(ncid, "p0", varid) )377 CALL check_err( nf90_inq_varid(ncid, "p0", varid),"pb inq var p0" ) 378 378 ! Get the variable 379 CALL check_err( nf90_get_var(ncid, varid, p0) )379 CALL check_err( nf90_get_var(ncid, varid, p0),"pb get var p0" ) 380 380 381 381 … … 412 412 413 413 ! Get variable id 414 CALL check_err( nf90_inq_varid(ncid, TRIM(cvar), varid) )414 CALL check_err( nf90_inq_varid(ncid, TRIM(cvar), varid),"pb inq var "//TRIM(cvar) ) 415 415 416 416 ! Get the variable 417 CALL check_err( nf90_get_var(ncid, varid, varmth) )417 CALL check_err( nf90_get_var(ncid, varid, varmth),"pb get var "//TRIM(cvar) ) 418 418 419 419 ! Store in variable for the whole year … … 432 432 ! 4) Close file 433 433 !**************************************************************************************** 434 CALL check_err( nf90_close(ncid) )434 CALL check_err( nf90_close(ncid),"pb in close" ) 435 435 436 436 … … 570 570 571 571 572 SUBROUTINE check_err(status )572 SUBROUTINE check_err(status,text) 573 573 USE netcdf 574 574 IMPLICIT NONE … … 576 576 INCLUDE "iniprint.h" 577 577 INTEGER, INTENT (IN) :: status 578 CHARACTER(len=*), INTENT (IN), OPTIONAL :: text 578 579 579 580 IF (status /= NF90_NOERR) THEN 580 WRITE(lunout,*) 'Error in get_aero_fromfile ',status 581 WRITE(lunout,*) 'Error in get_aero_fromfile, netcdf error code = ',status 582 IF (PRESENT(text)) THEN 583 WRITE(lunout,*) 'Error in get_aero_fromfile : ',text 584 END IF 581 585 CALL abort_gcm('get_aero_fromfile',trim(nf90_strerror(status)),1) 582 586 END IF
Note: See TracChangeset
for help on using the changeset viewer.