HARPgroup / cbp_wsm

1 stars 0 forks source link

p532c Compiling Issues #2 #2

Open eahmadis opened 7 years ago

eahmadis commented 7 years ago

System: Ubuntu 16.04

I get the following errors when compiling p532c on my system:

main_summarize_temp_for_uptake_curve.f:19.23:

  data AccTempAve / (12*31)*0.0 /
                   1

Error: Syntax error in DATA statement at (1) main_summarize_temp_for_uptake_curve.f:20.25:

  data TempAveCount / (12*31)*0 /
                     1

Error: Syntax error in DATA statement at (1) f77: error: main_summarize_temp_for_uptake_curve.o: No such file or directory ############ POSTUTILS ######### readInAveann.f:14.24:

  character*(*) type  ! eos,eof,del
                    1

Error: Entity with assumed character length at (1) must be a dummy argument or a PARAMETER f77: error: readInAveann.o: No such file or directory readInAveann.f:14.24:

  character*(*) type  ! eos,eof,del
                    1

Error: Entity with assumed character length at (1) must be a dummy argument or a PARAMETER f77: error: readInAveann.o: No such file or directory readDATannual.f:19.22:

  character*(*) lu   ! land use name
                  1

Error: Entity with assumed character length at (1) must be a dummy argument or a PARAMETER readDATmonthly.f:19.22:

  character*(*) lu   ! land use name
                  1

Error: Entity with assumed character length at (1) must be a dummy argument or a PARAMETER readPSSEPaveann.f:19.22:

  character*(*) lu   ! land use name
                  1

Error: Entity with assumed character length at (1) must be a dummy argument or a PARAMETER f77: error: readPSSEPaveann.o: No such file or directory f77: error: readDATmonthly.o: No such file or directory f77: error: readDATannual.o: No such file or directory

rburghol commented 7 years ago

I think that the goal of this statement:

data AccTempAve / (12*31)*0.0 /

is to set an array with 12 rows and 31 columns, each with a default value = 0.0 - see: https://www.fortran.com/F77_std/rjcnf0001-sh-9.html

So, it seems that the ubuntu version of f77 doesn't like that syntax. I found a resource that suggests an alternative syntax for populating an array (https://web.stanford.edu/class/me200c/tutorial_77/14_data.html), and the following code compiles correctly:

*** original:
**      data AccTempAve / (12*31)*0.0 /
**      data TempAveCount / (12*31)*0 /
*** modified for ubuntu:
      data AccTempAve / 372 * 0.0 /
      data TempAveCount / 372 * 0 /

eahmadis commented 7 years ago

For the error "Entity with assumed character length at (1) must be a dummy argument or a parameter" in the few Fortran codes (.f files), I think the string length (land use name and load type) must be specified. So, instead of "character*()", we need to put the string length. Since land uses and load types have three letters, "character3" should do it. This worked for me and resolved my issue.