<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">Sorry about the delay. It&#39;s been a busy week on email!</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I suggest using write_table instead of asciiwrite. This allows you to write one line of data to a file at a time, and to format it however you like.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">See the attached script. This also shows how to pass an array of lat/lon values to wrf_user_latlon_to_ij.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Note that I&#39;m using dummy lat/lon values for &quot;lats&quot; and &quot;lons&quot;. You need to change this to be the 15 values you want.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 17, 2017 at 6:55 PM, Muhammad Omer Mughal <span dir="ltr">&lt;<a href="mailto:m.mughal1@postgrad.curtin.edu.au" target="_blank">m.mughal1@postgrad.curtin.edu.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div>

<div id="m_-7136234493010531690divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hi Mary <br>
</p>
<p><br>
</p>
<p>Many thanks for your reply. Kindly see the code I use now to get 2m temperature at one location. The problem is that I am unable to get the corresponding times in the ascii file. Also is there a way to use 15 locations in line
<br>
</p>
<p><span>loc = wrf_user_ll_to_ij(a, 103.78538333,1.44386667, True)</span> instead of just one.<br>
</p>
<p><br>
</p>
<p></p>
<div>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/wrf/WRFUserARW.ncl&quot;<br>
;*****************************<wbr>******************<br>
begin<br>
;*****************************<wbr>******************<br>
<br>
DATADir = &quot;./&quot;<br>
  FILES = systemfunc (&quot; ls -1 &quot; + DATADir + &quot;wrfout_d05* &quot;)<br>
a = addfiles(FILES+&quot;.nc&quot;,&quot;r&quot;)<br>
<br>
times = wrf_user_list_times(a)<br>
ntimes = dimsizes(times)<br>
<br>
do it = 0,ntimes-1<br>
ntimes = dimsizes(times)<br>
T2= new(ntimes,&quot;string&quot;)<br>
time = it<br>
<br>
loc = wrf_user_ll_to_ij(a, 103.78538333,1.44386667, True)<br>
mx = loc(0) - 1 ; array pointers in NCL space<br>
ny = loc(1)-1<br>
lat1  = a[0]-&gt;XLAT(0,ny,mx)    ; the is the nearest grid point<br>
</div>
<div>lon1  = a[0]-&gt;XLONG(0,ny,mx)<br>
tc2 = wrf_user_getvar(a,&quot;T2&quot;,it)     ; T2 in Kelvin<br>
tc2 = tc2-273.16                  ; T2 in C<br>
 end do<br>
asciiwrite(&quot;2mtemperature.csv&quot;<wbr>,tc2)<br>
end<br>
</div><span class="">
<br>
<p></p>
<div id="m_-7136234493010531690Signature">
<div id="m_-7136234493010531690divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif,&quot;EmojiFont&quot;,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,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,&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font color="#1F497D" size="2" face="Arial Bold"><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,&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font color="#1F497D" size="2" face="Arial Bold"><span style="font-size:11pt">MSc BSc Mechanical Engineering</span></font><font color="#1F497D" size="1" face="Arial,sans-serif"><span style="font-size:8pt"><br>
</span></font><font color="#AB8303" size="2" face="Arial Bold"><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,&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font color="#AB8303" size="2" face="Arial Bold"><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,&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font color="#AB8303" size="2" face="Arial Bold"><span style="font-size:9pt">Department of Imaging and Applied Physics</span></font><font color="#AB8303" size="2" face="Arial Bold"><span style="font-size:9pt"><br>
Curtin University</span></font><font color="#AB8303" size="2" face="Arial Bold"><span style="font-size:9pt"><br>
</span></font><font color="#1F497D" size="2" face="Calibri,sans-serif"><span style="font-size:11pt"><br>
</span></font><font color="#1F497D" size="2" face="Arial Bold"><span style="font-size:9pt">Curtin University</span></font><font color="#1F497D" size="2" face="Arial Bold"><span style="font-size:9pt"><br>
</span></font><font color="#AB8303" size="2" face="Arial Bold"><span style="font-size:9pt">Tel |</span></font><font color="#1F497D" size="2" face="Arial Bold"><span style="font-size:9pt"> </span></font><font color="#1F497D" size="2" face="Arial,sans-serif"><span style="font-size:9pt">+61
 8 9266 7962</span></font><font color="#1F497D" size="2" face="Calibri,sans-serif"><span style="font-size:9pt"> </span></font><font color="#1F497D" size="1" face="Calibri,sans-serif"><span style="font-size:7pt"><br>
