reading in logical array from namelist

I’m using the Fortran namelist function to pass parameters into
my program, and am having problems getting it to read some
of my variables that are declared as “logical, dimension(2)”.

The variable declaration is as follows:

REAL :: MIN_WIND_HT = 750.0
REAL :: MIN_WIND_SPEED = 5.0
LOGICAL, DIMENSION(2) :: FLAG_MEANBYHT_BESTWD = (/ .FALSE., .TRUE. /), &
FLAG_MEANBYHT_ZEROWD = (/ .FALSE., .TRUE. /), &
FLAG_MEANBYHT_RAWWD = (/ .FALSE., .TRUE. /), &
FLAG_SDEVBYHT_BESTWD = (/ .FALSE., .TRUE. /), &
FLAG_SDEVBYHT_ZEROWD = (/ .FALSE., .TRUE. /), &
FLAG_SDEVBYHT_RAWWD = (/ .FALSE., .TRUE. /)

NAMELIST/STEREO_LIST/MIN_WIND_HT,MIN_WIND_SPEED, &
FLAG_MEANBYHT_BESTWD,FLAG_MEANBYHT_ZEROWD, &
FLAG_MEANBYHT_RAWWD,FLAG_SDEVBYHT_BESTWD, &
FLAG_SDEVBYHT_ZEROWD,FLAG_SDEVBYHT_RAWWD

and my parameters file looks like:

&STEREO_LIST
FLAG_MEANBYHT_BESTWD = .FALSE. .TRUE.
/

Is there a way to read in a 2-element array of logicals into my
code via a namelist?

Catherine

Hi Catherine,

It works for me. Please tell us which version of compilers, which platform, 32-bit or 64-bit? How do you compile it?

Here is a program I copied from you.

mysis% cat 1093.f
program testme
REAL :: MIN_WIND_HT = 750.0
REAL :: MIN_WIND_SPEED = 5.0
LOGICAL, DIMENSION(2)::FLAG_MEANBYHT_BESTWD=(/.FALSE.,.TRUE./)
character*8 calname
calname=‘myfile’

open(file=calname,status=“old”,form=“formatted”,unit=3)

NAMELIST/STEREO_LIST/MIN_WIND_HT,MIN_WIND_SPEED, &
FLAG_MEANBYHT_BESTWD

read(3, NML = STEREO_LIST)

print *, MIN_WIND_HT
print *, MIN_WIND_SPEED
print *, FLAG_MEANBYHT_BESTWD
end
mysis% cat myfile
&STEREO_LIST FLAG_MEANBYHT_BESTWD = .FALSE. .FALSE. /

mysis% pgf90 1093.f -Mfree
mysis% a.out
750.0000
5.000000
F F


Hongyon