<div dir="ltr">Dear Haley Ma'am,<div><br></div><div>Thanks for providing the information and <span id="gmail-0bbd9b95-cb2b-4f0a-b8b2-4edcfc107596" class="gmail-GINGER_SOFTWARE_mark">example. </span></div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><div dir="ltr"><div>But if I follow the getind_latlon2d function as I did, <span id="gmail-1c477331-4a11-4c84-ad39-3a8ba33ef414" class="gmail-GINGER_SOFTWARE_mark">then</span> it seems like I followed the same procedure as given in the example <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml">http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml</a></div><div><br></div><div>But still I am not getting the mean of the grid box on every time step or am I reading incorrectly the result ?</div><div><br></div><div><br></div><div>regards</div><div>Kunal Bali<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div>
<br><div class="gmail_quote">On Fri, Oct 13, 2017 at 12:11 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-size:small">Kunal,</div><div style="font-size:small"><br></div><div style="font-size:small">I created an example for you, showing three ways you can subset a WRF grid (since I already had a similar example). It shows how to use the getind_latlon2d function.</div><div style="font-size:small"><br></div><div style="font-size:small">You have to be careful with <span id="gmail-1289eca5-8b9d-4751-8b41-203824a2d70e" class="gmail-GINGER_SOFTWARE_mark">subsetting</span> curvilinear data, because specifying a <span id="gmail-f9850e60-a155-4ea7-8bbb-7b44d4bb976b" class="gmail-GINGER_SOFTWARE_mark">lat</span>/<span id="gmail-a9f8cbe1-6e90-406d-9d33-36e9eb5603ab" class="gmail-GINGER_SOFTWARE_mark">lon</span> box to take an average over can mean two different things. You will be able to see the difference when you look at the graphic.</div><div style="font-size:small"><br></div><div style="font-size:small">See example wrf_gsn_10<span id="gmail-400a1526-0159-44ad-9b85-2943a7748b6b" class="gmail-GINGER_SOFTWARE_mark">.</span><span id="gmail-58d9264d-b4fb-44f7-a8d1-5273e9437d65" class="gmail-GINGER_SOFTWARE_mark">ncl</span> at:</div><div style="font-size:small"><br></div><div><a href="http://www.ncl.ucar.edu/Applications/wrfgsn.shtml#ex10" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/wrfgsn.shtml#ex10</a><br></div><div><br></div><div>--Mary</div><div><br></div><div style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="gmail-h5">On Wed, Oct 11, 2017 at 12:03 PM, Kunal Bali <span dir="ltr"><<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="gmail-h5"><div dir="ltr"><div><div><div><div>Dear NCL users,<br></div><br>Single point coordinates values of 23.0 N and 77.0 E is extracted or print by using the script below<br><br>------------------------------<wbr>------------------------------<wbr>----------<br>; Main code<br>;-----------------------------<wbr>------------------------------<wbr>-----------<br> <span id="gmail-0eab2372-bf07-4566-8be4-194c036a7be5" class="gmail-GINGER_SOFTWARE_mark">dir</span> = "<span id="eb66f378-df2f-4d2a-9b36-192d3bd52243" class="gmail-GINGER_SOFTWARE_mark gmail-GINGER_SOFTWARE_mark GINGER_SOFTWARE_mark">.</span>/"<br> fnames = systemfunc("ls " + dir + "maiactaot*.nc")<br><span id="gmail-01b044f6-38bf-485e-acdf-ba1d22d492a4" class="gmail-GINGER_SOFTWARE_mark">print</span><span id="gmail-adb5574c-48f3-4308-b709-4f2feea381d7" class="gmail-GINGER_SOFTWARE_mark">(</span><span id="gmail-0f74ff8f-0ce4-420a-81e6-bff096448b14" class="gmail-GINGER_SOFTWARE_mark">fnames</span>)<br> <span id="gmail-29a33cf6-7d8b-42d2-a7a2-cc759938745b" class="gmail-GINGER_SOFTWARE_mark">a</span> = <span id="gmail-41dd69d4-630b-4b7a-99f2-beefd157e052" class="gmail-GINGER_SOFTWARE_mark">addfile</span><span id="gmail-ad398bb2-cf92-44ae-ab19-1f5afe3a7dd7" class="gmail-GINGER_SOFTWARE_mark">(</span><span id="gmail-87206339-7931-4ae3-b2a1-079285d695c3" class="gmail-GINGER_SOFTWARE_mark">fnames</span>,"r")<br> <span id="gmail-bcae822f-609a-47c2-8824-3665cfd41e71" class="gmail-GINGER_SOFTWARE_mark">data</span> = short2flt<span id="gmail-ac3b2eee-102a-4ed1-b9df-b3257ab6a9a6" class="gmail-GINGER_SOFTWARE_mark">(</span>a->Optical_Depth_055<wbr>_grid1km)<br> <span id="gmail-219c3815-4e7b-4e5f-a3e6-d6a4a9b6a08f" class="gmail-GINGER_SOFTWARE_mark">nFill</span> = <span id="gmail-bfaa5817-9b42-44ca-88ab-eff43b22b436" class="gmail-GINGER_SOFTWARE_mark">num</span><span id="gmail-3659f5e6-ebcc-4fac-8c31-0bc9c70c1960" class="gmail-GINGER_SOFTWARE_mark">(</span><span id="gmail-cf814eb0-0ab8-457e-86c8-ea3605715cb8" class="gmail-GINGER_SOFTWARE_mark">ismissing</span><span id="efa1c965-9013-41b9-9c42-5be1289f675a" class="gmail-GINGER_SOFTWARE_mark gmail-GINGER_SOFTWARE_mark GINGER_SOFTWARE_mark">(</span>data))<br> lat2d = a->GridLat_grid1km<br> lon2d = a->GridLon_grid1km<br><br><span id="gmail-04f30fc0-40ae-4d18-8ba4-5e77b3bf2f04" class="gmail-GINGER_SOFTWARE_mark">;</span>---grid points of interest<br> <span id="gmail-f3b93122-e518-4ae2-9fb9-0fd4b214dc3e" class="gmail-GINGER_SOFTWARE_mark">latv</span> = (/23.0/)<br> <span id="gmail-115643a3-d152-4114-ba20-f1a60b04afd3" class="gmail-GINGER_SOFTWARE_mark">lonv</span> = (/77.0 /)<br> <br> nm = getind_latlon2d (lat2d,lon2d, latv, lonv)<br> <br> <span id="gmail-099d53de-f551-4764-9543-8221a12abf0c" class="gmail-GINGER_SOFTWARE_mark">do</span> k=0<span id="gmail-a69fa0cf-7759-4145-bdcf-d978798a71e9" class="gmail-GINGER_SOFTWARE_mark">,</span><span id="gmail-3ba935a2-1b90-46bd-b638-0a071abbfc6b" class="gmail-GINGER_SOFTWARE_mark">dimsizes</span><span id="gmail-76de012b-7e94-4223-96c8-d5547fdb1cc1" class="gmail-GINGER_SOFTWARE_mark">(</span><span id="gmail-9a02ff64-99e8-4db4-aa9b-7a77268ca367" class="gmail-GINGER_SOFTWARE_mark">latv</span><span id="gmail-a4c57e6b-18dc-4a07-a369-56bf54f86b40" class="gmail-GINGER_SOFTWARE_mark">)</span>-1<br> <span id="gmail-0f8c0fe5-1980-431c-820a-15f372f351c0" class="gmail-GINGER_SOFTWARE_mark">n</span> = <span id="gmail-7bb9a579-6d60-4292-8ff9-9f4e310f9d9c" class="gmail-GINGER_SOFTWARE_mark">nm</span><span id="gmail-4d516442-f36a-4c47-a61c-94b85425d47e" class="gmail-GINGER_SOFTWARE_mark">(</span>k<span id="gmail-1e0c19a9-d4ca-4a78-8688-9aa3a0e68224" class="gmail-GINGER_SOFTWARE_mark">,</span>0)<br> <span id="gmail-446a2187-9e79-4bde-850c-b105ae793c20" class="gmail-GINGER_SOFTWARE_mark">m</span> = <span id="ea6e60ca-f646-4f45-a9b9-9f9264aa5877" class="gmail-GINGER_SOFTWARE_mark gmail-GINGER_SOFTWARE_mark GINGER_SOFTWARE_mark">nm</span><span id="gmail-074d96f4-e799-43f9-b539-3c1a4fdfac89" class="gmail-GINGER_SOFTWARE_mark">(</span>k<span id="gmail-8363988c-9f57-4aaa-bf35-7d0be783383e" class="gmail-GINGER_SOFTWARE_mark">,</span>1)<br> <span id="gmail-35df3b6d-3bb3-446b-a73f-f7189cccf843" class="gmail-GINGER_SOFTWARE_mark">print</span><span id="gmail-9a0da512-5789-45e2-93b3-ed87c6139deb" class="gmail-GINGER_SOFTWARE_mark">(</span>lat2d<span id="gmail-5dfb6b38-c317-46b6-a8d2-78e14ee6a2c1" class="gmail-GINGER_SOFTWARE_mark">(</span>n<span id="gmail-1137e035-7e87-4678-888a-8d0a89811411" class="gmail-GINGER_SOFTWARE_mark">,</span>m<span id="gmail-5058d776-df51-4303-bfc8-b4191bad89eb" class="gmail-GINGER_SOFTWARE_mark">)</span>+" "+lon2d<span id="gmail-d2d5e97e-676f-4384-abe0-898083cc7a94" class="gmail-GINGER_SOFTWARE_mark">(</span>n<span id="gmail-276f3f05-2f4d-44b3-9e93-68e031c9fd57" class="gmail-GINGER_SOFTWARE_mark">,</span>m))<span id="gmail-4519e924-0bd5-4ac0-977e-76c89a450d87" class="gmail-GINGER_SOFTWARE_mark"> ;</span> grid point location<br> <span id="gmail-f7f19858-5fb9-4ca5-8e98-4431cf8a937a" class="gmail-GINGER_SOFTWARE_mark">print</span><span id="gmail-dfb984a4-43ea-4e52-bcaf-e1123af92a28" class="gmail-GINGER_SOFTWARE_mark">(</span>" "+data<span id="gmail-61e5e32a-6ac6-482b-a3fe-3aaeb0328a9e" class="gmail-GINGER_SOFTWARE_mark">(</span>:<span id="gmail-acebda5f-cde4-4701-84c7-9c54bdc02f2f" class="gmail-GINGER_SOFTWARE_mark">,</span>n<span id="gmail-332c9976-ed1b-45b3-a10c-447af1bff740" class="gmail-GINGER_SOFTWARE_mark">,</span>m))<wbr><span id="gmail-7fedb156-b839-4bc1-b32e-1ca36913b12d" class="gmail-GINGER_SOFTWARE_mark"> ;</span> nearest grid point at all time steps<br> <span id="gmail-0ceadbb8-787e-4a29-a45d-ad7c4143403f" class="gmail-GINGER_SOFTWARE_mark">print</span><span id="gmail-88590e2e-6ab2-4f48-a268-30abf27307c0" class="gmail-GINGER_SOFTWARE_mark">(</span>"-----")<br> <span id="gmail-0cca89c0-44cc-4b16-85cf-8350baa58bfe" class="gmail-GINGER_SOFTWARE_mark">end</span> do<br><br></div></div> <br>NOW, I want to extract the square grid box of 100 km around the coordinates (23N,77E) such as <br> <span id="gmail-56a37e98-4e37-4030-99df-0773ca663e8d" class="gmail-GINGER_SOFTWARE_mark">latv</span> = (/22, 24.0, 24.0, 22.0, 22.0/)<br> <span id="gmail-40988c35-c7dd-41f2-8a8e-342f5982734a" class="gmail-GINGER_SOFTWARE_mark">lonv</span> = (/76, 76.0, 78.0, 78.0, 76.0 /)<br><br><br><span id="gmail-0ff724fa-e29b-4eab-bbe1-b2de3975a31f" class="gmail-GINGER_SOFTWARE_mark">after</span> that I want to do the area mean of the grid box. So that I can get one single point value of that grid box.<br></div>So when I <span id="gmail-a1b9144a-5584-426f-b36b-f421fd1a6205" class="gmail-GINGER_SOFTWARE_mark">replacing</span> <br> <span id="gmail-a8e90c83-2c3b-4487-9623-659592d903b2" class="gmail-GINGER_SOFTWARE_mark">latv</span> = (/23.0/)<br> <span id="gmail-81e03fdc-a361-4f48-98ce-b7b19919e539" class="gmail-GINGER_SOFTWARE_mark">lonv</span> = (/77.0/)<div><div><div><div><br></div><div><span id="gmail-523ff320-986b-48b4-9de2-d2b31c2fc288" class="gmail-GINGER_SOFTWARE_mark">with</span><br><br> <span id="gmail-b72de5f5-11c2-4b2a-9b07-c6b5f0a43729" class="gmail-GINGER_SOFTWARE_mark">latv</span> = (/22, 24.0, 24.0, 22.0, 22.0/)<br> <span id="gmail-23cf30b5-cd6b-4845-a2e5-656528aeaf35" class="gmail-GINGER_SOFTWARE_mark">lonv</span> = (/76, 76.0, 78.0, 78.0, 76.0 /)<br><br></div><div><span id="gmail-533657e8-e50c-43eb-94bd-79f4eeacfce0" class="gmail-GINGER_SOFTWARE_mark">then</span> It's not giving <span id="gmail-4560b2ea-4a62-4752-a123-7fad0b6e299f" class="gmail-GINGER_SOFTWARE_mark">mean</span> of the square grid box. <br><br></div><div>It shows the something like that (given below), which is incorrect. So please let me know how can I get the square grid box mean and then extract as <span id="gmail-caeb93ef-ff68-4e03-b87c-edd6fe4dd3d6" class="gmail-GINGER_SOFTWARE_mark">asciiwrite</span> or print?<br><br>(0) 23.76603307545667 75.53995171540016<br>(0) 0.179<br>(1) 0.142<br>(2) -28672<br>(3) 0.169<br>(4) -28672<br>(5) -28672<br>(6) -28672<br>(0) -----<br>(0) 24.00322458681621 75.99551564353467<br>(0) 0.171<br>(1) 0.16<br>(2) -28672<br>(3) 0.17<br>(4) -28672<br>(5) -28672<br>(6) -28672<br><br></div><div><span id="gmail-606478b4-8f99-4ef2-b02b-40b38fce9195" class="gmail-GINGER_SOFTWARE_mark">etc</span>.<span id="gmail-4e9d351b-658a-4db2-8526-0d74705d8994" class="gmail-GINGER_SOFTWARE_mark">.</span><span id="gmail-1eb96f87-eea9-4539-b3f0-b5bd67743d13" class="gmail-GINGER_SOFTWARE_mark">etc</span>..<br></div><div><br><br><br></div><div><span id="gmail-0241a938-1e80-41a1-a7fc-22ceaffd8f72" class="gmail-GINGER_SOFTWARE_mark">regards</span><span class="gmail-m_2067925330722622683HOEnZb"><font color="#888888"><br clear="all"></font></span></div><span class="gmail-m_2067925330722622683HOEnZb"><font color="#888888"><div><div><div><div class="gmail-m_2067925330722622683m_-3126016792024081524gmail-m_-4699656085058546873gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Kunal Bali<br></div><br><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div>
</div></div></font></span></div></div></div></div>
<br></div></div>______________________________<wbr>_________________<br>
<span id="gmail-c5e5f52d-823e-4d15-8982-b06388b22bd1" class="gmail-GINGER_SOFTWARE_mark">ncl</span>-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>
</blockquote></div><br></div></div>