<div dir="ltr"><div><div><div>Hi Xiao,<br><br></div>Where/when did you get the file shapefile_mask_data.ncl? Things may have been refactored; the shapefile examples webpage makes reference to function shapefile_mask_data in a utilities script named shapefile_utils.ncl. The version of the function in that script requires only 3 variables. It looks as though the svarname and mask_names arguments in the 5-arg version have been refactored to be parameters on the "opt" argument (make sense?) Perhaps you might want to try with shapefile_util.ncl?<br><br><a href="http://ncl.ucar.edu/Applications/shapefiles.shtml">http://ncl.ucar.edu/Applications/shapefiles.shtml</a><br><br></div>Hope that helps...<br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 6, 2016 at 1:56 PM, Zhang, Xiao <span dir="ltr"><<a href="mailto:xiao.zhang@pnnl.gov" target="_blank">xiao.zhang@pnnl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Many thanks for pointing this out! I added the delete function and the old error message disappeared! But it gave me this
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">fatal:syntax error: function shapefile_mask_data expects 5 arguments, got 3<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">fatal:error at line 623 in file fourier_analysis_HL.ncl<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">In the shapefile_mask_data.ncl, it only lists three arguments though, any idea where went wrong?
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">undef("shapefile_mask_data")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">function shapefile_mask_data(data[*][*]:numeric,sfilename[1]:string,\<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> svarname[1]:string,mask_names[*]:string,\<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> keep_opt[1]:logical)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Rick Brownrigg [mailto:<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>]
<br>
<b>Sent:</b> Wednesday, July 06, 2016 12:37 PM<br>
<b>To:</b> Zhang, Xiao<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Subject:</b> Re: [ncl-talk] error in shapefile_mask_data.ncl<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi Xiao,<br>
<br>
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:<u></u><u></u></p>
</div>
<p class="MsoNormal"> delete(lat_sub)<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> delete(lon_sub)<u></u><u></u></p>
</div>
<p class="MsoNormal">Hope that helps...<u></u><u></u></p>
</div>
<p class="MsoNormal">Rick<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Wed, Jul 6, 2016 at 12:43 PM, Zhang, Xiao <<a href="mailto:xiao.zhang@pnnl.gov" target="_blank">xiao.zhang@pnnl.gov</a>> wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Hi
<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">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! <u></u><u></u></p>
<p class="MsoNormal">“fatal:syntax error: line 158 in file ./shapefile_mask_data.ncl before or near :<u></u><u></u></p>
<p class="MsoNormal"> lat_sub :<u></u><u></u></p>
<p class="MsoNormal">------------------^<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">fatal:error in statement<u></u><u></u></p>
<p class="MsoNormal">fatal:syntax error: line 159 in file ./shapefile_mask_data.ncl before or near :<u></u><u></u></p>
<p class="MsoNormal"> lon_sub :<u></u><u></u></p>
<p class="MsoNormal">------------------^<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">fatal:error in statement<u></u><u></u></p>
<p class="MsoNormal">fatal:Syntax Error in block, block not executed”<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Here are the codes I used.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><a href="https://www.ncl.ucar.edu/Support/talk_archives/2014/att-0432/shapefile_mask_data.ncl" target="_blank">https://www.ncl.ucar.edu/Support/talk_archives/2014/att-0432/shapefile_mask_data.ncl</a><u></u><u></u></p>
<p class="MsoNormal">part of my code
<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> shpfile = "USA_adm_shp/USA_adm0.shp"<u></u><u></u></p>
<p class="MsoNormal"> opt = True<u></u><u></u></p>
<p class="MsoNormal"> opt@return_mask = True<u></u><u></u></p>
<p class="MsoNormal">
<u></u><u></u></p>
<p class="MsoNormal"> ;load self-define function<u></u><u></u></p>
<p class="MsoNormal"> load "./shapefile_mask_data.ncl"<u></u><u></u></p>
<p class="MsoNormal">
<u></u><u></u></p>
<p class="MsoNormal"> land_mask_a1 = shapefile_mask_data(dif_a1(0,:,:),shpfile,opt)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Best,<u></u><u></u></p>
<p class="MsoNormal">Xiao<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>