Error to compile netcdf-to-intermediate.f program

Topics related to running the ungrib.exe program
Post Reply
ntmanhvn181
Posts: 47
Joined: Thu Jul 04, 2019 4:07 am

Error to compile netcdf-to-intermediate.f program

Post by ntmanhvn181 » Tue Jan 12, 2021 9:47 am

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,

mgduda
Posts: 422
Joined: Mon Feb 26, 2018 7:35 pm

Re: Error to compile netcdf-to-intermediate.f program

Post by mgduda » Tue Jan 12, 2021 8:25 pm

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: Select all

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
NCAR/MMM

ntmanhvn181
Posts: 47
Joined: Thu Jul 04, 2019 4:07 am

Re: Error to compile netcdf-to-intermediate.f program

Post by ntmanhvn181 » Wed Jan 13, 2021 11:05 am

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:olen)
---------------^
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:olen)
^
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,

mgduda
Posts: 422
Joined: Mon Feb 26, 2018 7:35 pm

Re: Error to compile netcdf-to-intermediate.f program

Post by mgduda » Wed Jan 13, 2021 5:33 pm

I downloaded the netcdf-to-intermediate.f code from https://www2.mmm.ucar.edu/wrf/src/netcd ... rmediate.f and I was able to compile successfully with the following command:

Code: Select all

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: Select all

  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),
NCAR/MMM

mgduda
Posts: 422
Joined: Mon Feb 26, 2018 7:35 pm

Re: Error to compile netcdf-to-intermediate.f program

Post by mgduda » Wed Jan 13, 2021 5:35 pm

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.
NCAR/MMM

ntmanhvn181
Posts: 47
Joined: Thu Jul 04, 2019 4:07 am

Re: Error to compile netcdf-to-intermediate.f program

Post by ntmanhvn181 » Thu Jan 14, 2021 7:22 am

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,

ntmanhvn181
Posts: 47
Joined: Thu Jul 04, 2019 4:07 am

Re: Error to compile netcdf-to-intermediate.f program

Post by ntmanhvn181 » Thu Jan 14, 2021 7:45 am

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,

ntmanhvn181
Posts: 47
Joined: Thu Jul 04, 2019 4:07 am

Re: Error to compile netcdf-to-intermediate.f program

Post by ntmanhvn181 » Thu Jan 14, 2021 8:35 am

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,

mgduda
Posts: 422
Joined: Mon Feb 26, 2018 7:35 pm

Re: Error to compile netcdf-to-intermediate.f program

Post by mgduda » Fri Jan 15, 2021 5:16 pm

I just wanted to check whether you were able to get past this issue, perhaps by switching to the WPS-ghrsst-to-intermediate program as mentioned in this post?
NCAR/MMM

Post Reply

Return to “ungrib”