I am trying to build a meteorological model in a Linux cluster (Ubuntu 12.04) using Intel fortran compiler version 14.0.1. But when trying to compile fdgrib2 module I get this warning message:
/opt/intel/bin/ifort -c -I. /usr/local/rams60/src/pre/fdgrib2/grib_get.f90
/usr/local/rams60/src/pre/fdgrib2/grib_get.f90(209): warning #8042: This argument must be of type character of length 1. [TOKENS]
print*,'5--'//trim(tokens(1)), len_trim(tokens(1)),ichar(tokens(1))
------------------------------------------------------------^
ar rs fdgrib2.a grib_get.o
rm -f grib_get.o
tokens declaration
character(len=20) :: tokens(100)
Despite this warning the fdgrib2 executable is built but when trying to run stops with another error message:
/usr/local/rams60/build/fdgrib2$ ./fdgrib2 -f DGRIB_IN2
num args: 2
---------------------------------------------------------------
GRIB to GDF converter
---------------------------------------------------------------
Namelist file name: DGRIB_IN2
GRIB file name : ./gfs.t00z.pgrbf06.grib2
WGRIB exec :
Assumimg GRIB 2 : /usr/local/grib2/wgrib2/wgrib2
Data date/time : 99999999
Forecast hour : 99999999
3D variables: UGRD VGRD TMP HGT RH
2D variables:
forrtl: severe (59): list-directed I/O syntax error, unit -5, file Internal List-Directed Read
Image PC Routine Line Source
fdgrib2 08076240 Unknown Unknown Unknown
fdgrib2 08074C94 Unknown Unknown Unknown
fdgrib2 08057847 Unknown Unknown Unknown
fdgrib2 0804BFA2 Unknown Unknown Unknown
fdgrib2 0804A827 Unknown Unknown Unknown
libc.so.6 B72E94D3 Unknown Unknown Unknown
fdgrib2 process finishes at commands on grib_get.f90
[fortran] call tokenize_ws(lines(1),tokens,ntok)
nb = index(tokens(1),'=')+1
ne = len_trim(tokens(1))
read(tokens(1)(nb:ne),*) longdate [/fortran]
I am not an expert fortran programmer so I am not sure how to deal with this. Any help would be greatly appreciated.
Thanks in advance
EDIT 1
Added print statement to locate when the error comes up
call tokenize_ws(lines(1),tokens,ntok)
nb = index(tokens(1),'=')+1
ne = len_trim(tokens(1))
print*,'P3'
print *,lines(1)
print *,tokens(1)
print *,tokens(1)(nb:ne)
read(tokens(1)(nb:ne),*) longdate
print*,'P4'
and the output (pass through P3 but does not arrive to P4). 2014012000 is the right date and time of the input data file
P3
1.1:0:d=2014012000
1.1:0:d=2014012000
2014012000
forrtl: severe (59): list-directed I/O syntax error, unit -5, file Internal List-Directed Read
Image PC Routine Line Source
fdgrib2 080761C0 Unknown Unknown Unknown
EDIT 2
Code of subroutine tokenize_ws in tokenize.f90
subroutine tokenize_ws(str,tokens,ntok)
implicit none
integer :: ntok
character(len=*) :: str,tokens(*)
character(len=1) :: sep,tab
integer :: ntokmax=100,npt,nch,nc,ntbeg,ntend,n
! this routine "parses" character string str into different pieces
! or tokens by looking for possible token separators (toks
! str contains nch characters. the number of tokens identified is nto
! the character string tokens are stored in tokens.
! Modified 12/11/07: this version tokenizes by white space (spaces and tabs)
sep = char(32)
tab = char(9)
ntok=0
npt=1
nch=len_trim(str)
nc=1
do ntok=1,ntokmax
do n=nc,nch
if(str(n:n) /= sep .and. str(n:n) /= tab) then
ntbeg=n
goto 21
endif
enddo
21 continue
do n=ntbeg,nch
if(str(n:n) == sep .or. str(n:n) == tab) then
ntend=n-1
goto 22
endif
if(n == nch) then
ntend=n
goto 22
endif
enddo
22 continue
tokens(ntok)=str(ntbeg:ntend)
nc=ntend+1
if(nc.ge.nch) goto 25
enddo
25 continue
return
end
EDIT 3
Added source code and input files (linux tar files)
http://ubuntuone.com/5tL2IO8OV5dBxhs18kt1WI
http://ubuntuone.com/1meYXbBuBt1Rxcx4ODMzVp
EDIT 4
Output of compile options -traceback -warn -check
log file
and output of model run
2014012000
9 19 forrtl: severe (59): list-directed I/O syntax error, unit -5, file Internal List-Directed Read Image PC
Routine Line Source fdgrib2
080942C0 Unknown Unknown Unknown fdgrib2
08092D14 Unknown Unknown Unknown fdgrib2
0806F822 grib_get_mod_mp_g 291 grib_get.f90 fdgrib2
08051CD0 MAIN__ 130 dgrib.f90 fdgrib2
0804A757 Unknown Unknown Unknown libc.so.6
B72CF4D3 Unknown Unknown Unknown
EDIT 5
After changing read(tokens(1)(nb:ne),*) longdate
(chars 9 to 19) to read(tokens(1)(nb:ne-1),*) (chars 9 to 18) longdate
it seems to properly read longdate, expected value was 2014012000. But then another error appears, as I post this info I'll continue looking for a solution. fdgrib2 is a "relatively old" read code for grib2 files but it worked and should still work, my fault. Thanks for your help.
print*,'P3'
print *,lines(1)
print *,tokens(1)
print *,tokens(1)(nb:ne)
print *,nb,ne
read(tokens(1)(nb:ne-1),*) longdate
print*,'P4'
print*,'ddd:', longdate
P3
1.1:0:d=2014012000
1.1:0:d=2014012000
2014012000
9 19
P4
ddd: 2014012000
1--1.1:0:scan=0 input=WE:NS output=WE:SN:grid_template=0:winds(N/S):
--
ppp0: 0 360 181 lat-lon
ppp0: 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00
forrtl: severe (59): list-directed I/O syntax error, unit -5, file Internal List-Directed Read
Image PC Routine Line Source
fdgrib2 08094350 Unknown Unknown Unknown
fdgrib2 08092DA4 Unknown Unknown Unknown
fdgrib2 0806D724 grib_get_mod_mp_g 219 grib_get.f90
fdgrib2 08051D20 MAIN__ 132 dgrib.f90
fdgrib2 0804A757 Unknown Unknown Unknown
libc.so.6 B72984D3 Unknown Unknown Unknown