Changeset 1609 for LMDZ5/trunk


Ignore:
Timestamp:
Jan 19, 2012, 7:31:39 PM (13 years ago)
Author:
jghattas
Message:

Added more information while probleme in reading aerosols file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/phylmd/readaerosol.F90

    r1492 r1609  
    247247 
    248248       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) )
    250250
    251251! Test for equal longitudes and latitudes in file and model
    252252!****************************************************************************************
    253253       ! 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" )
    256256       
    257257       IF (maxval(ABS(lon_src - io_lon)) > 0.001) THEN
     
    264264
    265265       ! 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" )
    268268
    269269       ! Invert source latitudes
     
    311311! 2) Find vertical dimension klev_src
    312312!****************************************************************************************
    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" )
    314314       
    315315     ! Allocate variables depending on the number of vertical levels
     
    330330!**************************************************************************************************
    331331       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" )
    333333!       IF (nbr_tsteps /= 12 .AND. nbr_tsteps /= 14) THEN
    334334       IF (nbr_tsteps /= 12 ) THEN
     
    339339!****************************************************************************************
    340340          ! 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) )
    342342         
    343343          ! 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) )
    345345         
    346346! ++) Read surface pression, 12 month in one variable
    347347!****************************************************************************************
    348348          ! 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" )
    350350          ! 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" )
    352352         
    353353! ++) Read mass load, 12 month in one variable
    354354!****************************************************************************************
    355355          ! 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))
    357357          ! 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) )
    359359         
    360360! ++) Read ap
    361361!****************************************************************************************
    362362          ! 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" )
    364364          ! 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" )
    366366
    367367! ++) Read b
    368368!****************************************************************************************
    369369          ! 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" )
    371371          ! 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" )
    373373
    374374! ++) Read p0 : reference pressure
    375375!****************************************************************************************
    376376          ! 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" )
    378378          ! 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" )
    380380         
    381381
     
    412412             
    413413             ! 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) )
    415415             
    416416             ! 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) )
    418418             
    419419             ! Store in variable for the whole year
     
    432432! 4) Close file 
    433433!****************************************************************************************
    434        CALL check_err( nf90_close(ncid) )
     434       CALL check_err( nf90_close(ncid),"pb in close" )
    435435     
    436436
     
    570570
    571571
    572   SUBROUTINE check_err(status)
     572  SUBROUTINE check_err(status,text)
    573573    USE netcdf
    574574    IMPLICIT NONE
     
    576576    INCLUDE "iniprint.h"
    577577    INTEGER, INTENT (IN) :: status
     578    CHARACTER(len=*), INTENT (IN), OPTIONAL :: text
    578579
    579580    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
    581585       CALL abort_gcm('get_aero_fromfile',trim(nf90_strerror(status)),1)
    582586    END IF
Note: See TracChangeset for help on using the changeset viewer.