[ncl-talk] Error in lininit2points

Dennis Shea shea at ucar.edu
Sat Aug 17 22:44:27 MDT 2019


var.txt:  The 1st column of numbers is the line number [added for clarity].
 ln   lat     lon
  1 *10.0 *  *78.0 *      12.3   28.4   15.1     0.4   29.3   78.2 <===lat
; longitudes starts
  2 10.0   78.2       16.9   29.5   15.3     0.1   30.2   81.0
...
...
 10 10.0   79.8       19.5   29.4   21.7     0.2   32.8   85.5
 11 *10.0   80.0 *      20.0   28.7   21.9     0.2   34.5   85.5
 12 *10.2*   *78.0 *      12.5   27.9   13.9     0.3   25.7   84.7 <== new
lat row; lon restarts
 13 10.2   78.2       15.3   28.9   14.2     0.2   27.1   82.9
 14 10.2   78.4       15.3   29.6   14.9     0.4   27.5   83.4
 15 10.2   78.6       15.1   29.9   15.6     0.6   27.0   83.2
 16 10.2   78.8       16.0   30.3   16.5     0.6   26.3   84.3
 17 10.2   79.0       17.6   30.7   17.6     0.5   26.0   88.3
 18 10.2   79.2       18.3   30.9   18.5     0.2   26.0   92.8
 19 10.2   79.4       18.8   30.8   20.0     0.2   26.6   89.3
 20 10.2   79.6       19.4   30.5   21.5     0.2   28.5   85.1
 21 10.2   79.8       18.9   30.3   21.5     0.2   29.8   85.0
 *22 10.2   80.0 *      19.4   29.4   21.7     0.2   32.1   85.2
 *23 10.4*   *78.0*       12.3   27.6   13.7     0.2   19.3   87.6 <== new
lat row; lon restarts
...
 *33 10.4 *  80.0       18.9   30.1   21.5     0.2   29.5   84.8
 *34 10.6 *  *78.0 *      14.0   28.7   14.2     0.2   14.4   85.9 <== new
lat row; lon restarts
...
*120 12.0 *  79.8       14.8   31.0   18.9     0.2   22.6   85.1
*121 12.0*   80.0       17.7   30.6   20.3     0.1   22.4   86.3

It becomes amatter of book-keeping to plave the values onto a grid.
A rectilinear grid is *necessary* for *linint2_points*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/linint2_points.shtml>
or
*linint2_points_Wrap *
<http://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_points_Wrap.shtml>

See attached. There are many print statements. Please look at the output.

%> ncl *jagan_TNAU.linint2.ncl*

Good luck


On Sat, Aug 17, 2019 at 1:16 PM Barry Lynn via ncl-talk <ncl-talk at ucar.edu>
wrote:

> Hi Jagan:
>
> Do you understand the error message, but are not sure why you are getting
> it?
>
> The message means that the parameters within your interpolation line are
> not dimensionally consistent.  If you look at the page that describes the
> function, you might be able to figure out which of your variables does not
> conform dimensionally.
>
> If you've already gone past this point of trying to understand the error,
> then please write back.
>
> Barry
>
> On Sat, Aug 17, 2019 at 8:06 PM jagan TNAU via ncl-talk <ncl-talk at ucar.edu>
> wrote:
>
>> Dear Users,
>>
>> I was trying to interpolate gridded data to some station locations
>> using linint2_points function with the following script.
>> ;----------------------------------------------------------------------
>> ; lin2points.ncl
>> ;----------------------------------------------------------------------
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>
>> begin
>> ;************************************************
>> ; read ascii input file
>> ;************************************************
>>   values = asciiread("/Users/Jag/Desktop/cdz-regrid/var.txt",-1,"float")
>>   nvals = dimsizes(values)
>>   ncols = 8
>>   nrows = ncols/nvals
>>   lat  = values(0::ncols)
>>   lon  = values(1::ncols)
>>   srad = values(2::ncols)
>>   tmax = values(3::ncols)
>>   tmin = values(4::ncols)
>>   rain = values(5::ncols)
>>   wind = values(6::ncols)
>>   rhum = values(7::ncols)
>> ;************************************************
>>
>> ; Lat*lon array 11*11 = 121 rows read from the files
>> ; lat = (/10.0, 10.2, 10.4, 10.6, 10.8, 11.0, 11.2, 11.4, 11.6, 11.8,
>> 12.0/)
>> ; lon = (/78.0, 78.2, 78.4, 78.6, 78.8, 79.0, 79.2, 79.4, 79.6, 79.8,
>> 80.0/)
>>
>> ; points for which interpolation required totally 30
>>   nlat=(/10.38, 10.40/)
>>   nlon=(/79.85, 79.49/)
>>
>>   ntmax = linint2_points(lat,lon,tmax,False,nlat,nlon,0)
>>
>> ; Print only tmax as a sample
>>  print(ntmax)
>>
>> ; nsrad = linint2_points(lat,lon,srad,False,nlat,nlon,0)
>> ; ntmin = linint2_points(lat,lon,tmin,False,nlat,nlon,0)
>> ; nrain = linint2_points(lat,lon,rain,False,nlat,nlon,0)
>> ; nwind = linint2_points(lat,lon,wind,False,nlat,nlon,0)
>> ; nrhum = linint2_points(lat,lon,rhum,False,nlat,nlon,0)
>>
>> ;  alist   = [/nsrad,ntmax,ntmin,nrain,nwind,nrhum/]
>> ;  write_table("tmp11.txt", "w", alist, "%6.1f%6.1f%6.1f%7.1f%6.1f%6.1f")
>>
>> end
>> -----------------------------------------------
>> But I encountered the following error
>>
>> fatal:linint2_points: The rightmost dimensions of fi must be nyi x nxi,
>> where nyi and nxi are the lengths of yi and xi respectively
>>
>> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 32 in
>> file lin2points.ncl
>>
>>
>> Will you please help me to solve the problem. Sample file attached
>>
>>
>> --
>> With regards
>>
>> Dr.R.Jagannathan
>> Professor & Former Dean
>> Tamil Nadu Agricultural University
>> Coimbatore - 641 003 India
>>
>> PHONE:  Mob: +91 94438 89891
>>
>> DO NOT PRINT THIS E-MAIL UNLESS NECESSARY. THE ENVIRONMENT CONCERNS US
>> ALL.
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> --
> Barry H. Lynn, Ph.D
> Senior Associate Scientist, Lecturer,
> The Institute of the Earth Science,
> The Hebrew University of Jerusalem,
> Givat Ram, Jerusalem 91904, Israel
> Tel: 972 547 231 170
> Fax: (972)-25662581
>
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
>
> _______________________________________________
> 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/20190817/89834766/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jagan_TNAU.linint2.ncl
Type: application/octet-stream
Size: 1179 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190817/89834766/attachment.obj>


More information about the ncl-talk mailing list