</span></font><font color="#AB8303" size="2" face="Arial Bold"><span style="font-size:9pt">Fax |</span></font><font color="#1F497D" size="2" face="Arial Bold"><span style="font-size:9pt"> </span></font><font color="#1F497D" size="2" face="Arial,sans-serif"><span style="font-size:9pt">+61
 8 9266 2377</span></font><font color="#1F497D" size="2" face="Arial,sans-serif"><span style="font-size:9pt"><br>
</span></font><font color="#AB8303" size="2" face="Arial Bold"><span style="font-size:9pt">Mobile |</span></font><font color="#1F497D" size="2" face="Calibri,sans-serif"><span style="font-size:9pt"> </span></font><font color="#1F497D" size="2" face="Arial,sans-serif"><span style="font-size:9pt">0470 237 525</span></font><font color="#1F497D" size="2" face="Calibri,sans-serif"><span style="font-size:9pt">  </span></font><font color="#1F497D" size="2" face="Calibri,sans-serif"><span style="font-size:9pt"><br>
</span></font><font color="#1F497D" size="2" face="Calibri,sans-serif"><span style="font-size:9pt"><br>
</span></font><font color="#AB8303" size="2" face="Arial Bold"><span style="font-size:9pt">Email |</span></font><font color="#1F497D" size="2" face="Calibri,sans-serif"><span style="font-size:9pt"> </span></font><a href="mailto:m.lynch@curtin.edu.au" id="m_-7136234493010531690LPNoLP" target="_blank"><font size="2" face="Arial,sans-serif"><span style="font-size:9pt">m.mughal1@postgrad.curtin.<wbr>edu.au</span></font></a><font color="#1F497D" size="2" face="Arial,sans-serif"><span style="font-size:9pt"> </span></font><font color="#1F497D" size="2" face="Arial,sans-serif"><span style="font-size:9pt"><br>
</span></font><font color="#AB8303" size="2" face="Arial Bold"><span style="font-size:9pt">Web |</span></font><font color="#AB8303" size="2" face="Calibri,sans-serif"><span style="font-size:9pt"> </span></font><a href="http://curtin.edu.au/" id="m_-7136234493010531690LPNoLP" target="_blank"><font size="2" face="Calibri,sans-serif"><span style="font-size:11pt"><font size="2" face="Arial,sans-serif"><span style="font-size:9pt">http://curtin.edu.au</span></font></span></font></a><font color="#1F497D" size="2" face="Arial,sans-serif"><span style="font-size:9pt"><br>
</span></font><font color="#1F497D" size="1" face="Calibri,sans-serif"><span style="font-size:7pt"><br>
</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font color="#1F497D" size="1" face="Calibri,sans-serif"><span style="font-size:6pt"></span></font><font color="#1F497D" size="1" face="Arial,sans-serif"><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,&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font color="#1F497D" size="1" face="Arial,sans-serif"><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,&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font color="#1F497D" size="1" face="Arial,sans-serif"><span style="font-size:6pt"><br>
</span></font></span></font></div>
<div style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,Tahoma,Arial,sans-serif;font-size:15.4545450210571px;margin:0px;background-color:rgb(255,255,255)">
<font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font color="#1F497D" size="1" face="Arial,sans-serif"><span style="font-size:6pt"><br>
</span></font></span></font></div>
</div>
</div>
</div>
</span></div>
<hr style="display:inline-block;width:98%">
<div id="m_-7136234493010531690divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Mary Haley &lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;<br>
<b>Sent:</b> Friday, 14 July 2017 10:44:04 PM<br>
<b>To:</b> Muhammad Omer Mughal<br>
<b>Subject:</b> Re: [ncl-talk] Wrf output at multiple mast locations</font>
<div> </div>
</div><div><div class="h5">
<div>
<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">For plotting WRF data, I recommend visiting this page:</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/wrf.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/wrf.shtml</a><br>
</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">As that first box points, out, you can use wrf_user_getvar:</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default"><a href="http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/WRF_arw/<wbr>wrf_user_getvar.shtml</a><br>
</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">to calculate various diagnostics and/or read variables.  It has some examples, including how to read 2m temperature (in degK):</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">  t2 = wrf_user_getvar(f,&quot;T2&quot;,-1)    ; read 2m temp across all time steps</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">In order to compare observational data with data that&#39;s on a WRF grid, you need to regrid or place the obs data on the WRF grid.</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">To regrid the data using ESMF, this involves interpolation, which you may or may not want.</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">See example ESMF_regrid_20.ncl at:</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/ESMF.shtml#ex20" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/ESMF.shtml#ex20</a><br>
</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">This goes from a WRF grid to another WRF grid, but the main change you need to make is to the &quot;lat_src&quot; and &quot;lon_src&quot; variables, which represent your source grid. These will need to be set the observational lat/lon 1D arrays in your
 case. </div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">If you don&#39;t want to interpolate the data, then you can try triple2grid2d, which we don&#39;t have any examples for, but the documentation has some code snippets for:</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default"><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid2d.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>triple2grid2d.shtml</a><br>
