[ncl-talk] linint2 interpolation

Micah Sklut micahs2005 at gmail.com
Tue Jul 2 08:39:21 MDT 2019


Thank you very much Rick and Dennis. This worked.

On Mon, Jul 1, 2019 at 10:37 PM Dennis Shea <shea at ucar.edu> wrote:

> Rick is correct.
>
> Based in the variable name ["UGRD_P0_L103_GLL0"], the source is a GRIB
> file from (say) NCEP. Typically, these are ordered North->South. linint2
> want South-to-North ordering.
>
> --
> [1] Good programming practice would be to **not* *use hard-wired index
> values.
>
> I suggest using NCL's coordinate subscripting  *{...}*.
>
> latS = ...
> latN = ...
> lonW = ...
> lonE = ...
> u = f[:]->UGRD_P0_L103_GLL0(:,*{latS:latN},{lonW:lonE}*)
> lat = u&lat_0
> lon = u&lon_0
>
> *printVarSummary*(u)     ; look at the output and ordering
>                                        ; the variable will be Sout-to-North
>
>
>
> On Mon, Jul 1, 2019 at 8:21 PM Rick Brownrigg via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Hi Micah,
>>
>> I don't know why you are seeing this behavior, but I would note that
>> there is language in the docs to linint2 to the effect that xi/yi and xo/yo
>> need to be monotonically *increasing*:
>>
>>     newlat = fspan(51.5,6.,274)
>>
>>     http://ncl.ucar.edu/Document/Functions/Built-in/linint2.shtml
>>
>> Perhaps that might provide some insights.
>>
>> Rick
>>
>> On Mon, Jul 1, 2019 at 8:10 PM Micah Sklut via ncl-talk <
>> ncl-talk at ucar.edu> wrote:
>>
>>> Hi,
>>>
>>> I am having trouble with the linint2 function.
>>>
>>> Here is the code I am using:
>>>
>>> u = f[:]->UGRD_P0_L103_GLL0(:,154:336,904:1212)
>>> lat = f[0]->lat_0(154:336)
>>> lon = f[0]->lon_0(904:1212)
>>>
>>> newlat = fspan(51.5,6.,274)
>>> newlon = fspan(226.,303.,463)
>>> newu = linint2(lon,lat,u,False,newlon,newlat,0)
>>>
>>> if I print u, i get:
>>> (0,0)   1.502375
>>> (0,1)   1.112375
>>> (0,2)   0.8723755
>>> (0,3)   0.8623755
>>> ...
>>>
>>> if i print newu, i get:
>>>   _FillValue :  1e+20
>>> (0,0)   1.502375
>>> (0,1)   1e+20
>>> (0,2)   1e+20
>>> (0,3)   0.8723755
>>> (0,4)   1e+20
>>> (0,5)   1e+20
>>> (0,6)   0.8523754
>>>
>>> I haven't been able to figure out why the fill value is being inserted
>>> in the values that should be interpolated.
>>>
>>> Thanks for your suggestions.
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>

-- 
Micah Sklut
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190702/94e651b1/attachment.html>


More information about the ncl-talk mailing list