<div dir="ltr"><div>;=======<br></div>; SCRIPT: tst_regCoef.ncl<br>;=======<br><div> diri = "./"<br> fili = "<a href="http://test.nc" target="_blank">test.nc</a>"<br> pthi = diri+fili<br> f = addfile(pthi, "r")<br><br> y = f->TOTEXTTAU ; (time, lat, lon)<br> printVarSummary(y) <wbr> ; [time | 36] x [lat | 67] x [lon | 48]<br> print("==========")<br><br> ;dimy = dimsizes(y)<br> ;ntim = dimy(0)<br> ;nlat = dimy(1)<br> ;mlon = dimy(2)<br><br> printVarSummary(y(lat|:,lon|:,<wbr>time|:)) ; [lat | 67] x [lon | 48] x [time | 36]<br> print("==========")<br><br> rc = regCoef(y&time, y(lat|:,lon|:,time|:))<br><br> copy_VarCoords(y(0,:,:), rc)<br> printVarSummary(rc)<br> printMinMax(rc,1)<br><br>==============================<wbr>==============================<wbr>===========<br>OUTPUT<br>==============================<wbr>==============================<wbr>===========<br>%> ncl tst_regCoef.ncl<br> Copyright (C) 1995-2015 - All Rights Reserved<br> University Corporation for Atmospheric Research<br> NCAR Command Language Version 6.3.0<br> The use of this software is governed by a License Agreement.<br> See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<br><br>Variable: y<br>Type: float<br>Total Size: 463104 bytes<br> 115776 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 36] x [lat | 67] x [lon | 48]<br>Coordinates: <br> time: [526680..18934200]<br> lat: [ 5.. 38]<br> lon: [68.125..97.5]<br>Number Of Attributes: 7<br> standard_name : Total Aerosol Extinction AOT [550 nm]<br> long_name : Total Aerosol Extinction AOT [550 nm]<br> units : 1<br> _FillValue : 1e+15<br> fmissing_value : 1e+15<br> vmax : 1e+15<br> vmin : -1e+15<br>(0) ==========<br><br>Variable: y (subsection)<br>Type: float<br>Total Size: 463104 bytes<br> 115776 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [lat | 67] x [lon | 48] x [time | 36]<br>Coordinates: <br> lat: [ 5.. 38]<br> lon: [68.125..97.5]<br> time: [526680..18934200]<br>Number Of Attributes: 7<br> vmin : -1e+15<br> vmax : 1e+15<br> fmissing_value : 1e+15<br> _FillValue : 1e+15<br> units : 1<br> long_name : Total Aerosol Extinction AOT [550 nm]<br> standard_name : Total Aerosol Extinction AOT [550 nm]<br>(0) ==========<br><br>Variable: rc<br>Type: double<br>Total Size: 25728 bytes<br> 3216 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lat | 67] x [lon | 48]<br>Coordinates: <br> lat: [ 5.. 38]<br> lon: [68.125..97.5]<br>Number Of Attributes: 5<br> _FillValue : 999999986991104<br> nptxy : <ARRAY of 3216 elements><br> rstd : <ARRAY of 3216 elements><br> yintercept : <ARRAY of 3216 elements><br> tval : <ARRAY of 3216 elements><br>(0) <br>(0) min=-1.660007214663053e-09 max=2.459720467540745e-08<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 2, 2017 at 9:36 PM, Kunal Bali <span dir="ltr"><<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Dear Dennis, <br>Thanks for all the suggestions. <br>I have attached a test file. So you can try on that.<br><br></div>Thanks <br></div><div class="gmail_extra"><span class=""><br clear="all"><div><div class="m_9116501929336920820gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Kunal Bali<br></div><div>Research Scholar <br></div><div>Radio & Atmospheric Science Division <br></div><div>CSIR - National Physical Laboratory<br></div><div>New Delhi - 110012<br></div><div>India<br></div><div><br></div><div><br></div><div><br></div><div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div>
<br></span><div><div class="h5"><div class="gmail_quote">On Tue, Jan 3, 2017 at 3:20 AM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>tst_regCoef.Kunal_Bali.ncl contains:<br><br>;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<wbr>%%%%%%%%<br></div> ntim = 13149<br> nlat = 67<br> mlon = 48<br> x = ispan(1,ntim,1)<br> x!0 = "time"<br> printVarSummary(x)<br> print("==========")<br><br> y = random_uniform(100,200, (/ntim,nlat,mlon/))<br> y!0 = "time"<br> y!1 = "lat"<br> y!2 = "lon"<br> printVarSummary(y) ; [time | 13149] x [lat | 67] x [lon | 48]<br> print("==========")<br><br> printVarSummary(y(lat|:,lon|:,<wbr>time|:)) ; [lat | 67] x [lon | 48] x [time | 13149]<br> print("==========")<br><br> rc = regCoef(x,y(lat|:,lon|:,time|:<wbr>))<br><br> copy_VarCoords(y(0,:,:), rc)<br> printVarSummary(rc)<br> printMinMax(rc,1)<br><div>;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<wbr>%%%%%%%%%<br><br>%> ncl tst_regCoef.Kunal_Bali.ncl<br><br> NCAR Command Language Version 6.3.0<br><br><br>Variable: x<br>Type: integer<br>Total Size: 52596 bytes<span><br> 13149 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [time | 13149]<br>Coordinates: <br></span>(0) ==========<span><br><br>Variable: y<br>Type: float<br>Total Size: 169148736 bytes<br> 42287184 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 13149] x [lat | 67] x [lon | 48]<br>Coordinates: <br></span>(0) ==========<br><br>Variable: y (subsection)<span><br>Type: float<br>Total Size: 169148736 bytes<br> 42287184 values<br>Number of Dimensions: 3<br></span>Dimensions and sizes: [lat | 67] x [lon | 48] x [time | 13149]<br>Coordinates: <br>(0) ==========<br><br>Variable: rc<br>Type: float<br>Total Size: 12864 bytes<br> 3216 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lat | 67] x [lon | 48]<br>Coordinates: <br>Number Of Attributes: 5<br> _FillValue : 9.96921e+36<br> nptxy : <ARRAY of 3216 elements><br> rstd : <ARRAY of 3216 elements><br> yintercept : <ARRAY of 3216 elements><br> tval : <ARRAY of 3216 elements><br>(0) <br>(0) min=-0.000292889 max=0.000215768<br><br>==============================<wbr>====<br><br></div><div>There are no logged bug fixes for regCoef. Hence, not sure of the issus.<br><br>==============================<wbr>=====<br></div><div>You can ftp the data file but we can not use old NCL versions:<br><br></div><div>ftp <a href="http://ftp.cgd.ucar.edu" target="_blank">ftp.cgd.ucar.edu</a><br></div><div>anonymous<br></div><div>your_email<br></div><div>cd incoming<br></div><div>put your_data_file<br></div><div>quit<br><br></div><div>Notify ncl-talk after successful transfer of the file.<br><br><br></div><div><br><br></div><div><br></div></div><div class="m_9116501929336920820HOEnZb"><div class="m_9116501929336920820h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 2, 2017 at 12:05 PM, Kunal Bali <span dir="ltr"><<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>The summarty shows <br><br><b>Variable: y<br>Type: float<br>Total Size: 169148736 bytes<br> 42287184 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 13149] x [lat | 67] x [lon | 48]<br>Coordinates: <br> time: [1080..18934200]<br> lat: [ 5.. 38]<br> lon: [68.125..97.5]<br>Number Of Attributes: 7<br> vmin : -1e+15<br> vmax : 1e+15<br> fmissing_value : 1e+15<br> _FillValue : 1e+15<br> units : W m-2<br> long_name : toa_net_downward_shortwave_flu<wbr>x_assuming_clear_sky<br> standard_name : toa_net_downward_shortwave_flu<wbr>x_assuming_clear_sky</b><br><br>Variable: x<br>Type: double<br>Total Size: 105192 bytes<br> 13149 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [time | 13149]<br>Coordinates: <br>Number Of Attributes: 3<br> standard_name : time<br> units : minutes since 1980-01-01 00:30:00<br> calendar : standard<span><br>fatal:regCoef: The rightmost dimension of x must be equal to the rightmost dimension of y<br></span>fatal:["Execute.c":8567]:Execu<wbr>te: Error occurred at or near line 37 in file trend.ncl<br><br><br><br></div>And the script is <br><br> <b> tmp = a->SWTNTCLR<br> y = tmp(time|:,lat|:,lon|:) <wbr> ; reorder variable<span><br><br> delete(tmp) <wbr> ; no longer needed<br><br><br>;*****************************<wbr>*******************<br>; create x and calculate the regression coefficients (slopes, trends) <br>;*****************************<wbr>*******************<br></span> x = y&time <br> printVarSummary(y)<br> printVarSummary(x)<br> <br> rc = regCoef(x,y) <br><br><br></b></div><b>So how to set the x (which is time) with y (which is time|lat|lon)<span class="m_9116501929336920820m_747290511169588846HOEnZb"><font color="#888888"><br></font></span></b><span class="m_9116501929336920820m_747290511169588846HOEnZb"><font color="#888888"><div><b> </b><br><div><div><br></div></div></div></font></span></div><div class="gmail_extra"><span class="m_9116501929336920820m_747290511169588846HOEnZb"><font color="#888888"><br clear="all"><div><div class="m_9116501929336920820m_747290511169588846m_-4619085922763679081gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Kunal Bali<br></div><div>Research Scholar <br></div><div>Radio & Atmospheric Science Division <br></div><div>CSIR - National Physical Laboratory<br></div><div>New Delhi - 110012<br></div><div>India<br></div><div><br></div><div><br></div><div><br></div><div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div></font></span><div><div class="m_9116501929336920820m_747290511169588846h5">
<br><div class="gmail_quote">On Mon, Jan 2, 2017 at 11:38 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>I believe ncl-talk has been down his raod with you before. Please look at the error messages and *always* include printVarSummary of the the variables used. Place the <b>**before**</b> the line where the error occurs.<br></div><br></div>printVarSummary(x)<br></div>printVarSummary(y)<br></div>or <br>printVarSummary(y<span class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838gmail-im">(lat|:,lon|:,<wbr>time|:) )<br><br></span><span><span class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838gmail-im">rc = <b>regCoef</b>(x, y(lat|:,lon|:,time|:) )</span><br></span><div><div><div><span class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838gmail-im"> <br>The error message state:</span><span><br><pre><b><span class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838gmail-im">fatal:regCoef: The rightmost dimension of x must be <br></span>equal to the rightmost dimension of y<br><br></b></pre></span><pre>Please look ....<b><br></b></pre><pre>What are the sizes of 'x' and the rightmost dimension of 'y' ?<b><br><br></b></pre><br></div></div></div></div><div class="m_9116501929336920820m_747290511169588846m_-4619085922763679081HOEnZb"><div class="m_9116501929336920820m_747290511169588846m_-4619085922763679081h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 2, 2017 at 10:45 AM, Kunal Bali <span dir="ltr"><<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I have 6.2.0 NCL version<br><br></div>I tried with <br><span> <br>rc = <b>regCoef</b>(x, y(lat|:,lon|:,time|:) )<br><pre></pre></span><pre>but still getting some error<br><b><span>fatal:regCoef: The rightmost dimension of x must be <br></span>equal to the rightmost dimension of y</b><br><br></pre><br><div><br></div><div class="gmail_extra">regards<span class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838HOEnZb"><font color="#888888"><br clear="all"></font></span></div><div class="gmail_extra"><span class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838HOEnZb"><font color="#888888"><div><div class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838m_-6920874904743519709gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Kunal Bali<br></div><br><div><br></div><div><br></div><div><br></div><div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div></font></span><div><div class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838h5">
<br><div class="gmail_quote">On Mon, Jan 2, 2017 at 9:24 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>I would recommend:<br></div><div><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/Built-in/regCoef_<wbr>n.shtml</a><br><br></div><div>This is the most recent version. As noted in the documentation:<br>Note: with NCL V6.2.1 or later, you can use <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml" target="_blank"><b>regCoef_n</b></a>
to avoid having to reorder the arrays first:
<pre> rc = <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml" target="_blank"><b>regCoef_n</b></a>(x, y, 0, 0)
</pre>===<br></div><div><br></div>****PLease See: Example 2***<br><br><pre>rc = <b>regCoef_n</b>(time, ts, 0, 0) ; <b>rc(nlat,mlon)</b></pre>copy_VarCoords(ts(0,:,),rc)<br></div>printVarSummary(rc)<br><br>=====<br></div>Using the original regCoef rather than regCoef_n may require the arrays to be reordered.<br><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef-1.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/Built-in/regCoef-<wbr>1.shtml</a><br><br></div>****See: Examples 2 and 3***<br><br><pre> rc = <b>regCoef</b>(x, y(lat|:,lon|:,time|:) )
</pre>If <i>y</i> has <a href="http://www.ncl.ucar.edu/Document/Language/cv.shtml" target="_blank">coordinate variables</a>
these may readily be assigned via NCL syntax:
<pre> rc!0 = "lat" ; name dimensions
rc!1 = "lon"
rc&lat = y&lat ; assign coordinate values to named dimensions
rc&lon = y&lon
</pre><br><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838m_-6920874904743519709h5">On Mon, Jan 2, 2017 at 3:01 AM, Kunal Bali <span dir="ltr"><<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838m_-6920874904743519709h5"><div dir="ltr"><div><div><div><div>Dear NCL users,<br><br></div>I have the data with time steps > 1000<br><br></div>I want to plot the spatial map of trend analysis of the given dataset. <br></div>So I tried the script given below for getting the desired plot but couldn't successed.<br><br></div><div>the given error is <br><b>fatal:regCoef: The rightmost dimension of x must be at least 2<br>fatal:["Execute.c":8567]:Execu<wbr>te: Error occurred at or near line 32 in file trend.ncl<br></b><br> <br></div><div>Could anyone please help me out<br></div><br><br> <br> tmp = a->SWTNTCLR<br> ts = tmp(time|:,lat|:,lon|:) <wbr> ; reorder variable<br><br> delete(tmp) <wbr> ; no longer needed<br><br>;*****************************<wbr>*******************<br>; create x and calculate the regression coefficients (slopes, trends) <br>;*****************************<wbr>*******************<br> time = ts&time ; days since 1850-01-01<br> rc = regCoef(time,ts) <br> <br> rc@long_name = "regression coefficient (trend)"<br> rc@units = ts@units+"/day" <br>; copy_VarCoords(ts(:,:,0), rc) ; copy lat,lon coords<br><br><br>;*****************************<wbr>*******************<br>; plotting parameters <br>;*****************************<wbr>*******************<br> wks = gsn_open_wks("ps" ,"regress") <br> gsn_define_colormap(wks,"ViBlG<wbr>rWhYeOrRe") ; choose colormap<br> <br> res = True <br> res@gsnMaximize = True ; make large<br><br> res@cnFillOn = True ; turn on color<br> res@cnLinesOn = False ; turn off contour lines<br> res@cnLineLabelsOn = False ; turn off contour line labels<br> ;;res@cnFillMode = "RasterFill"<br><br>; res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels<br>; res@cnMinLevelValF = -1.00 ; set min contour level<br>; res@cnMaxLevelValF = 1.00 ; set max contour level<br> res@cnLevelSpacingF = 0.10 ; set contour interval<br>;<br> res@mpFillOn = False ; turn off default background gray<br> ; res@mpCenterLonF = 210<br> <br> res@tiMainString = fili<br> plot = gsn_csm_contour_map_ce(wks,rc,<wbr>res) <br> end<br><br><br> <br><div><div><div><div><br><br><br><br><br></div><div>Regards<span class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838m_-6920874904743519709m_-4635776282400146547HOEnZb"><font color="#888888"><br clear="all"></font></span></div><span class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838m_-6920874904743519709m_-4635776282400146547HOEnZb"><font color="#888888"><div><div><div><div class="m_9116501929336920820m_747290511169588846m_-4619085922763679081m_-2949817932421431838m_-6920874904743519709m_-4635776282400146547m_6420530442664993331gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Kunal Bali<br></div><br><div><br></div><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:tahoma,verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div>
</div></div></font></span></div></div></div></div>
<br></div></div>______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
<br>______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
<br>______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>