<div dir="ltr"><div>Your "Subject" implies that there is an error with the function itself. <br></div><div>This is NOT true. The error is with the user.<br></div><div>====</div><div>It is important that users read the function documentation... carefully!</div><div>====<br></div><div> function <b>rcm2points</b> (<br> <b>lat2d [*][*] </b>: numeric, <== prototype <span style="color:rgb(0,0,255)"><b>[*][*] </b></span>means two-dimensions<br> l<b>on2d [*][*] :</b> numeric,<br> fi : numeric, <=== 'fi' <b>must be gridded data</b><br> lat [*] : numeric,<br> lon [*] : numeric, <br> opt : integer<br> )<br> return_val : numeric<br><br>Arguments: <br><b>lat2d</b>: A <span style="color:rgb(0,0,255)"><b>two-dimensional array </b></span>that specifies the latitude locations of fi. The latitudes should proceed from south-to-north.<br>lon2d<br><br><b>lon2d: </b>A <span style="color:rgb(0,0,255)"><b>two-dimensional array </b></span>that specifies the longitude locations of fi. The longitudes should proceed from west-to-east. <br></div><div>====</div><div>Your usage: tmaxcdz = <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/rcm2points.shtml" target="_blank"><b>rcm2points</b></a> (lat2d, lon2d, tmax, latcdz, loncdz, 0)</div><div><br></div><div>Just naming a one-dimensional variable 'lat2d/lon2d' does not make the variable two dimensional.</div><div><br></div><div><div> lat2d = values(1::ncols) ; ONE dimension<br></div><div> lon2d = values(2::ncols)</div><div><b>printVarSummary</b>(lat2d)</div><div>rank =<b> dimsizes</b>(<b>dimsizes</b>(lat2d))</div><div>print("lat2d: rank="+rank) ; rank=1<br></div><div> </div></div><div>============</div><div>NCL has several functions for 'reshaping' a variable: eg: <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/onedtond.shtml" target="_blank"><b>onedtooned</b></a>, <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/conform_dims.shtml" target="_blank"><b>conform_dims</b></a></div><div><br></div><div> nlat = ???</div><div> mlon = ???</div><div> lat2d := <b>onedtooned</b>(lat2d,(/nlat,mlon/)) ; syntax <b>:=</b> means reassign [replace]<br></div><div> lon2d := <b>onedtooned</b>(lon2d,(/nlat,mlon/))</div><div> printVarSummary(lat2d)</div><div>====</div><div>In your case it might be best to use:</div><div><br></div><div><div> values = asciiread("/Users/Jag/Desktop/cdz-regrid/20060101-sindia.txt",-1,"float")</div><div> nvals = dimsizes(values)</div><div> ncols = 9</div><div> nrows = ncols/nvals</div><div><br></div><div> nlat = ...</div><div> mlon = ...</div><div> npts = nlat*mlon</div><div> if (nvals.ne.npts) then</div><div> print("FATAL: size mismatch: nvals="+nvals+": npts="+npts)</div><div> exit</div><div> end if<br></div><div><br></div><div> lat2d = <b>onedtond</b>( values(1::ncols) , (/nlat,mlon/) )</div><div> lon2d = <b>onedtond</b>( values(2::ncols) , (/nlat,mlon/) )<br></div><div> srad = <b>onedtond</b>( values(3::ncols) , (/nlat,mlon/) )</div><div> tmax = <b>onedtond</b>( values(4::ncols) , (/nlat,mlon/))</div> ....</div><div> ....</div><div> printVarSummary(tmax)</div><div> printMinMax(tmax,0)</div><div> print("============")</div><div><br></div><div>The function documentation<b> </b><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/rcm2points.shtml" target="_blank"><b>rcm2points</b></a> states that the array data be ordered South-to-North.</div><div>If not, the user must reorder. Again, NCL syntax [<b> ::-1</b> ] facilitates this operation.<br></div><div><br></div><div> lat2d = lat2d(<b>::-1</b>,:) reordder the 'y' axis<br></div><div> srad = srad(<b>::-1</b>,:)<br></div><div> tmax = tmax(<b>::-1</b>,:)<br></div><div><br></div><div>Good Luck<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 16, 2019 at 10:23 PM jagan TNAU via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">I have an ascii output in irregular grid and trying to some station points using the script below<div><div>;*************************************************</div><div>; location.ncl </div><div>;************************************************</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" </div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" </div><div>;************************************************</div><div>begin</div><div>;************************************************</div><div>; read ascii input file</div><div>;************************************************</div><div> values = asciiread("/Users/Jag/Desktop/cdz-regrid/20060101-sindia.txt",-1,"float")</div><div> nvals = dimsizes(values)</div><div> ncols = 9</div><div> nrows = ncols/nvals</div><div> lat2d = values(1::ncols) </div><div> lon2d = values(2::ncols)</div><div> srad = values(3::ncols) </div><div> tmax = values(4::ncols)</div><div> tmin = values(5::ncols) </div><div> rain = values(6::ncols)</div><div> wind = values(7::ncols) </div><div> rhum = values(8::ncols) </div><div>;***********************************************</div><div> latcdz = (/ 10.20, 10.48, 10.67 /)</div><div> loncdz = (/ 79.00, 78.20, 78.75 /)</div><div> tmaxcdz = rcm2points (lat2d, lon2d, tmax, latcdz, loncdz, 0)</div><div>print(tmaxcdz)</div><div>end</div><div><br></div><div>But when I run the code it shows the following error.</div><div><p style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Number of dimensions in parameter (0) of (rcm2points) is (1), (2) dimensions were expected </span></p>
<p style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8637]:Execute: Error occurred at or near line 26 in file check.ncl</span></p><p style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">The file is for single time. </p><p style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">Will you please help me to solve the problem</p></div>-- <br><div dir="ltr" class="gmail-m_5503786956362888393gmail-m_-2560636809578338559gmail_signature"><div dir="ltr"><div>With regards<br><br>Dr.R.Jagannathan <br>Professor & Former Dean<br>Tamil Nadu Agricultural University <br>Coimbatore - 641 003 India <br><br>PHONE: Mob: +91 94438 89891<br><br>DO NOT PRINT THIS E-MAIL UNLESS NECESSARY. THE ENVIRONMENT CONCERNS US ALL.</div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>