Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Error to compile netcdf-to-intermediate.f program

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

Hi everyone,
I have a problem when compiling the netcdf-to-intermediate.f program which is presented in the below:
[cloud@igplogin WPS]$ ifort netcdf-to-intermediate.f -L/work/apps/intel_2016/netcdf/4.3.3.1/lib -lnetcdf -lm -I/work/apps/intel_2016/netcdf/4.3.3.1/include -o netCDF-to-intermediate
netcdf-to-intermediate.f(46): error #5149: Illegal character in statement label field [p]
program netCDF2intermediate
--^
netcdf-to-intermediate.f(46): error #5149: Illegal character in statement label field [r]
program netCDF2intermediate
---^
netcdf-to-intermediate.f(46): error #5149: Illegal character in statement label field [o]
program netCDF2intermediate
----^
netcdf-to-intermediate.f(46): error #5118: First statement in file must not be continued
program netCDF2intermediate
-----^
netcdf-to-intermediate.f(48): error #5149: Illegal character in statement label field
implicit none
--^
netcdf-to-intermediate.f(48): error #5149: Illegal character in statement label field [m]
implicit none
---^
netcdf-to-intermediate.f(48): error #5149: Illegal character in statement label field [p]
implicit none
----^
netcdf-to-intermediate.f(49): error #5149: Illegal character in statement label field [c]
character (len=80) :: input_file
--^
netcdf-to-intermediate.f(49): error #5149: Illegal character in statement label field [h]
character (len=80) :: input_file
---^
netcdf-to-intermediate.f(49): error #5149: Illegal character in statement label field [a]
character (len=80) :: input_file
----^
netcdf-to-intermediate.f(52): error #5149: Illegal character in statement label field [c]
call read_args(input_file)
--^
netcdf-to-intermediate.f(52): error #5149: Illegal character in statement label field [a]
call read_args(input_file)
---^
netcdf-to-intermediate.f(52): error #5149: Illegal character in statement label field [l]
call read_args(input_file)
----^
netcdf-to-intermediate.f(53): error #5149: Illegal character in statement label field [p]
print*,"INPUT FILES ARE: ",trim(input_file)
--^
netcdf-to-intermediate.f(53): error #5149: Illegal character in statement label field [r]
print*,"INPUT FILES ARE: ",trim(input_file)
---^
netcdf-to-intermediate.f(53): error #5149: Illegal character in statement label field
print*,"INPUT FILES ARE: ",trim(input_file)
----^
netcdf-to-intermediate.f(54): error #5149: Illegal character in statement label field [p]
print*," "
--^
netcdf-to-intermediate.f(54): error #5149: Illegal character in statement label field [r]
print*," "
---^
netcdf-to-intermediate.f(54): error #5149: Illegal character in statement label field
print*," "
----^
netcdf-to-intermediate.f(57): error #5149: Illegal character in statement label field [c]
call driver (input_file)
--^
netcdf-to-intermediate.f(57): error #5149: Illegal character in statement label field [a]
call driver (input_file)
---^
netcdf-to-intermediate.f(57): error #5149: Illegal character in statement label field [l]
call driver (input_file)
----^
netcdf-to-intermediate.f(60): error #5149: Illegal character in statement label field [e]
end program netCDF2intermediate
--^
netcdf-to-intermediate.f(60): error #5149: Illegal character in statement label field [n]
end program netCDF2intermediate
---^
netcdf-to-intermediate.f(60): error #5149: Illegal character in statement label field [d]
end program netCDF2intermediate
----^
netcdf-to-intermediate.f(49): error #5082: Syntax error, found '=' when expecting one of: :: ) ( , : * <END-OF-STATEMENT> ; . % (/ + - [ ] /) . ** > ...
character (len=80) :: input_file
----------------^
netcdf-to-intermediate.f(53): error #5082: Syntax error, found IDENTIFIER 'T' when expecting one of: :: ) ( , : * <END-OF-STATEMENT> ; . % (/ + - [ ] /) . = ' ** > ...
print*,"INPUT FILES ARE: ",trim(input_file)
------^
netcdf-to-intermediate.f(54): error #5082: Syntax error, found IDENTIFIER 'T' when expecting one of: :: ) ( , : * <END-OF-STATEMENT> ; . % (/ + - [ ] /) . = ' ** > ...
print*," "
------^
netcdf-to-intermediate.f(57): error #5082: Syntax error, found IDENTIFIER 'DRIVER' when expecting one of: :: ) ( , : * <END-OF-STATEMENT> ; . (/ + - ] /) ' ** > PRIVATE / ...
call driver (input_file)
-------^
netcdf-to-intermediate.f(57): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ) ,
call driver (input_file)
--------------------------^
netcdf-to-intermediate.f(61): catastrophic error: Too many errors, exiting
compilation aborted for netcdf-to-intermediate.f (code 1)

