[ncl-talk] Argument type mismatch between NCL and fortran

Rick Brownrigg brownrig at ucar.edu
Tue Apr 19 16:05:10 MDT 2016


Hi,

I'm not certain, but I suspect the declaration for mpr be:

    real mpr(IM, JM, 24)

rather than using "dimension"?


With your use of "implicit none", I'm a bit confused as to why you aren't
getting a compile time error.

Rick


On Tue, Apr 19, 2016 at 2:30 PM, xiaoming Hu <yuanfangcan at hotmail.com>
wrote:

>  In my NCL I have
>
>      printVarSummary(mpr)
>      print(dimlc(0))
>      print(dimlc(1))
>      printVarSummary(Time_mpr)
>      EX:: get_maxind(mpr,Time_mpr, dimlc(0),dimlc(1))
>
>
> When  I run it, I got
> "fatal:Argument type mismatch on argument (0) of (get_maxind) can not
> coerce
> fatal:Execute: Error occurred at or near line 59 in file
> plot_stageIV_precip.HourlyMean_peakTime_Fortran.ncl
> "
> The type of mpr is float.
>
> In my Fortran code
>       SUBROUTINE get_maxind (mpr,Time_mpr,JM, IM)
>       implicit none
>       integer,intent(in)                  :: JM, IM
>       real,intent(in) :: mpr(IM,JM,24)
>       integer                     :: Time_mpr(IM,JM)
>       integer                   :: J, I
> !      do J = 1, JM
> !       do I=1,IM
> !           Time_mpr(j,i) = MAXLOC(mpr, 1)
>            Time_mpr = MAXLOC(mpr, 1)
> !       enddo
> !      enddo
>       RETURN
>       END SUBROUTINE get_maxind
>
> In my stub
> C NCLFORTSTART
>       SUBROUTINE get_maxind (mpr,Time_mpr,JM, IM)
>       implicit none
>       integer   JM, IM
>       dimension mpr(IM,JM, 24)
>       dimension Time_mpr(IM,JM)
> C NCLEND
>
> Could anybody tell what is wrong?
>
> Thanks
> Xiaoming
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160419/144e9ed8/attachment.html 


More information about the ncl-talk mailing list