<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello George,<div class=""><br class=""></div><div class="">It sounds like you want to create a subset of your data and then take the average of that. There are several ways you can create subsets with, for all you would need to know the latitude and longitude of the area you’re interested in (Google Earth could tell you): <a href="https://www.ncl.ucar.edu/Applications/latlon_subset.shtml" class="">https://www.ncl.ucar.edu/Applications/latlon_subset.shtml</a></div><div class=""><br class=""></div><div class="">Here is the method I’ve been using to create a subset:</div><div class=""><br class=""></div><div class="">precip = [input_file]->precipitation_data</div><div class="">lat = [input file]->lat</div><div class="">lon = [input file]->lon</div><div class=""><br class=""></div><div class=""><div class=""><div class=""><div class="">lat_subset = (/range_from,range_to/)<span class="Apple-tab-span" style="white-space: pre;">   </span>; latitude range</div><div class="">lat_subset@axis = "Y"</div><div class="">lat_subset@units = "degrees_north"</div><div class="">lat_subset@standard_name = "latitude"</div><div class="">lat_subset@long_name = "latitude"</div></div><div class=""><div class=""><div class=""><br class=""></div><div class="">lon_subset = (/range_from,range_to/)<span class="Apple-tab-span" style="white-space: pre;">        </span>; longitude range</div><div class="">lon_subset@axis = “X"</div><div class="">lon_subset@units = "degrees_east"</div><div class="">lon_subset@standard_name = “longitude"</div><div class="">lon_subset@long_name = “longitude"</div></div><div class=""><br class=""></div></div></div></div><div class="">lti = ind_nearest_coord(lat_subset,lat,0)<span class="Apple-tab-span" style="white-space: pre;">  </span>; determines the index numbers of the nearest grid cells</div><div class=""><div class="">lni = ind_nearest_coord(lon_subset,lon,0)</div></div><div class=""><br class=""></div><div class=""><div class="">lat_subdomain = lat(lti(0):lti(1))<span class="Apple-tab-span" style="white-space:pre"> </span>; creates subset latitudes and longitudes based on defined range</div><div class=""><div class="">lon_subdomain = lon(lni(0):lni(1))</div><div class=""><br class=""></div></div><div class=""><div class="">precip_subdomain = precip(:,lti(0):lti(1),lni(0):lni(1))<span class="Apple-tab-span" style="white-space:pre">       </span>; define the subdomain based on latind and lonind</div></div><div class=""><br class=""></div></div><div class="">From this you can now create the average using dim_avg_n (<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg_n.shtml" class="">https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg_n.shtml</a>) or avg (<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/avg.shtml" class="">https://www.ncl.ucar.edu/Document/Functions/Built-in/avg.shtml</a>).</div><div class=""><div class=""><br class="webkit-block-placeholder"></div><div class="">You should also double-check the lat and lon subsets to make sure you got the correct region:</div><div class=""><div class="">printVarSummary(lat_subdomain)</div></div><div class=""><div class="">printVarSummary(lon_subdomain)</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Good luck,</div><div class="">Toni</div><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><br class=""><br class=""><b class="">Toni Klemm, Ph.D.<br class=""></b>Postdoctoral Research Associate<br class="">Department of Ecosystem Science and Management<br class="">College of Agriculture and Life Sciences<br class="">Texas A&M University, College Station, TX<br class=""><a href="http://www.toni-klemm.de" class="">www.toni-klemm.de</a> | <a href="http://www.twitter.com/toniklemm" class="">@toniklemm</a><br class="">Editorial Board member, <a href="http://www.eccforum.org" class="">Early Career Climate Forum</a><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""></div></div></div></div>
</div>
<div><br class=""><blockquote type="cite" class=""><div class="">On Aug 19, 2019, at 1:12 AM, Babitha George via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hi,</div><div class=""><br class=""></div><div class="">I would like to take the area averaged precipitation over the state Kerala and I was wondering how to select the region. <br class=""></div><div class="">I have the shapefile of India, but I want to select only Kerala and do area average<br class=""></div><div class="">Does anyone have any advice on this?</div><div class=""><br class=""></div><div class="">Thank you<br class=""></div><div class="">-- <br class=""><div dir="ltr" class="m_-6530151121994789421gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">Babitha George<div class="">Research Scholar</div><div class="">IIST, Valiamala</div><div class="">Thiruvananthapuram,Kerala</div></div></div></div></div>
_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=DwICAg&c=u6LDEWzohnDQ01ySGnxMzg&r=zmhRVp0i4wZ5_1Ujh0fnRXAExHgKLTQu0rZLW7PxKA4&m=DJHjN80eON8I-D3QAeWzgZMn-iDk_H3IhlRI79wbEjY&s=KlaeyA13Gdhvi1cZK3cYojB3WgGsFpXh7TkT_zcj9lw&e= </div></blockquote></div><br class=""></div></body></html>