Re: Interpolation- problem with the linint2 function

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 26 2013 - 10:43:25 MST

Hi Lorenzo,
Whenever linint2/linint2_Wrap are used one has to check to make sure
that the input and output grids are overlapping and are oriented the
same direction. So if you are having trouble with those functions I
would take a close look at your input/output latitudes/longitudes. I
cannot see what your input latitudes and longitudes are, but they should
match your output latitudes/longitudes which run from south->north (lat)
and from 0->357.5E.

However, I see that you are setting you output latitudes like this:
klat = ispan(0,72,1)*2.5
That results in a latitude array from 0->180, which is outside the range
of -90:90. So I am guessing that that line is causing your problem.

If you have any further questions please respond to ncl-talk..
Adam

On 11/26/2013 10:36 AM, Lorenzo de Cillia wrote:
> Hello!
>
> I have a problem with the following NCL script....
> I'm reading out geopotential height data from a .nc file and try to
> interpolate it to a 2.5x2.5 grid with the function linint2...
>
> The problem is that I got a lot of missing values (so 1e+20) in the
> results and I don't know why... Can please somebody tell me if there's
> an error in the script or in the usage of the linint2 function?
>
> Thank you for your help,
>
> Lorenzo
>
> ------------------------------
> -------------
>
> begin
> filen=getenv("FILENAME")
>
> ;; print (filen)
> a = addfile(filen,"r")
>
> u1 = a->zg(:,3,:,:)
>
> ;;;output
> u1@_FillValue=1e+20
> npts = dimsizes(u1(:,0,0)) ; number of time points
> nlat = dimsizes(u1(0,:,0)) ; number of latitudes
> nlon = dimsizes(u1(0,0,:)) ; number of lon
>
> um=new ( (/nlat,nlon /), float)
> filo = "daily_model.dat" ; output file
>
> ;;interpolate to 2.5x2.5
>
> mlon = u1&lon
> mlat = u1&lat
> print(mlat)
>
> klon = ispan(0,143,1)*2.5
> print(klon)
> klat = ispan(0,72,1)*2.5
> print(klat)
>
> ;print(u1)
> model =linint2(mlon,mlat,u1,False,klon,klat,0)
> printVarSummary(model)
> print(model)
> fbinrecwrite (filo, -1, model)
> end
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 26 10:43:36 2013

This archive was generated by hypermail 2.1.8 : Wed Dec 04 2013 - 20:42:38 MST