<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello,<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm working on a similar situation. Is there a way for NCL to take this nc file output and call it back into the script to get the R^2 value to plot it directly onto a plot? I have the script to plot text, but do not know how to refer to the "R^2" for NCL to
 feed it in.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Jason<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> ncl-talk <ncl-talk-bounces@mailman.ucar.edu> on behalf of Xueyan Zhang via ncl-talk <ncl-talk@mailman.ucar.edu><br>
<b>Sent:</b> Saturday, October 24, 2020 3:15 PM<br>
<b>To:</b> Dennis Shea <shea@ucar.edu><br>
<b>Cc:</b> NCL-talk <ncl-talk@ucar.edu><br>
<b>Subject:</b> Re: [ncl-talk] How to save print information for reg_multlin_stats</font>
<div> </div>
</div>
<div>
<div dir="ltr">It works! Thank you!
<div><br>
</div>
<div>Xueyan</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Sat, Oct 24, 2020 at 6:33 AM Dennis Shea <<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div>NCL variables are data structures (data objects) that mimic netCDF variables. Using Example 1 of
<a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/reg_multlin_stats.shtml" target="_blank">
<b>http://www.ncl.ucar.edu/Document/Functions/Contributed/reg_multlin_stats.shtml</b></a></div>
<div><br>
</div>
<div>   :</div>
<div>   :</div>
<div>   print(b)<br>
<br>
; Create netCDF file <br>
<br>
   diro = "./"<br>
   filo = "<a href="http://mult_reg.nc" target="_blank">mult_reg.nc</a>"<br>
   ptho = diro + filo<br>
   <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml" target="_blank"><b>system</b></a>("/bin/rm -f "+ ptho )    ; remove any previous file<br>
<br>
   b!0  = "N"                      ; N=np+1<br>
   b@information = "y-intercept; partial regression coefficients associated with each independent variable"<br>
   b@long_name   = "Partial Regression Coefficients"<br>
   delete(b@_FillValue)            ; not appropriate<br>
<br>
   fo   =<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml" target="_blank"><b> addfile</b></a>(ptho,"<b>c</b>")<br>
   fo->B= b                              ; NCL will write all components of the netCDF variable</div>
<div>===================</div>
<div><br>
</div>
<div>You can examine the file's contents via:</div>
<div><br>
</div>
<div>  %> <b>ncdump</b> -v B  <a href="http://mult_reg.nc" target="_blank">mult_reg.nc</a></div>
<div><br>
</div>
<div>or <br>
</div>
<div><br>
</div>
<div>  %> <b>ncl_filedump</b> <a href="http://mult_reg.nc" target="_blank">mult_reg.nc</a></div>
<div><br>
</div>
<div>====================</div>
<div><br>
</div>
<div> %> <b>ncdump</b> -v B <a href="http://mult_reg.nc" target="_blank">mult_reg.nc</a></div>
<div><br>
</div>
<div>netcdf mult_reg {<br>
dimensions:<br>
N = 3 ;<br>
variables:<br>
float B(N) ;<br>
B:information = "y-intercept; partial regression coefficients associated with each independent variable" ;<br>
B:long_name = "Partial Regression Coefficients" ;<br>
B:model = "Yest = b(0) + b(1)*X1 + b(2)*X2 + ...+b(M)*XM" ;<br>
B:N = 17 ;<br>
B:NP = 2 ;<br>
B:M = 3 ;<br>
B:bstd = 0.f, 0.5029772f, 0.4922954f ;<br>
B:SST = 13239.72f ;<br>
B:SSE = 423.3723f ;<br>
B:SSR = 12816.36f ;<br>
B:MST = 827.4825f ;<br>
B:MSE = 30.24088f ;<br>
B:MSE_dof = 14 ;<br>
B:MSR = 6408.178f ;<br>
B:RSE = 5.499171f ;<br>
B:RSE_dof = 13 ;<br>
B:F = 211.9045f ;<br>
B:F_dof = 2, 14 ;<br>
B:F_pval = 3.419033e-11f ;<br>
B:r2 = 0.9680232f ;<br>
B:r = 0.9838817f ;<br>
B:r2a = 0.9634551f ;<br>
B:fuv = 0.03197682f ;<br>
B:Yest = 249.9873f, 254.2619f, 257.2977f, 260.4574f, 266.3423f, 271.423f, 274.3349f, 279.6005f, 284.0294f, 285.7331f, 297.3181f, 300.1061f, 310.5743f, 314.0123f, 322.4051f, 334.5465f, 340.3705f ;<br>
B:Yavg = 288.4f ;<br>
B:Ystd = 28.766f ;<br>
B:Xavg = 55.35294f, 30.9f ;<br>
B:Xstd = 11.68028f, 1.172071f ;<br>
B:stderr = 100.8641f, 0.3945341f, 3.931675f ;<br>
B:tval = -1.521964f, 3.139713f, 3.073079f ;<br>
B:pval = 0.1488179f, 0.006746806f, 0.007730724f ;<br>
data:<br>
<br>
 B = -153.5115, 1.238724, 12.08235 ;</div>
<div>}<br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Fri, Oct 23, 2020 at 9:21 PM Xueyan Zhang via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div dir="ltr">Hello all,
<div><br>
</div>
<div>I am doing multiple variable linear regression following this page: <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/reg_multlin_stats.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Contributed/reg_multlin_stats.shtml</a>.</div>
<div><br>
</div>
<div>How can I save R2 to a file? Also, how can I save information about which variable is significant?</div>
<div><br>
</div>
<div>Thanks!</div>
<div><br>
</div>
<div>Xueyan</div>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
</div>
</blockquote>
</div>
</div>
</body>
</html>