<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 16, 2013, at 3:16 PM, Scott Weaver - NOAA Federal wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div><div>Jennifer,<br><br></div>Thanks for the advice. This works well for regridding the pressure level data. Do you have any advice on regridding gaussian data to a regular grid so that it is comparable to the pressure level data. in my original post I did not mention this. So basically I am opening 2 native files one regular grid and another gaussian and trying to write regridded fields form both of these native files to a new file. Is this even possible with lterp?&nbsp;&nbsp; <br></div></div></blockquote><div><br></div>Sure, as long as GrADS can open two data sets with two different grids, &nbsp;you can use lterp to interpolate from one to the other. There's no change to the syntax.&nbsp;</div><div>--Jennifer</div><div><br><blockquote type="cite"><div dir="ltr"><div>
<br></div>Thanks,<br>Scott <br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 16, 2013 at 12:15 PM, Jennifer Adams <span dir="ltr">&lt;<a href="mailto:jma@cola.iges.org" target="_blank">jma@cola.iges.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">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><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><a href="tel:301-683-3434" value="+13016833434" target="_blank">301-683-3434</a><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" target="_blank">gradsusr@gradsusr.org</a><br><a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br><div>
<span style="font-size:12px"><span style="border-spacing:0px 0px;text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:12px;white-space:normal;font-family:Helvetica;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" target="_blank">jma@cola.iges.org</a></div><div><br>
</div><br></span></span>
</div>
<br></div></div></div></div><br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><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>
_______________________________________________<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="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; "><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; "><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></span>
</div>
<br></body></html>