[ncl-talk] how to process string variable

Ming Chen chenming at ucar.edu
Tue Aug 27 09:53:49 MDT 2019


Hi Dennis,

Thanks for the answer, which solves my problem. However, I am still 
curious why the Fortran code doesn't work and how I can make it work. I 
ask this because I heavily rely on Fortran to process some in-situ 
observations, which includes both numbers and strings. I hope to 
understand more about the combination of Fortran with NCL.

Thanks again.

Ming

On 8/26/19 6:04 PM, Dennis Shea wrote:
> No need for fortran code.
>
> *https://www.ncl.ucar.edu/Document/Functions/Contributed/get1Dindex.shtml*
>
> ========================
>             ;        0             1 *2* 3            4               <==
>   cvsid = (/"76373", "76612", "*XRKF*", "PRUK", "DENB"/)
>   obsid = (/"*XRKF*", "76737", "BSRK"/)
>
>   i = *get1Dindex*(cvsid, obsid)
>   print(i)
>   print("====")
>
>   ni = num(.not.ismissing(i))
>   print("ni="+ni)
>   print("====")
> ==================================
> Variable: i
> Type: integer
> Total Size: 12 bytes
>             3 values
> Number of Dimensions: 1
> Dimensions and sizes: [3]
> Coordinates:
> Number Of Attributes: 3
>   _FillValue : -2147483647
>   index_info : Out of nWant=3 : multiple index occurrences=0
>   nMultInd : 0
>
> (0) *2*
> (1) -2147483647   <=== No match for *76737*
> (2) -2147483647   <=== No match for *BSRK*
> (0) ====
> (0) ni=*1 *<=== only one match
> (0) ====
>
> On Mon, Aug 26, 2019 at 5:30 PM Ming Chen via ncl-talk 
> <ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>> wrote:
>
>     Dear All,
>
>     I am trying to match two sets of in-situ observations. First of
>     all, I
>     need to match stations between the two sets of data. However, my
>     scrip
>     failed with the error message below:
>
>     fatal:Argument type mismatch on argument (1) of (mpr_match) can
>     not coerce
>     fatal:["Execute.c":8637]:Execute: Error occurred at or near line
>     19 in
>     file test4.ncl
>
>     I attach the sample ncl script and fortran code. Any help will be
>     highly
>     appreciated.
>
>     Ming
>
>
>     _______________________________________________
>     ncl-talk mailing list
>     ncl-talk at ucar.edu <mailto: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/20190827/d123503e/attachment.html>


More information about the ncl-talk mailing list