[ncl-talk] error in shapefile_mask_data.ncl

Zhang, Xiao xiao.zhang at pnnl.gov
Wed Jul 6 13:56:45 MDT 2016


Many thanks for pointing this out! I added the delete function and the old error message disappeared! But it gave me this

fatal:syntax error: function shapefile_mask_data expects 5 arguments, got 3
fatal:error at line 623 in file fourier_analysis_HL.ncl

In the shapefile_mask_data.ncl, it only lists three arguments though, any idea where went wrong?

undef("shapefile_mask_data")
function shapefile_mask_data(data[*][*]:numeric,sfilename[1]:string,\
                             svarname[1]:string,mask_names[*]:string,\
                             keep_opt[1]:logical)

From: Rick Brownrigg [mailto:brownrig at ucar.edu]
Sent: Wednesday, July 06, 2016 12:37 PM
To: Zhang, Xiao
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] error in shapefile_mask_data.ncl

Hi Xiao,

Its complaining about the reassignment operator  :=    I don't recall exactly when it was introduced in NCL, but it was relatively recently, and I strongly suspect it was after ver. 6.1.0.  You can work around it by adding these lines at the end of the inner do-loop in that section of code3:
  delete(lat_sub)
  delete(lon_sub)
Hope that helps...
Rick

On Wed, Jul 6, 2016 at 12:43 PM, Zhang, Xiao <xiao.zhang at pnnl.gov<mailto:xiao.zhang at pnnl.gov>> wrote:

Hi

I use ncl 6.1.0 and would like to use function shapefile_mask_data. Since it has not been built in, I use the code provided from the website but got error message. Could you please help with this? Thank you!
“fatal:syntax error: line 158 in file ./shapefile_mask_data.ncl before or near :
          lat_sub :
------------------^

fatal:error in statement
fatal:syntax error: line 159 in file ./shapefile_mask_data.ncl before or near :
          lon_sub :
------------------^

fatal:error in statement
fatal:Syntax Error in block, block not executed”

Here are the codes I used.

https://www.ncl.ucar.edu/Support/talk_archives/2014/att-0432/shapefile_mask_data.ncl
part of my code

                shpfile   = "USA_adm_shp/USA_adm0.shp"
                opt             = True
                opt at return_mask = True

                 ;load self-define function
                load "./shapefile_mask_data.ncl"

                 land_mask_a1 = shapefile_mask_data(dif_a1(0,:,:),shpfile,opt)

Best,
Xiao


_______________________________________________
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/20160706/60e851bf/attachment.html 


More information about the ncl-talk mailing list