[gradsusr] lterp+sdfwrite adding extra longitude values

Charles Seman - NOAA Federal charles.seman at noaa.gov
Wed Sep 4 18:02:48 EDT 2013


Andrew,

from http://grads.iges.org/grads/gadoc/gradfunclterp.html:
---
"If the domain of source is larger than the domain of dest, the returned 
result will have an expanded grid to cover the requested domain."
---

compare the longitude limits for the fine and coarse grids... it could 
be that if the specified fine grid limits are outside the coarse 
longitude grid limits, the interpolation puts data in two extra outer 
longitudes in the destination grid to satisfy the grid environment 
defined by "set X 1 [number of longitude points in fine.nc]"... so try 
"set dfile 2 ; set X 1 [number of longitude points in coarse.nc]" after 
"sdfopen coarse.nc"... this would set the global longitude limits to 
those of coarse.nc, which would then be within the limits of fine.nc

Hope this helps,
Chuck

On 09/04/2013 04: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
>

-- 

Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.

********************************************************************
  Charles Seman                                Charles.Seman at noaa.gov
  U.S. Department of Commerce / NOAA / OAR
  Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
  201 Forrestal Road                              fax: (609) 987-5063
  Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect any
official or unofficial position of the United States Federal Government,
the United States Department of Commerce, or NOAA."



More information about the gradsusr mailing list