Re: ncl return value

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Oct 04 2013 - 08:42:09 MDT

Yes. Not as direct as (say) Matlab but it works ...

Please see the Mini-Language Manual: Sections 2.18 and 5.7
Click "Support" at top of NCL home page ... Manuals
http://www.ncl.ucar.edu/Document/Manuals/language_man.pdf

Also:
http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml

    function foo(...)
    begin
      :
      :
      x = .. ; type float
      y = .. ; type double
      z = .. ; type string

      return( [/ x, y, z /] ) ; return as variable of type list
    end

    ans = foo(...)

    printVarSummary(ans) ; variable of type list

    x = ans[0] ; explicitly extract each return variable
    y = ans[1] ; [..] syntax is for variable of type list
    z = ans[2]
    delete(ans)

Note: There is no need to explicitly extract the list variables.
       They could be accessed as components of 'ans'

On 10/4/13 8:06 AM, Lijun Diao wrote:
> Hi, all:
>
> Is there a way to return at least two values of NCL function.
>
> thanks,
>
> -----------------------------------------------------------------------------
> Lijun Diao
> ldiao@uh.edu
> Research Assistant
> Department of Earth & Atmospheric Sciences
> University of Houston
> 4800 Calhoun RD., Bldg. S&R1-312
> Houston, TX 77204-5007
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Oct 4 08:42:15 2013

This archive was generated by hypermail 2.1.8 : Fri Oct 04 2013 - 16:45:17 MDT