Ignore:
Timestamp:
Nov 18, 2010, 1:01:24 PM (14 years ago)
Author:
Laurent Fairhead
Message:

Merge of LMDZ5V1.0-dev branch r1453 into LMDZ5 trunk r1434


Fusion entre la version r1453 de la branche de développement LMDZ5V1.0-dev
et le tronc LMDZ5 (r1434)

Location:
LMDZ5/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk

  • LMDZ5/trunk/libf/phylmd/read_map2D.F90

    r1279 r1454  
    1111
    1212! Input arguments
    13   CHARACTER(len=20), INTENT(IN) :: filename     ! name of file to read
    14   CHARACTER(len=20), INTENT(IN) :: varname      ! name of variable in file
     13  CHARACTER(len=*), INTENT(IN) :: filename     ! name of file to read
     14  CHARACTER(len=*), INTENT(IN) :: varname      ! name of variable in file
    1515  INTEGER, INTENT(IN)           :: timestep     ! actual timestep
    1616  LOGICAL, INTENT(IN)           :: inverse      ! TRUE if latitude needs to be inversed
     
    2727  REAL, DIMENSION(nbp_lon,nbp_lat) :: var_glo2D_tmp ! 2D global
    2828  REAL, DIMENSION(klon_glo)        :: var_glo1D     ! 1D global
    29 
     29  INCLUDE "iniprint.h"
    3030
    3131! Read variable from file. Done by master process MPI and master thread OpenMP
    3232  IF (is_mpi_root .AND. is_omp_root) THEN
    33      ierr = NF90_OPEN (filename, NF90_NOWRITE, nid)
    34      IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Problem in opening file '//filename,1)
     33     ierr = NF90_OPEN(trim(filename), NF90_NOWRITE, nid)
     34     IF (ierr /= NF90_NOERR) CALL write_err_mess('Problem in opening file')
    3535
    36      ierr = NF90_INQ_VARID(nid, varname, nvarid)
    37      IF (ierr /= NF90_NOERR) CALL abort_gcm(modname, 'The variable '//varname//' is absent in file',1)
     36     ierr = NF90_INQ_VARID(nid, trim(varname), nvarid)
     37     IF (ierr /= NF90_NOERR) CALL write_err_mess('The variable is absent in file')
    3838     
    3939     start=(/1,1,timestep/)
    4040     count=(/nbp_lon,nbp_lat,1/)
    4141     ierr = NF90_GET_VAR(nid, nvarid, var_glo2D,start,count)
    42      IF (ierr /= NF90_NOERR) CALL abort_gcm(modname, 'Problem in reading varaiable '//varname,1)
     42     IF (ierr /= NF90_NOERR) CALL write_err_mess('Problem in reading varaiable')
     43
     44     ierr = NF90_CLOSE(nid)
     45     IF (ierr /= NF90_NOERR) CALL write_err_mess('Problem in closing file')
    4346
    4447     ! Inverse latitude order
     
    5356     CALL grid2Dto1D_glo(var_glo2D,var_glo1D)
    5457
     58     WRITE(lunout,*) 'in read_map2D, filename = ', trim(filename)
     59     WRITE(lunout,*) 'in read_map2D, varname  = ', trim(varname)
     60     WRITE(lunout,*) 'in read_map2D, timestep = ', timestep
    5561  ENDIF
    5662
     
    5864  CALL scatter(var_glo1D, varout)
    5965
     66  CONTAINS
     67    SUBROUTINE write_err_mess(err_mess)
     68
     69      CHARACTER(len=*), INTENT(IN) :: err_mess
     70      INCLUDE "iniprint.h"
     71     
     72      WRITE(lunout,*) 'Error in read_map2D, filename = ', trim(filename)
     73      WRITE(lunout,*) 'Error in read_map2D, varname  = ', trim(varname)
     74      WRITE(lunout,*) 'Error in read_map2D, timestep = ', timestep
     75
     76      CALL abort_gcm(modname, err_mess, 1)
     77
     78    END SUBROUTINE write_err_mess
     79
    6080END SUBROUTINE read_map2D
Note: See TracChangeset for help on using the changeset viewer.