<div dir="ltr">Giorgio, you are right, regcoefW.c is an NCL internal interface routine for regCoef_n. But it uses a different protocol than a WRAPIT interfaced function. Just ignore regcoefW.c, and follow the WRAPIT fortran instructions carefully, for your new function. Change the function name, and do not attempt to replace the built-in regCoef_n function. You can change the arguments as you like, but follow the documented WRAPIT rules.<div><br><div>There are two different methods for calling external C functions: fortran wrapper, and shared object. Please study the WRAPIT documentation carefully.<div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 24, 2022 at 1:35 PM Giorgio Graffino via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="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><span style="font-size:12pt;font-family:Arial">Hello,</span></div><p><span style="font-size:12pt;font-family:Arial">I'm doing some modifications to the <span style="font-family:Arial;font-size:12pt">regcoef_dp.f file to consider a zero y-intercept, but now I don't know how to try it in a script. The number of arguments in the </span></span>fortran <span style="font-size:12pt;font-family:Arial"><span style="font-family:Arial;font-size:12pt">subroutine is different than in regCoef_n, so the subroutine is probably going through some more steps, possibly involving this script (</span></span><span style="font-family:Arial;font-size:12pt"><a href="https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c" target="_blank">https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c</a></span><span style="font-family:Arial;font-size:12pt">). Am I right?</span></p><div><p><span style="font-family:Arial;font-size:12pt">How can I incorporate both fortran and C scripts in my NCL script? I know I can use WRAPIT to read external fortran code, but what about C code?</span></p><p style="font-size:12pt;font-family:Arial"><span style="font-size:12pt">I need help please.</span></p><p style="font-size:12pt;font-family:Arial"><span style="font-family:Arial;font-size:12pt">Giorgio</span></p><blockquote> <br> ------ Messaggio Originale ------<br> Da: <a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br> A: <a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a><br>Cc: <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br> Inviato: venerdì 21 ottobre 2022 13:14<br> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept<br> <br> Hi Dennis, Dave<div style="font-size:12pt;font-family:Arial"><p style="font-size:12pt;font-family:Arial">Thanks for sending the relevant function and for explaining how to access the source code. Now I'm thinking how to make the function to force the regression to pass from origin. Any idea on how to do that?</p><p style="font-size:12pt;font-family:Arial">Cheers,</p><p style="font-size:12pt;font-family:Arial">Giorgio</p> <blockquote><br>------ Messaggio Originale ------<br> Da: <a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a><br> A: <a href="mailto:g.graffino@tim.it" target="_blank">g.graffino@tim.it</a><br>Cc: <a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>; <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br> Inviato: giovedì 20 ottobre 2022 19:17<br> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept<br> <br> <div dir="ltr">The f77 code is attached.<div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="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><font style="font-size:12pt;font-family:Arial" face="Arial">Hi Dave,</font></div><div style="font-size:12pt;font-family:Arial"><p><font style="font-size:12pt;font-family:Arial" face="Arial">Thanks for the advice. I looked at the examples in </font><span style="font-family:Arial;font-size:12pt"><a href="https://www.ncl.ucar.edu/Applications/regress.shtml" target="_blank">https://www.ncl.ucar.edu/Applications/regress.shtml</a>, especially examples 2 and 4, but I couldn't find any supplementary information about regCoef. I also can't find anything under $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. </span></p><p style="font-size:12pt;font-family:Arial"><span style="font-family:Arial;font-size:12pt">Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please point me where it is?</span></p><p style="font-size:12pt;font-family:Arial"><span style="font-size:12pt">Cheers,</span><br></p><p style="font-size:12pt;font-family:Arial"><span style="font-family:Arial;font-size:12pt">Giorgio</span><br></p></div> <blockquote><br>------ Messaggio Originale ------<br> Da: <a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a><br> A: <a href="mailto:g.graffino@tim.it" target="_blank">g.graffino@tim.it</a><br>Cc: <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br> Inviato: giovedì 13 ottobre 2022 18:47<br> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept<br> <br> <div dir="ltr"><div dir="ltr">Giorgio, for your second question, please see this very brief description that I recently wrote, for how to search for functions in the NCL source code.<div><a href="https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html" target="_blank">https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html</a></div></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="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"><p style="font-size:12pt;font-family:Arial">Hi NCL community,</p><p style="font-size:12pt;font-family:Arial">I want regCoef_n to find the regression coefficient between two arrays without y-axis intercept. Do you know how I can change the function to do that?</p><p style="font-size:12pt;font-family:Arial">Can you also please tell me where I can find the function? I did a grep recursive search in my <span style="font-family:arial,sans-serif;font-size:12pt">$NCARG_ROOT directory but I couldn't find it.</span></p><p style="font-size:12pt;font-family:Arial"><span style="font-family:arial,sans-serif;font-size:12pt">Cheers,</span></p><p style="font-size:12pt;font-family:Arial"><span style="font-family:arial,sans-serif;font-size:12pt">Giorgio</span></p></blockquote></div></div></blockquote></blockquote></div></blockquote></div></blockquote></div>
</blockquote></div></div></div></div></div>