Re: How do I interpolate my 4-dimensional data to a 3-dimensional layer in vertical ?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 30 2009 - 20:09:36 MST

I thought about this on the way home.

A *much* faster version of the code is at:

    http://www.cgd.ucar.edu/~shea/linint1.ncl_v1

It is based on the fact that the "pout" argument can be one-dimensional
*or* the same dimensions as "xin" argument.

The "mh" was expanded via "conform"

   http://www.ncl.ucar.edu/Document/Functions/Built-in/conform.shtml

Good luck

moon wrote:
>
> Thanks,that is exactly what I want to figure out.
>
> ÔÚ Thu, 31 Dec 2009 04:23:27 +0800£¬Dennis Shea <shea@ucar.edu> дµÀ:
>
>> My understanding is that you have a vertical velocity from GODAS
>> dzdt(time,lev,lat,lon) ==> (1,40,418,360)
>> and a mixed layer depth
>> mh(time,lat,lon) ==> (1,418,360)
>>
>> You wish to get the dzdt at the depth of the mised layer??
>>
>> ===
>> Currently, there is no function to get this directly. You would have
>> to use
>> a double do loop. As in any interpreted language, 'do loop's can be slow.
>>
>> You will have to do something like:
>>
>> xo = new ( dimsizes(mh), typeof(dzdt), getFillValue(dzdt))
>>
>> w = dzdt(time|:,lat|:,lon|:,lev|:) ; only do this once
>>
>>
>> do nl=0,nlat-1
>> do ml=0,mlon-1
>> xo(:,nl,ml) = int2p (lev,w(:,nl,ml,:),mh(:,nl,ml),0)
>> end do
>> end do
>>
>> xo will be (time,lat,lon) ==> (1,418,360)
>>
>> See:
>> http://www.cgd.ucar.edu/~shea/h_20090105.png
>> http://www.cgd.ucar.edu/~shea/linint1.ncl
>> http://www.cgd.ucar.edu/~shea/plt_dzdt_mixed_layer.ncl
>>
>> ===
>>
>> If you want the data on a 2.5 degree grid, you will have to
>> use linint [better, linint2_Wrap] or area_hi2lores [better,
>> area_hi2lores_Wrap]
>>
>> http://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_Wrap.shtml
>> http://www.ncl.ucar.edu/Document/Functions/Contributed/area_hi2lores_Wrap.shtml
>>
>>
>> to interpolate to the 2.5 grid.
>>
>> Please dowload the fileas as soon as possible.
>>
>> Good luck
>>
>> On 12/29/2009 07:27 PM, moon wrote:
>>> Hi,
>>> Sorry, I didn't explain clearly.
>>> I have 4-dimensional ocean data with grid
>>> (time,h,lat,lon)--(0,20,72,144).I want to interpolate the data to
>>> vertical level with grid (time,lat,lon)--(0,72,144).
>>> The vertical level which I want to interpolate is a fuction of lat
>>> and lon.
>>> I have been looking at the web page documenting int2p, it can't meet
>>> my needs.
>>>
>>> Can someone provide some guidance?
>>>
>>> Thanks
>>>
>>> stera
>>>
>>> ÔÚ Wed, 30 Dec 2009 02:24:57 +0800£¬Dennis Shea <shea@ucar.edu> дµÀ:
>>>
>>>> Sorry. It is not clear what you want to do.
>>>>
>>>> Please explain in more detail.
>>>>
>>>> moon wrote:
>>>>> Hi,
>>>>> I have a four-dimensional data,eg. w(time,lev,lat,lon),how do I
>>>>> interpolate this variable to a three-dimentional
>>>>> layer--lev(time,lat,lon) in vertical?
>>>>> There are the same horizontal grids, but I try to interpolate w to
>>>>> a vertical layer which change with lat and lon.
>>>>> Thanks
>>>>> stera
>>>>> _______________________________________________
>>>>> 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
Received on Wed Dec 30 20:10:59 2009

This archive was generated by hypermail 2.1.8 : Tue Jan 05 2010 - 11:04:11 MST