[ncl-talk] linint2 interpolation

Dennis Shea shea at ucar.edu
Mon Jul 1 20:37:43 MDT 2019


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190701/c1c93a19/attachment.html>


More information about the ncl-talk mailing list