Changeset 4389


Ignore:
Timestamp:
Jan 29, 2020 8:22:42 AM (4 years ago)
Author:
raasch
Message:

Error messages refined for reading ASCII topo file, also reading of topo file revised so that statement labels and goto statements are not required any more

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/netcdf_data_input_mod.f90

    r4388 r4389  
    2525! -----------------
    2626! $Id$
     27! Error messages refined for reading ASCII topo file, also reading of topo file revised so that
     28! statement labels and goto statements are not required any more
     29!
     30! 4388 2020-01-28 16:36:55Z raasch
    2731! bugfix for error messages while reading ASCII topo file
    2832!
     
    25092513       INTEGER(iwp) ::  ii            !< running index for IO blocks
    25102514       INTEGER(iwp) ::  id_topo       !< NetCDF id of topograhy input file
     2515       INTEGER(iwp) ::  io_status     !< status after reading the ascii topo file
    25112516       INTEGER(iwp) ::  j             !< running index along y-direction
    25122517       INTEGER(iwp) ::  num_vars      !< number of variables in netcdf input file
     
    26852690
    26862691                OPEN( 90, FILE='TOPOGRAPHY_DATA'//TRIM( coupling_char ),       &
    2687                       STATUS='OLD', FORM='FORMATTED', ERR=10 )
     2692                      STATUS='OLD', FORM='FORMATTED', IOSTAT=io_status )
     2693
     2694                IF ( io_status > 0 )  THEN
     2695                   message_string = 'file TOPOGRAPHY_DATA'//                      &
     2696                                    TRIM( coupling_char )// ' does not exist'
     2697                   CALL message( 'netcdf_data_input_mod', 'PA0208', 1, 2, 0, 6, 0 )
     2698                ENDIF
     2699
    26882700!
    26892701!--             Read topography PE-wise. Rows are read from nyn to nys, columns
     
    26992711                ALLOCATE ( buildings_f%var_2d(nys:nyn,nxl:nxr) )
    27002712                DO  j = nyn, nys, -1
    2701                    READ( 90, *, ERR=11, END=11 )                               &
     2713
     2714                   READ( 90, *, IOSTAT=io_status )                               &
    27022715                                   ( dum, i = 0, nxl-1 ),                      &
    27032716                                   ( buildings_f%var_2d(j,i), i = nxl, nxr )
     2717
     2718                   IF ( io_status > 0 )  THEN
     2719                      WRITE( message_string, '(A,1X,I5,1X,A)' ) 'error reading line', ny-j+1,      &
     2720                                                   'of file TOPOGRAPHY_DATA'//TRIM( coupling_char )
     2721                      CALL message( 'netcdf_data_input_mod', 'PA0209', 2, 2, myid, 6, 0 )
     2722                   ELSEIF ( io_status < 0 )  THEN
     2723                      WRITE( message_string, '(A,1X,I5)' ) 'end of line or file detected for '// &
     2724                                  'file TOPOGRAPHY_DATA'//TRIM( coupling_char )//' at line', ny-j+1
     2725                      CALL message( 'netcdf_data_input_mod', 'PA0704', 2, 2, myid, 6, 0 )
     2726                   ENDIF
     2727
    27042728                ENDDO
    27052729
    2706                 GOTO 12
    2707 
    2708  10             message_string = 'file TOPOGRAPHY_DATA'//                      &
    2709                                  TRIM( coupling_char )// ' does not exist'
    2710                 CALL message( 'netcdf_data_input_mod', 'PA0208', 1, 2, myid, 6, 0 )
    2711 
    2712  11             message_string = 'errors in file TOPOGRAPHY_DATA'//            &
    2713                                  TRIM( coupling_char )
    2714                 CALL message( 'netcdf_data_input_mod', 'PA0209', 2, 2, myid, 6, 0 )
    2715 
    2716  12             CLOSE( 90 )
     2730                CLOSE( 90 )
    27172731                buildings_f%from_file = .TRUE.
    27182732
Note: See TracChangeset for help on using the changeset viewer.