<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I have recently updated the examples in the documentation for lterp() to reflect this issue. When using 'gxout fwrite' instead displaying to the screen, you must restrict the dimension environment to the X limits of the destination grid.<div><br></div><div>I have tried to modify your script below to reflect these fixes:</div><div><br></div><div>1. open your destination grid file first, get the grid size in X , set the dimension using 'set 1 to xsize', instead of 'set lon 0 360'. This will control the number of columns that gets written out by fwrite.&nbsp;</div><div><br></div><div>2. open your source data file second</div><div><br></div><div>3. since you are writing out more than one time step, you must use the -ap option with 'set fwrite'. Delete all the output data files before you begin so that you don't append to an existing file.&nbsp;</div><div><br></div><div>4. move the 'set lev' command outside your time loop.</div><div><br></div><div>5. note the file numbers on the ends of the variable names got switched in the call to lterp, and the t='countt' designation goes as a dimension environment override in the variable expression for the first arg to lterp().&nbsp;</div><div><br></div><div><br></div><div>Try these changes and see if that doesn't fix your problem. If you get any error messages, you may also need to add "lev=500" to the dimesion override in the hgtprs variable declaration too.</div><div>--Jennifer</div><div><br></div><div><br></div><div><br><div><br><div><br><div><div>On Jul 16, 2013, at 11:26 AM, Scott Weaver - NOAA Federal wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div>Greetings,<br><br></div>I am using the lterp function in GrADS 2.0.2. While attempting to regrid data from a 360 x 181 to a 144 x 73 grid&nbsp; and write to a new file I get incorrect data values. When repeating the steps in interactive mode the regridding works fine. </div></blockquote><blockquote type="cite"><div dir="ltr">I have tried specifying the x and y dimensions (both using lat/lon and x/y), x only dimensions as per the users index, and no specification, before each fwrite. None works. I am doing the regridding in a loop for several timesteps and several variables. Please note in the older regrid2 udf I had no problem. Here is a sample of the code with just one variable:&nbsp; <br clear="all">
<div><div><br><br>'open regrid.dummyfile.to.2.5x2.5.ctl'<br></div></div></div></blockquote><code>'q file'<br>
line5 = sublin(result,5)<br>
sx = subwrd(line5,3)<br>
'set x 1 'sx&nbsp;</code></div><div><blockquote type="cite"><div dir="ltr"><div><div>'open prsDly$iy$mn$id$ih.$mm.ctl'</div></div></div></blockquote><br><blockquote type="cite"><div dir="ltr"><div><div>&nbsp;'set gxout fwrite'<br>&nbsp;'set fwrite -ap Dly$iy$mn$id$ih$mm.cfsv2.PRS.data'<br></div></div></div></blockquote>&nbsp;'!/bin/rm -f Dly$iy$mn$id$ih$mm.cfsv2.PRS.data'<br><blockquote type="cite"><div dir="ltr"><div><div>&nbsp;&nbsp;&nbsp; <br>'set lev 500' &nbsp; &nbsp;<br>countt=1<br>&nbsp;while(countt&lt;=45)<br>&nbsp; &nbsp; &nbsp;'d lterp(hgtprs.2(t='countt'),hgt500mb.1,bilin)'</div><div>&nbsp; &nbsp; &nbsp;countt=countt+1<br>&nbsp;endwhile<br><br>'disable fwrite'<br></div></div></div></blockquote><div><br></div><div><br></div><br><blockquote type="cite"><div dir="ltr"><div><div><br><br><br></div><div>Thanks for any help.<br>
</div><div><br></div><div>Scott<br></div><div><br><br>-- <br><div dir="ltr">Scott J. Weaver<br>Research Meteorologist<br>NOAA Climate Prediction Center<br>301-683-3434<br><a href="http://www.cpc.ncep.noaa.gov/" target="_blank">http://www.cpc.ncep.noaa.gov/</a></div>

</div></div></div>
_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>http://gradsusr.org/mailman/listinfo/gradsusr<br></blockquote></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="font-size: 12px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>--</div><div>Jennifer M. Adams</div><div>IGES/COLA</div><div>4041 Powder Mill Road, Suite 302</div><div>Calverton, MD 20705</div><div><a href="mailto:jma@cola.iges.org">jma@cola.iges.org</a></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span></span>
</div>
<br></div></div></div></body></html>