[gradsusr] lterp+sdfwrite adding extra longitude values

Jennifer Adams jma at cola.iges.org
Wed Sep 4 17:59:43 EDT 2013


Hi, Andrew -- 
I agree that this is tricky, and I had recently updated the example in the docs to reflect the subtleties when using lterp with fwrite. I see I will have to add another example with sdfwrite -- this email has given me a good start on that ...

Anyway, the difference between your example and mine is that in my example the default file is the destination grid and in yours the default file is the source grid. It matters what file is set to be the default file because x=1:xsize resolves to different world coordinates when you change default files. The bottom line is you want to be constraining the coordinates of the destination grid. To fix your example, you have two options: 

1. Switch the order of the sdfopen commands (i.e. open coarse.nc first), and then 'set x 1 number_of_points_in_coarse.nc' then change lterp command to lterp(fine.2,coarse)

2. Before you define the output variable, you can 'set dfile 2' and then 'set x 1 number_of_points_in_coarse.nc' and then proceed. 

--Jennifer

On Sep 4, 2013, at 4:42 PM, Andrew Friedman wrote:

> Hi GrADS users,
> 
> I am using lterp to regrid a file to a coarser resolution, and saving the variable to netcdf using sdfwrite.
> 
> My problem is that the output file has 2 additional longitudes compared to the input grid destination description file.
> 
> Similar to the example in the lterp documentation in the grads index:
> 
> sdfopen fine.nc
> set X 1 [number of longitude points in fine.nc]
> sdfopen coarse.nc
> output = lterp(fine,coarse.2,aave)
> set sdfwrite output.nc
> sdfwrite output
> 
> I've had this issue before when there is just one input file, and explicitly defining longitude with the step 'set X 1 [number of longitude points]' works to solve it. In this case however, I'm not sure how to limit the longitude dimension of the output.
> Do you have ideas how I can fix this?
> 
> Thanks,
> Andrew
> 
> 
> ------
> Andrew Friedman
> Graduate Student, UC Berkeley Geography
> andfried at berkeley.edu
> 
> 
> 
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
Center for Ocean-Land-Atmosphere Studies (COLA)
111 Research Hall, Mail Stop 2B3
George Mason University
4400 University Drive
Fairfax, VA 22030 





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130904/97b67534/attachment-0003.html 


More information about the gradsusr mailing list