# Re: linear interpolation

From: Lei Meng <dream916_at_nyahnyahspammersnyahnyah>
Date: Wed, 23 Sep 2009 16:02:11 -0400

Hi Dennis,
Thanks for your suggestions and it works fine. Except that the longitudes
from the two nc files do not match. The longitudes from one file are ranged
from -179.5 to +179.5 and the ones from the other file are from 0 to 357.
When I did the linear interpolation, only the values for longitudes 0 to
179.0 retain and there are no values for longitudes from -179.5 to 0. Any
suggestions?
Lei

On Wed, Sep 23, 2009 at 2:13 PM, Dennis Shea <shea_at_ucar.edu> wrote:

> To further what DaveB wrote:
>
> You did not state if the input grid was on hybrid levels or pressure
> levels.
> There are slightly different approaches that may be used.
>
> Generally, the vertical interpolation should be done first:
>
> X(12, 60,180,360) ===> Y(12, 28,180,360)
>
> Then, perform the horizontal interpolation:
>
> Y(12, 28,180,360) ===> Z(12, 28, 64,128)
> ===========
> NCL's Applications page is a good place to start:
>
> http://www.ncl.ucar.edu/Applications/
>
> ==================== VERTICAL INTERPOLATION ===============
> Under the "Data Analysis", Click: "Vertical Interpolation"
>
> http://www.ncl.ucar.edu/Applications/vert_interp.shtml
> If your input grid is on hybrid levels, Example 3 is closest to
> what you want to do.
>
> If the input is on pressure levels, the function "int2p"
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/int2p.shtml
>
> or, better, "int2p_Wrap", because it returns meta data
>
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/int2p_Wrap.shtml
> See Example 5
>
> yTemp = *int2p_Wrap*(p_in, x(time|:,lat|:,lon|:,pin|:), pout, linlog)
> printVarSummary(yTemp)
>
> YY = yTemp(time|:,iLev|:,LAT|:,LON|:) ; reorder for horizontal
> interpolation
> delete(yTemp)
>
> use, linint2_Wrap, or f2gsh_Wrap or area_hitolores for the grid
> interpolation.
>
>
>
>
>
> David Brown wrote:
>
>> Hi Lei,
>>
>> First just a bit of terminology: you are talking about the dimensions of
>> the variable not the attributes (which are metadata such as units or a
>> descriptive long name for the variable). There are a number of functions
>> you could use. Assuming you have coordinate values for the input and output
>> lat and lon dimensions, and you are using version 5.1.0 of NCL, I would
>> recommend the function area_hi2lores_Wrap. However, you could also use
>> linint2_Wrap, or if the output grid is Gaussian ("T42") the function
>> f2gsh_Wrap might be preferable.
>> -dave
>>
>>
>> On Sep 22, 2009, at 1:05 PM, Lei Meng wrote:
>>
>>
>>
>>> Hi,
>>> I have a nc file with attributes (Time, Lev, Lat, Lon) (e.g., 12,
>>> 60,180,360) and I would like to convert it to a nc file with attributes
>>> (Time, iLev,iLat,iLon) (e.g., 12, 28, 64,128) using linear interpolation.
>>> Which functions should I use to interpolate the three attributes (ilev,
>>> ilat, ilon)? Thanks,
>>> Lei
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> ======================================================
> Dennis J. Shea tel: 303-497-1361 |
> P.O. Box 3000 fax: 303-497-1333 |
> Climate Analysis Section |
> Climate & Global Dynamics Div. |
> National Center for Atmospheric Research |
> Boulder, CO 80307 |
> USA email: shea 'at' ucar.edu |
> ======================================================
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 23 2009 - 14:02:11 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 24 2009 - 13:55:09 MDT