Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
155 Views

Fortran compiler error -An entity is not a coarray

I am getting these compiler errors and I do not think I have the hang of passing arrays whose size is not fixed yet. Can somebody help me understand the basis of these errors ?

zfilereader.f(73): error #8363: An entity is not a coarray.   [TLONS]
         tlons = modulo((olons+180.0),360.0)-180.0
---------^
zfilereader.f(73): error #8363: An entity is not a coarray.   [OLONS]
         tlons = modulo((olons+180.0),360.0)-180.0

 

This is my subroutine -

subroutine transformLongitude(lonlen,olons,tlons)
      real olons(lonlen),tlons(lonlen)
      integer i,lonlen
      do i=1,lonlen
         tlons = modulo((olons+180.0),360.0)-180.0
         end do
      return
      end

and in my main program I have these instructions -

 real lons[allocatable](:)
 real transformedLons[allocatable](:)
allocate(transformedLons(lonlen))
call transformLongitude(lonlen,lons,transformedLons)

 

0 Kudos
3 Replies
Highlighted
155 Views

You misunderstand Fortran syntax, perhaps confusing it somewhat with C.

In the subroutine you want instead:

 tlons(i) = modulo((olons(i)+180.0),360.0)-180.0

That is, parentheses instead of square brackets.

In the main program you want instead:

real, allocatable :: lons(:)
real, allocatable :: transformedLons(:)

I predict that you have other non-Fortran syntax elsewhere in your program given these two issues. Where did you get this code from or where did you see descriptions of the syntax you used?

0 Kudos
Highlighted
Beginner
155 Views

Hello Steve,

                   Blame the first one on switching between languages constantly and I apologize for that :-). But the second one 

 

lons[allocatable](:) 

does seem to work. Ifort does not seem to complain about it. This is legacy code that I had on my system and it has worked so far. I can switch it to the syntax you wrote but the above one has not failed. 

0 Kudos
Highlighted
155 Views

It's an old Microsoft extension that we continue to support. Please don't use it.

0 Kudos