<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:10pt;color:#2672EC;background-color:#FFFFFF;font-family:Arial,Helvetica,sans-serif;">
<p>Hi All,</p>
<p><br>
</p>
<p>I'm using NCL 6.1.2 in this i'm trying to mask my data to my shapefile , in order to do so i'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'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'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);"></p>
<div><b><span style="color: rgb(255, 0, 0);">load "/usr/share/ncarg/nclscripts/csm/gsn_code.ncl"</span><br>
<span style="color: rgb(255, 0, 0);">load "/usr/share/ncarg/nclscripts/csm/gsn_csm.ncl"</span><br>
<span style="color: rgb(255, 0, 0);">load "/usr/share/ncarg/nclscripts/csm/contributed.ncl"</span><br>
<span style="color: rgb(255, 0, 0);">load "./shapefile_utils.ncl"</span><br>
<br>
<br>
<span style="color: rgb(255, 0, 0);">begin</span><br>
<span style="color: rgb(255, 0, 0);"> a = addfile("/home/amit/Research/3DIMG/Utrakhand_01JUL2016/h5/output/output/3DIMG_30JUN2016_0000_L3B_HEM_DLY_UK.nc","r")</span><br>
<span style="color: rgb(255, 0, 0);"> </span><br>
<span style="color: rgb(255, 0, 0);"> filename = "/media/amit/E/India_shapefile/Districtbound(Satmet).shp"</span><br>
<span style="color: rgb(255, 0, 0);"> var = doubletofloat(a->HEM_DLY(0,:,:))</span><br>
<span style="color: rgb(255, 0, 0);"> lat = a->latitude</span><br>
<span style="color: rgb(255, 0, 0);"> lon = a->longitude</span><br>
<br>
<span style="color: rgb(255, 0, 0);"> wks = gsn_open_wks("png","mask") ; 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 = "ExplicitLevels" </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 = (/"Snow","LightGoldenRodYellow","Yellow"\ ; 13 contour colors</span><br>
<span style="color: rgb(255, 0, 0);"> ,"Orange","Green","Green4" \</span><br>
<span style="color: rgb(255, 0, 0);"> ,"Cyan","Blue2","Blue3","Blue4"/) </span><br>
<br>
<span style="color: rgb(255, 0, 0);"> res@tiMainString = "HEM_DLY_30JUN2016 Maximum :761.31 mm"</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 = "Vertical"</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 = "Always"</span><br>
<span style="color: rgb(255, 0, 0);">res@tiXAxisString = "Longitude"</span><br>
<span style="color: rgb(255, 0, 0);">res@tiYAxisString = "Lattitude"</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 = "Original data masked by shapefile outlines"</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></span></span><b><br>
</b>
<p></p>
<p><b><br>
</b></p>
<div id="Signature"><b><span style="color: rgb(255, 0, 0);"></span></b><br>
<div id="divtagdefaultwrapper" style="font-size:10pt; color:#2672EC; background-color:#FFFFFF; font-family:Arial,Helvetica,sans-serif">
<font style="font-size:16pt" face="Arial" color="#2672EC" size="4">
<div style="min-height:1em; font-family:'Times New Roman'">Regards</div>
<div style="min-height:1em; font-family:'Times New Roman'">Amit Kumar,</div>
</font>
<div><font style="font-size:16pt" face="Arial" color="#2672EC" size="4"></font></div>
</div>
</div>
</div>
</body>
</html>