[ncl-talk] how to process string variable

Ming Chen chenming at ucar.edu
Mon Aug 26 17:30:02 MDT 2019


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


-------------- next part --------------
;----------------------------------------------------------------------
; Main code
;----------------------------------------------------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;
external mpr_match "./mpr_match.so"
;
begin
  nsfc =9  
  cvsid = (/"76373", "76612", "XRKF", "PRUK", "DENB"/)
  obsid = (/"XRKF", "76737", "BSRK"/)
  ncvs = dimsizes(cvsid)
  nobs = dimsizes(obsid)
  print(ncvs)
  print(nobs)
  do i = 0, nobs-1
  mpr_match :: mpr_match(ncvs, cvsid,  obsid(i), istd)
  print (istd)
  end do
end
-------------- next part --------------
C NCLFORTSTART
      subroutine mpr_match(ncvs,cvsid,obsid,istd)
      implicit none
      integer ncvs, istd
      character*5  cvsid(5)
      character*5 obsid
C      character*5 obsid*(*)
C NCLEND
      integer  j
      ncvs=5
       do j = 1, ncvs  
         if(obsid.eq.cvsid(j)) then   
         istd = j
         endif
       enddo
      end



More information about the ncl-talk mailing list