<div dir="ltr"><div class="gmail_default" style="font-size:small">Muhammad,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It looks like you are trying to use a rectilinear lat/lon grid for masking rather than the original lat/lon data associated with your "T2" variable.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If your file is indeed a WRF output file, then you should use the XLAT/XLONG variables on the file, rather than trying to create your own lat/lon arrays.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Your code would look something like this:</div><div class="gmail_default" style="font-size:small"><br></div><font face="monospace, monospace"> nt = 0<br> data <div class="gmail_default" style="font-size:small;display:inline"> </div>= wrf_user_getvar(a, "T2", <div class="gmail_default" style="font-size:small;display:inline"> </div>nt)<br> data@lat2d = wrf_user_getvar(a, "lat", nt)<br> data@lon2d = wrf_user_getvar(a,<div class="gmail_default" style="font-size:small;display:inline"> </div>"lon",<div class="gmail_default" style="font-size:small;display:inline"> </div>nt)<br> data@_FillValue = -9999<br><br> opt = True<br> opt@debug = True<br> data_mask = shapefile_mask_data(data,"Shapefile/malay.shp",opt)</font><div><span style="font-family:monospace,monospace"><br></span></div><br>For an example that masks a WRF output file, see example shapefile_14_mask.ncl<div class="gmail_default" style="font-size:small;display:inline"> </div>at:<br><br><a href="http://www.ncl.ucar.edu/Applications/shapefiles.shtml#ex14">http://www.ncl.ucar.edu/Applications/shapefiles.shtml#ex14</a><br><br>Note that this example is specifying "Ohio" as the specific area in the shapefile to mask against, but if you simply want to use the whole shapefile, then you do not need to set "shape_var" or "shape_names" as this script is doing.<br><br>--Mary</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 7, 2017 at 6:48 AM, Muhammad Omer Mughal <span dir="ltr"><<a href="mailto:m.mughal1@postgrad.curtin.edu.au" target="_blank">m.mughal1@postgrad.curtin.edu.au</a>></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 id="m_2210573968912012062divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hi </p>
<p>I am using a WRF output file and I did the following changes "ONLY" to the code[ <a href="https://www.ncl.ucar.edu/Applications/Scripts/mask_9.ncl" class="m_2210573968912012062OWAAutoLink" id="m_2210573968912012062LPlnk10021" target="_blank">https://www.ncl.ucar.<wbr>edu/Applications/Scripts/mask_<wbr>9.ncl</a>]
. I want to mask the temperature in Malaysia using the shape file malay.shp. Can you kindly tell me what else do I need to change as currently I am not able to see the data masked within Malaysia. I will be grateful for your help</p>
<p><br>
</p>
<p></p>
<div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/wrf/WRFUserARW.ncl"</div>
<div><br>
</div>
<div>begin</div>
<div> MASK_INSIDE = True</div>
<div><br>
</div>
<div> a = addfile("./UTC_0.nc","r")</div>
<div> lat=a->XLAT</div>
<div> lon=a->XLONG</div>
<div><br>
</div>
<div> minlat=min(lat)</div>
<div> maxlat=max(lat)</div>
<div> minlon=min(lon)</div>
<div> maxlon=max(lon)</div>
<div><br>
</div>
<div> nlat=129</div>
<div> nlon=210</div>
<div><br>
</div>
<div> lat1d = fspan(minlat,maxlat,nlat)</div>
<div> lon1d = fspan(minlon,maxlon,nlon)</div>
<div><br>
</div>
<div> data = wrf_user_getvar(a, "T2", 0)</div>
<div> data@_FillValue = -9999</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div> lat1d = fspan(minlat,maxlat,nlat)</div>
<div> lon1d = fspan(minlon,maxlon,nlon)</div>
<div> lat1d@units = "degrees_north"</div>
<div> lon1d@units = "degrees_east"</div>
<div><br>
</div>
<div>;---Attach lat/lon coordinate array information.</div>
<div> data!0 = "lat"</div>
<div> data!1 = "lon"</div>
<div> data&lat = lat1d</div>
<div> data&lon = lon1d</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div> f = addfile("Shapefile/malay.shp", "r")</div>
<div> mrb_lon = f->x</div>
<div> mrb_lat = f->y</div>
<div> nmrb = dimsizes(mrb_lon)</div>
<div><br>
</div>
<div> min_mrb_lat = min(mrb_lat)</div>
<div> max_mrb_lat = max(mrb_lat)</div>
<div> min_mrb_lon = min(mrb_lon)</div>
<div> max_mrb_lon = max(mrb_lon)</div>
<div><br>
</div>
<br>
<div id="m_2210573968912012062LPBorder_GT_15100624072320.4654525021329883" style="margin-bottom:20px;overflow:auto;width:100%;text-indent:0px">
<table id="m_2210573968912012062LPContainer_15100624072320.455548342248405" cellspacing="0" style="width:90%;background-color:rgb(255,255,255);overflow:auto;padding-top:20px;padding-bottom:20px;margin-top:20px;border-top:1px dotted rgb(200,200,200);border-bottom:1px dotted rgb(200,200,200)">
<tbody>
<tr valign="top" style="border-spacing:0px">
<td id="m_2210573968912012062TextCell_15100624072320.004663611720125083" colspan="2" style="vertical-align:top;padding:0px;display:table-cell">
<div id="m_2210573968912012062LPRemovePreviewContainer_15100624072320.09492557243074029"></div>
<div id="m_2210573968912012062LPTitle_15100624072320.6738010005615629" style="color:rgb(0,120,215);font-weight:normal;font-size:21px;font-family:wf_segoe-ui_light,"Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;line-height:21px">
<a id="m_2210573968912012062LPUrlAnchor_15100624072320.30956730877959604" href="https://www.ncl.ucar.edu/Applications/Scripts/mask_9.ncl" style="text-decoration:none" target="_blank">www.ncl.ucar.edu</a></div>
<div id="m_2210573968912012062LPMetadata_15100624072320.13720756935637524" style="margin:10px 0px 16px;color:rgb(102,102,102);font-weight:normal;font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:14px">
<a href="http://www.ncl.ucar.edu" target="_blank">www.ncl.ucar.edu</a></div>
<div id="m_2210573968912012062LPDescription_15100624072320.9176144495555989" style="display:block;color:rgb(102,102,102);font-weight:normal;font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:20px;max-height:100px;overflow:hidden">
;***** ; mask_9.ncl ; ; Concepts illustrated: ; - Drawing the Mississippi River Basin using data from a shapefile ; - Masking a data array based on a geographical ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
<p></p>
<div id="m_2210573968912012062LPBorder_GT_15100622944160.7494298591980548" style="margin-bottom:20px;overflow:auto;width:100%;text-indent:0px">
<table id="m_2210573968912012062LPContainer_15100622944120.9651541887180664" cellspacing="0" style="width:90%;background-color:rgb(255,255,255);overflow:auto;padding-top:20px;padding-bottom:20px;margin-top:20px;border-top:1px dotted rgb(200,200,200);border-bottom:1px dotted rgb(200,200,200)">
<tbody>
<tr valign="top" style="border-spacing:0px">
<td id="m_2210573968912012062TextCell_15100622944160.8505426783719574" colspan="2" style="vertical-align:top;padding:0px;display:table-cell">
<div id="m_2210573968912012062LPRemovePreviewContainer_15100622944160.6665396278302771"></div>
<div id="m_2210573968912012062LPTitle_15100622944160.9140645359738073" style="color:rgb(0,120,215);font-weight:normal;font-size:21px;font-family:wf_segoe-ui_light,"Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;line-height:21px">
<a id="m_2210573968912012062LPUrlAnchor_15100622944160.1858341607238565" href="https://www.ncl.ucar.edu/Applications/Scripts/mask_9.ncl" style="text-decoration:none" target="_blank">www.ncl.ucar.edu</a></div>
<div id="m_2210573968912012062LPMetadata_15100622944160.5647315790547298" style="margin:10px 0px 16px;color:rgb(102,102,102);font-weight:normal;font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:14px">
<a href="http://www.ncl.ucar.edu" target="_blank">www.ncl.ucar.edu</a></div>
<div id="m_2210573968912012062LPDescription_15100622944160.39649117012257995" style="display:block;color:rgb(102,102,102);font-weight:normal;font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:20px;max-height:100px;overflow:hidden">
;***** ; mask_9.ncl ; ; Concepts illustrated: ; - Drawing the Mississippi River Basin using data from a shapefile ; - Masking a data array based on a geographical ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<p><br>
</p>
<div id="m_2210573968912012062Signature">
<div id="m_2210573968912012062divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px"><b><br>
</b></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:11pt">Muhammad Omer Mughal</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:11pt">MSc BSc Mechanical Engineering</span></font><font face="Arial,sans-serif" size="1" color="#1F497D"><span style="font-size:8pt"><br>
</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">PhD Research Scholar</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Remote Sensing and Satellite Research Group</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Department of Imaging and Applied Physics</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt"><br>
Curtin University</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt"><br>
</span></font><font face="Calibri,sans-serif" size="2" color="#1F497D"><span style="font-size:11pt"><br>
</span></font><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:9pt">Curtin University</span></font><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:9pt"><br>
</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Tel |</span></font><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt">+61
8 9266 7962</span></font><font face="Calibri,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><font face="Calibri,sans-serif" size="1" color="#1F497D"><span style="font-size:7pt"><br>
</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Fax |</span></font><font face="Arial Bold" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt">+61
8 9266 2377</span></font><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"><br>
</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Mobile |</span></font><font face="Calibri,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt">0470 237 525</span></font><font face="Calibri,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><font face="Calibri,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"><br>
</span></font><font face="Calibri,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"><br>
</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Email |</span></font><font face="Calibri,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><a href="mailto:m.lynch@curtin.edu.au" id="m_2210573968912012062LPNoLP" target="_blank"><font face="Arial,sans-serif" size="2"><span style="font-size:9pt">m.mughal1@postgrad.curtin.<wbr>edu.au</span></font></a><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"> </span></font><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"><br>
</span></font><font face="Arial Bold" size="2" color="#AB8303"><span style="font-size:9pt">Web |</span></font><font face="Calibri,sans-serif" size="2" color="#AB8303"><span style="font-size:9pt"> </span></font><a href="http://curtin.edu.au/" id="m_2210573968912012062LPNoLP" target="_blank"><font face="Calibri,sans-serif" size="2"><span style="font-size:11pt"><font face="Arial,sans-serif" size="2"><span style="font-size:9pt">http://curtin.edu.au</span></font></span></font></a><font face="Arial,sans-serif" size="2" color="#1F497D"><span style="font-size:9pt"><br>
</span></font><font face="Calibri,sans-serif" size="1" color="#1F497D"><span style="font-size:7pt"><br>
</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Calibri,sans-serif" size="1" color="#1F497D"><span style="font-size:6pt"></span></font><font face="Arial,sans-serif" size="1" color="#1F497D"><span style="font-size:6pt">Curtin University is a trademark of Curtin University of Technology. </span></font><br>
</div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial,sans-serif" size="1" color="#1F497D"><span style="font-size:6pt">CRICOS Provider Code 00301J (WA), 02637B (NSW)</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial,sans-serif" size="1" color="#1F497D"><span style="font-size:6pt"><br>
</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font face="Times New Roman,serif" size="3"><span style="font-size:12pt"><font face="Arial,sans-serif" size="1" color="#1F497D"><span style="font-size:6pt"><br>
</span></font></span></font></div>
</div>
</div>
</div>
</div>
</div>
<br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>