<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hey Andrew,<div class="">if what you want is to subset data in a geographical region there are multiple ways to achieve that.&nbsp;</div><div class="">Suppose you have 2-D lon and lat coordinates associated to your variable. Then you can use the where function (<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml" class="">http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml</a>) like so (see Example 3):&nbsp;</div><div class=""><br class=""></div><div class=""><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; font-size: 13.3333px; line-height: 12pt; font-family: courier; border-style: solid; border-width: 0px 0px 15px; border-color: transparent; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">  data_new = <strong style="margin: 0px; padding: 0px;" class="">where</strong>((<a href="mailto:data_read@lat2d.ge.latmin" class="">data_read@lat2d.ge.latMin</a> .and. <a href="mailto:data_read@lat2d.le.latmax" class="">data_read@lat2d.le.latMax</a>  .and. \
               <a href="mailto:data_read@lon2d.ge.lonmin" class="">data_read@lon2d.ge.lonMin</a> .and. <a href="mailto:data_read@lon2d.le.lonmax" class="">data_read@lon2d.le.lonMax</a>), data_read*1.3, data_read)</pre></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Il giorno 09 mar 2017, alle ore 00:47, Andrew Schwartz &lt;<a href="mailto:aschwa@ucar.edu" class="">aschwa@ucar.edu</a>&gt; ha scritto:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class="">Hi guys, <br class=""><br class=""></div>I am working on changing the smois values within my wrfinput_d01 file so that we can examine the various effects of soil moisture on different atmospheric parameters. I have an ncl script that does this for all the values in the CONUS, but I need to change only a small subset of the actual values that's roughly the size of Colorado. I have never written an ncl script and am stumped currently. Are there any built-in functions that might make this easier or do I need to go another route? My current code is below.<br class=""><br class=""></div><div class="">Thanks!<br class=""><br class=""></div><div class="">-Andrew<br class=""><br class="">=======================================================================<br class=""><br class="">;=============<br class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"<br class="">;=============<br class=""><br class="">;---Open file to rewrite<br class="">&nbsp; f = addfile("wrfinput_d01","w")<br class=""><br class="">;---Read data<br class="">&nbsp; data_read = f-&gt;SMOIS(:,:,:,:)<br class="">&nbsp; print("==================================================================")<br class="">&nbsp; printVarSummary(data_read)<br class="">&nbsp; print("min/max data_read = " + min(data_read) + "/" + max(data_read))<br class=""><br class="">&nbsp; data_new = data_read * 1.3<br class=""><br class="">&nbsp; print("==================================================================")<br class="">&nbsp; printVarSummary(data_new)<br class="">&nbsp; print("min/max data_read = " + min(data_new) + "/" + max(data_new))<br class=""><br class="">&nbsp; print("==================================================================")<br class="">&nbsp; print("================= Outputting Data to File ========================")<br class="">&nbsp; print("==================================================================")<br class=""><br class=""><br class="">;---Write out new data<br class="">&nbsp; f-&gt;SMOIS = data_new<br class=""><br class="">;---Close file.<br class="">&nbsp; delete(f)<br class=""><br class=""></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="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""></div></blockquote></div><br class=""></div></body></html>