Please help me to solve this problem.
Thank you very much!
Bests,
Manh,
 
Athough I've never used the netcdf-to-intermediate.f code, the error messages you're getting suggest that the program may be written in free-format Fortran. In this case, I think you may need to add the "-free" compiler flag (for the Intel Fortran compiler):
Code:
ifort -free netcdf-to-intermediate.f -L/work/apps/intel_2016/netcdf/4.3.3.1/lib -lnetcdf -lm -I/work/apps/intel_2016/netcdf/4.3.3.1/include -o netCDF-to-intermediate
 
Hi mgduda,
Following your suggestion, I've changed my command. However, it still wrong, and the error is presented in the below:
[cloud@igplogin WPS]$ ifort -free netcdf-to-intermediate.f -L/work/apps/intel_2016/netcdf/4.3.3.1/lib -lnetcdf -lm -I/work/apps/intel_2016/netcdf/4.3.3.1/include -o netCDF-to-intermediate
netcdf-to-intermediate.f(108): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: %FILL <IDENTIFIER>
integer :: is_sst(4), ie_sst(4),
-----------------------------------------------------------------^
netcdf-to-intermediate.f(144): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: :: ) ( , : * <IDENTIFIER> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT> ...
rcode = nf_inq_var( cdfid, id_var, varnam, ivtype, nDims, dimids,
--------------------------------------------------------------------^
netcdf-to-intermediate.f(145): error #5276: Unbalanced parentheses
nAtts )
------^
netcdf-to-intermediate.f(171): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: :: ) ( , : * <IDENTIFIER> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT> ...
rcode = nf_inq_var( cdfid, id_var, varnam, ivtype, nDims, dimids,
--------------------------------------------------------------------^
netcdf-to-intermediate.f(172): error #5276: Unbalanced parentheses
nAtts )
------^
netcdf-to-intermediate.f(705): error #5082: Syntax error, found ',' when expecting one of: ( % . = =>
newdate(1:nlen), olddate(1:eek:len)
---------------^
netcdf-to-intermediate.f(705): error #6780: A dummy argument with the INTENT(IN) attribute shall not be defined nor become undefined. [NEWDATE]
newdate(1:nlen), olddate(1:eek:len)
^
netcdf-to-intermediate.f(1038): error #5082: Syntax error, found '.' when expecting one of: <LABEL> <END-OF-STATEMENT> ; <IDENTIFIER> TYPE MODULE ELEMENTAL IMPURE NON_RECURSIVE ...
...
^
netcdf-to-intermediate.f(1041): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: <IDENTIFIER> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT>
days.
-----^
netcdf-to-intermediate.f(1056): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( <IDENTIFIER> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT> <INTEGER_CONSTANT> ...
integer, dimension(12), parameter :: ndays = (/ 31, 28, 31, 30, 31,
-----------------------------------------------------------------------^
netcdf-to-intermediate.f(1057): error #5082: Syntax error, found ',' when expecting one of: <IDENTIFIER> TYPE MODULE ELEMENTAL IMPURE NON_RECURSIVE PURE RECURSIVE FUNCTION ...
30, 31, 31, 30, 31, 30, 31 /)
--^
netcdf-to-intermediate.f(1057): error #5082: Syntax error, found '/)' when expecting one of: , <END-OF-STATEMENT> ;
30, 31, 31, 30, 31, 30, 31 /)
---------------------------^
netcdf-to-intermediate.f(1057): error #6052: This label has not been defined as a FORMAT label. [31]
30, 31, 31, 30, 31, 30, 31 /)
----^
compilation aborted for netcdf-to-intermediate.f (code 1)
Please help me to solve it or if you have another way to create the intermediate file to run update SST data, please let me know.
Thank you in advance.
Bests,
 
