[gradsusr] Lterp in Fwrite

Scott Weaver - NOAA Federal scott.weaver at noaa.gov
Tue Jul 16 15:16:41 EDT 2013


Jennifer,

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?

Thanks,
Scott


On Tue, Jul 16, 2013 at 12:15 PM, Jennifer Adams <jma at cola.iges.org> wrote:

> 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.
>
> I have tried to modify your script below to reflect these fixes:
>
> 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.
>
> 2. open your source data file second
>
> 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.
>
> 4. move the 'set lev' command outside your time loop.
>
> 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().
>
>
> 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.
> --Jennifer
>
>
>
>
>
> On Jul 16, 2013, at 11:26 AM, Scott Weaver - NOAA Federal wrote:
>
> Greetings,
>
> 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  and write to a new file I get
> incorrect data values. When repeating the steps in interactive mode the
> regridding works fine.
>
> 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:
>
>
> 'open regrid.dummyfile.to.2.5x2.5.ctl'
>
> 'q file'
> line5 = sublin(result,5)
> sx = subwrd(line5,3)
> 'set x 1 'sx
>
> 'open prsDly$iy$mn$id$ih.$mm.ctl'
>
>
>  'set gxout fwrite'
>  'set fwrite -ap Dly$iy$mn$id$ih$mm.cfsv2.PRS.data'
>
>  '!/bin/rm -f Dly$iy$mn$id$ih$mm.cfsv2.PRS.data'
>
>
> 'set lev 500'
> countt=1
>  while(countt<=45)
>      'd lterp(hgtprs.2(t='countt'),hgt500mb.1,bilin)'
>      countt=countt+1
>  endwhile
>
> 'disable fwrite'
>
>
>
>
>
>
>
> Thanks for any help.
>
> Scott
>
>
> --
> Scott J. Weaver
> Research Meteorologist
> NOAA Climate Prediction Center
> 301-683-3434
> http://www.cpc.ncep.noaa.gov/
>  _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> --
> Jennifer M. Adams
> IGES/COLA
> 4041 Powder Mill Road, Suite 302
> Calverton, MD 20705
> jma at cola.iges.org
>
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Scott J. Weaver
Research Meteorologist
NOAA Climate Prediction Center
301-683-3434
http://www.cpc.ncep.noaa.gov/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130716/a5645ede/attachment-0003.html 


More information about the gradsusr mailing list