</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">Finally, you may also want to visit the &quot;gridding random data&quot; page:</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default"><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid2d.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>triple2grid2d.shtml</a><br>
</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">I&#39;m not sure this is your best set of examples, but I think it&#39;s worth looking at all these different methods to see which one best fits your purpose.</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">If you have problems with this and are able to provide us with your script and data, then we can help you out and maybe create a new example for our examples page so other users can benefit.</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">Good luck,</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">--Mary</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">
<p class="m_-7136234493010531690gmail-p2"><span class="m_-7136234493010531690gmail-s1"><br>
</span></p>
</div>
<div class="gmail_default"><br>
</div>
<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Jul 12, 2017 at 6:50 PM, Muhammad Omer Mughal <span dir="ltr">
&lt;<a href="mailto:m.mughal1@postgrad.curtin.edu.au" target="_blank">m.mughal1@postgrad.curtin.<wbr>edu.au</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Hi<br>
<br>
Is it possible in NCL to grab 2m temperature time series data at multiple locations in a single Wrf output file . I have about 15 stations and I want to compare the temperature at those locations with Wrf simulated temperature at 2m. Is there any example script
 that I can look at ?<br>
Also I would like to compare 2m temperature at single time from Wrf and observations  and plot the difference.please direct me to the relevant example.<br>
Thanks<br>
<br>
<br>
​<br>
Muhammad Omer Mughal<br>
MSc BSc Mechanical Engineering<br>
PhD  Research Scholar<br>
Remote Sensing and Satellite Research Group<br>
Department of Imaging and Applied Physics<br>
Curtin University<br>
<br>
Curtin University<br>
Tel | <a href="tel:+61%208%209266%207962" value="+61892667962" target="_blank">+61 8 9266 7962</a><br>
Fax | <a href="tel:+61%208%209266%202377" value="+61892662377" target="_blank">+61 8 9266 2377</a><br>
Mobile | 0470 237 525<br>
<br>
Email | <a href="mailto:m.mughal1@postgrad.curtin.edu.au" target="_blank">m.mughal1@postgrad.curtin.edu.<wbr>au</a><br>
Web | <a href="http://curtin.edu.au" target="_blank">http://curtin.edu.au</a><br>
<br>
​ Curtin University is a trademark of Curtin University of Technology.<br>
CRICOS Provider Code 00301J (WA), 02637B (NSW)<br>
<br>
​<br>
</div>
<br>
______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>

</blockquote></div><br></div>