I downloaded the netcdf-to-intermediate.f code from https://www2.mmm.ucar.edu/wrf/src/netcdf-to-intermediate.f and I was able to compile successfully with the following command:
Code:
ifort -free netcdf-to-intermediate.f -L${NETCDF}/lib -lnetcdff -lnetcdf -lm -I${NETCDF}/include -o netCDF-to-intermediate

The first of your error messages,
netcdf-to-intermediate.f(108): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: %FILL <IDENTIFIER>
integer :: is_sst(4), ie_sst(4),
-----------------------------------------------------------------^
suggests an error on line 108; however, in my version of the file, the code leading up to line 108 looks like the following (the line numbers in the first columns are not actually in my file -- they just to help to identify specific lines in our discussion here):
Code:
  92   real,    allocatable, dimension(:,:) :: sst
  93   real,    allocatable, dimension(:,:) :: land_sea
  94   integer*2, allocatable, dimension(:,:,:,:) :: sst_int
  95   real,  allocatable, dimension(:)       :: time_d
  96   integer,  allocatable, dimension(:)    :: time
  97   integer, allocatable, dimension(:)     :: date
  98   integer                                :: is_sst(4), ie_sst(4), time_dim
  99   integer                                :: is_date(3), ie_date(3)
 100 
 101   integer                                :: tmp, iy, im, id, ih
 102   character (len=24)                     :: filename
 103   character (len=24)                     :: hdate
 104   integer                                :: time_periods
 105 
 106   character(len=9)                       :: field
 107   character(len=25)                      :: units
 108   character(len=46)                      :: Desc
 109   real                                   :: xfcst

Is it possible that the netcdf-to-intermediate.f file that you've downloaded has been corrupted somehow -- perhaps erroneous newline characters have been inserted? Note that in your first error message, what apparently corresponds to my line 98 has been truncated:
integer :: is_sst(4), ie_sst(4),
 
Also, which source of SST data in netCDF format would you like to use? It may be that we could find some alternative to the netcdf-to-intermediate.f code for converting the netCDF SST data to intermediate format.
 
Hi mgduda,
I tried to use the WPS-ghrsst-to-intermediate to convert the SST.nc files to the intermediate and it run with my case.
Thank you for your help.
Bests,
Manh,
 
Hi mgduda,
I finally found my error is my download process. I copied the detail of the netcdf-to-intermediate.f program and pasted it to my system, so my compilation is failed.
I download directly it from your link and transferred it to my system and it worked.
Thank you very much!
Bests,
manh,
 
Hi mgduda,
I have a problem when running this program. I use the oisst.v2.highres data from NOAA (ftp://ftp.cdc.noaa.gov/Datasets/noaa.oisst.v2.highres/) for the input data, however it displayed that:
[cloud@igplogin WPS]$ ./netCDF-to-intermediate sst_data/sst.day.mean.2014.nc
INPUT FILES ARE: sst_data/sst.day.mean.2014.nc


DIMS for TIME is 365
START Time 0
AND THIS IS : 1978-01-01_00:00:00.0000
DIMS for SST is 1440 720 365
Can you have any suggestions for me?
Thank you!
Bests,
manh,
 
Top