<div dir="ltr"><div><div>Hi Amit,<br><br></div>The way you have it written, i.e., &quot;./shapefile_utils.ncl&quot;, says that the file should be in your &quot;current directory&quot;, whatever and where ever that may be.  Is it indeed in the same directory as you are running your script from?  It needs only read-permissions by you.  <br><br></div>Rick<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 1, 2016 at 1:13 AM, Amit Kumar <span dir="ltr">&lt;<a href="mailto:amitkumar.777@hotmail.com" target="_blank">amitkumar.777@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-size:10pt;color:#2672ec;background-color:#ffffff;font-family:Arial,Helvetica,sans-serif">
<p>Hi All,</p>
<p><br>
</p>
<p>I&#39;m using NCL 6.1.2 in this i&#39;m trying to mask my data to my shapefile , in order to do so i&#39;m trying to load
<span>shapefile_utils.ncl</span> as <b><span style="color:rgb(255,0,0)">fatal:Could not open (./shapefile_utils.ncl)
<span style="color:rgb(0,111,201)"></span></span></b><span style="color:rgb(255,0,0)"><span style="color:rgb(0,111,201)">. I&#39;ve downloaded this file from ncl site but Where to keep this file and with what permissions.</span></span></p>
<p><span style="color:rgb(255,0,0)"><span style="color:rgb(0,111,201)"><br>
</span></span></p>
<p><span style="color:rgb(255,0,0)"><span style="color:rgb(0,111,201)">how to load this file in ncl as if i&#39;m not loading this file then i get the error
<span>shapefile_mask_data</span> () is undefined.</span></span></p>
<p><span style="color:rgb(255,0,0)"><span style="color:rgb(0,111,201)"><br>
</span></span></p>
<p><span style="color:rgb(255,0,0)"><span style="color:rgb(0,111,201)">I want to plot data only on my shapefile and mask rest of it.</span></span></p>
<p><span style="color:rgb(255,0,0)"><span style="color:rgb(0,111,201)"><br>
</span></span></p>
<p><span style="color:rgb(255,0,0)"><span style="color:rgb(0,111,201)">Please suggest what to do.</span></span></p>
<p><span style="color:rgb(255,0,0)"><span style="color:rgb(0,111,201)"><br>
</span></span></p>
<p><span style="color:rgb(255,0,0)"><span style="color:rgb(0,111,201)"></span></span></p>
<div><b><span style="color:rgb(255,0,0)">load &quot;/usr/share/ncarg/nclscripts/csm/gsn_code.ncl&quot;</span><br>
<span style="color:rgb(255,0,0)">load &quot;/usr/share/ncarg/nclscripts/csm/gsn_csm.ncl&quot;</span><br>
<span style="color:rgb(255,0,0)">load &quot;/usr/share/ncarg/nclscripts/csm/contributed.ncl&quot;</span><br>
<span style="color:rgb(255,0,0)">load &quot;./shapefile_utils.ncl&quot;</span><br>
<br>
<br>
<span style="color:rgb(255,0,0)">begin</span><br>
<span style="color:rgb(255,0,0)"> a                 = addfile(&quot;/home/amit/Research/3DIMG/Utrakhand_01JUL2016/h5/output/output/3DIMG_30JUN2016_0000_L3B_HEM_DLY_UK.nc&quot;,&quot;r&quot;)</span><br>
<span style="color:rgb(255,0,0)"> </span><br>
<span style="color:rgb(255,0,0)">  filename = &quot;/media/amit/E/India_shapefile/Districtbound(Satmet).shp&quot;</span><br>
<span style="color:rgb(255,0,0)">  var                 = doubletofloat(a-&gt;HEM_DLY(0,:,:))</span><br>
<span style="color:rgb(255,0,0)">  lat                 =  a-&gt;latitude</span><br>
<span style="color:rgb(255,0,0)">  lon                 =  a-&gt;longitude</span><br>
<br>
<span style="color:rgb(255,0,0)">  wks = gsn_open_wks(&quot;png&quot;,&quot;mask&quot;)                ; send graphics to PNG file</span><br>
<span style="color:rgb(255,0,0)">  res                      = True                  ; plot mods desired</span><br>
<span style="color:rgb(255,0,0)">  res@cnFillOn             = True                  ; turn on color fill</span><br>
<span style="color:rgb(255,0,0)">  res@cnLinesOn            = False</span><br>
<span style="color:rgb(255,0,0)">  res@gsnMaximize          = True     ; maximize plot in frame</span><br>
<span style="color:rgb(255,0,0)">  res@gsnDraw              = False</span><br>
<span style="color:rgb(255,0,0)">  res@gsnFrame             = False</span><br>
<span style="color:rgb(255,0,0)">  res@mpOutlineOn   = False   ; Use outlines from shapefile</span><br>
<span style="color:rgb(255,0,0)">  res@mpFillOn      = False  </span><br>
<span style="color:rgb(255,0,0)">  res@cnLevelSelectionMode = &quot;ExplicitLevels&quot;              </span><br>
<span style="color:rgb(255,0,0)">  res@cnLevels             = (/0.1,2.5,15.5,64.5,115.5,204.5,400.5,600.5,800.5/) ;   ; 13 contour values</span><br>
<span style="color:rgb(255,0,0)">  res@cnFillPalette        = (/&quot;Snow&quot;,&quot;LightGoldenRodYellow&quot;,&quot;Yellow&quot;\ ; 13 contour colors</span><br>
<span style="color:rgb(255,0,0)">                              ,&quot;Orange&quot;,&quot;Green&quot;,&quot;Green4&quot;    \</span><br>
<span style="color:rgb(255,0,0)">                              ,&quot;Cyan&quot;,&quot;Blue2&quot;,&quot;Blue3&quot;,&quot;Blue4&quot;/)       </span><br>
<br>
<span style="color:rgb(255,0,0)">  res@tiMainString      = &quot;HEM_DLY_30JUN2016 Maximum :761.31 mm&quot;</span><br>
<span style="color:rgb(255,0,0)">  res@tiMainFontHeightF = 0.016 </span><br>
<span style="color:rgb(255,0,0)">  res@gsnAddCyclic      = False</span><br>
<span style="color:rgb(255,0,0)">  res@lbOrientation   = &quot;Vertical&quot;</span><br>
<span style="color:rgb(255,0,0)">  res@sfXArray             = lon</span><br>
<span style="color:rgb(255,0,0)">  res@sfYArray        =  lat</span><br>
<span style="color:rgb(255,0,0)">  res@mpMinLonF             = 78.0</span><br>
<span style="color:rgb(255,0,0)">  res@mpMaxLonF             = 81.0</span><br>
<span style="color:rgb(255,0,0)">  res@mpMinLatF             = 29.0</span><br>
<span style="color:rgb(255,0,0)">res@mpMaxLatF             = 31.0</span><br>
<span style="color:rgb(255,0,0)">res@pmTickMarkDisplayMode     = &quot;Always&quot;</span><br>
<span style="color:rgb(255,0,0)">res@tiXAxisString            = &quot;Longitude&quot;</span><br>
<span style="color:rgb(255,0,0)">res@tiYAxisString            = &quot;Lattitude&quot;</span><br>
<span style="color:rgb(255,0,0)">res@tiXAxisFontHeightF         = 0.02</span><br>
<span style="color:rgb(255,0,0)">res@tiYAxisFontHeightF         = 0.02 </span>
<br>
<span style="color:rgb(255,0,0)">res@gsnStringFontHeightF     = 0.005  </span><br>
<span style="color:rgb(255,0,0)">plot = gsn_csm_contour_map(wks,var, res)        ; create plot</span><br>
<br>
<span style="color:rgb(255,0,0)">  opt             = True</span><br>
<span style="color:rgb(255,0,0)">  opt@return_mask = True</span><br>
<span style="color:rgb(255,0,0)">  shp_mask = shapefile_mask_data(var,filename,opt)</span><br>
<br>
<span style="color:rgb(255,0,0)">var_shp_mask = where(shp_mask.eq.1,var,var@_FillValue)</span><br>
<span style="color:rgb(255,0,0)">copy_VarMeta(var,var_shp_mask)</span><br>
<br>
<span style="color:rgb(255,0,0)">;---For shapefile plot, use the shapefile outlines.</span><br>
<span style="color:rgb(255,0,0)">  res@mpOutlineOn  = False</span><br>
<br>
<span style="color:rgb(255,0,0)">;---Create plot of original data masked by shapefile outlines</span><br>
<span style="color:rgb(255,0,0)">  res@tiMainString = &quot;Original data masked by shapefile outlines&quot;</span><br>
<span style="color:rgb(255,0,0)">  var_shp_plot = gsn_csm_contour_map(wks,var_shp_mask,res)</span><br>
<span style="color:rgb(255,0,0)">  dum = gsn_add_shapefile_polylines(wks,var_shp_plot,filename,False)</span><br>
<span style="color:rgb(255,0,0)"> draw(plot)</span><br>
<span style="color:rgb(255,0,0)"> frame(wks)</span><br>
<span style="color:rgb(255,0,0)"> end</span></b></div>
<b></b><b></b><b><br>
</b>
<p></p>
<p><b><br>
</b></p>
<div><b><span style="color:rgb(255,0,0)"></span></b><br>
<div style="font-size:10pt;color:#2672ec;background-color:#ffffff;font-family:Arial,Helvetica,sans-serif">
<font style="font-size:16pt" color="#2672EC" face="Arial" size="4">
<div style="min-height:1em;font-family:&#39;Times New Roman&#39;">Regards</div><span class="HOEnZb"><font color="#888888">
<div style="min-height:1em;font-family:&#39;Times New Roman&#39;">Amit Kumar,</div>
</font></span></font>
<div><font style="font-size:16pt" color="#2672EC" face="Arial" size="4"></font></div>
</div>
</div>
</div>
</div>

<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>