Ignore:
Timestamp:
Nov 20, 2018 10:53:14 AM (4 years ago)
Author:
eckhard
Message:

inifor: COSMO-D2 support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/UTIL/inifor/src/inifor_io.f90

    r3534 r3537  
    2626! -----------------
    2727! $Id$
     28! New routine get_netcdf_dim_vector()
     29!
     30!
     31! 3534 2018-11-19 15:35:16Z raasch
    2832! bugfix: INTENT attribute changed
    2933!
     
    173177
    174178
     179    SUBROUTINE get_netcdf_dim_vector(filename, varname, array)
     180
     181       CHARACTER(LEN=*), INTENT(IN)         ::  filename
     182       CHARACTER(LEN=*), INTENT(IN)         ::  varname
     183       REAL(dp), ALLOCATABLE, INTENT(INOUT) ::  array(:)
     184
     185       INTEGER ::  ncid, varid, dimlen
     186       INTEGER ::  dimids(NF90_MAX_VAR_DIMS)
     187
     188       IF ( nf90_open( TRIM(filename), NF90_NOWRITE, ncid ) .EQ. NF90_NOERR .AND. &
     189            nf90_inq_varid( ncid, varname, varid ) .EQ. NF90_NOERR )  THEN
     190
     191          CALL check(nf90_inquire_variable( ncid, varid, dimids = dimids ))
     192          CALL check(nf90_inquire_dimension( ncid, dimids(1), len = dimlen ))
     193
     194          ALLOCATE(array(dimlen))
     195          CALL check(nf90_get_var( ncid, varid, array ))
     196
     197       ELSE
     198
     199          message = "Failed to read '" // TRIM(varname) // &
     200             "' from file '" // TRIM(filename) // "'."
     201          CALL abort('get_netcdf_dim_vector', message)
     202
     203       END IF
     204
     205    END SUBROUTINE get_netcdf_dim_vector
     206
     207
    175208    SUBROUTINE get_input_dimensions(in_var, ncid)
    176209
     
    209242
    210243          message = "Failed reading NetCDF variable " //                       &
    211              TRIM(in_var % name) // " with " // TRIM(str(in_var%ndim)) //      &
     244             TRIM(in_var % name) // " with " // TRIM(str(in_var % ndim)) //    &
    212245             " dimensions because only two- and and three-dimensional" //      &
    213246             " variables are supported."
Note: See TracChangeset for help on using the changeset viewer.