[ncl-talk] regCoef_n without y-axis intercept
Giorgio Graffino
g.graffino at tim.it
Wed Oct 26 03:09:17 MDT 2022
Hi Dave,
Thanks for confirming that. I'm changing the fortran subroutine Dennis
sent last week into a function, but it keeps giving me an error wherever
I try to use arrays as arguments. It only works when X and Y are scalar
numbers. I really don't understand how a linear regression fit can be
found with scalar numbers as arguments. I'm looking at the C interface
to see how to subroutine is called, but there are too many things
happening in regcoefW.c and it's difficult to understand the workflow.
Can anyone please help me understand how to make the fortran subroutine
work for 1d and 2d arrays?
Cheers,
Giorgio
------ Messaggio Originale ------
Da: dave.allured at noaa.gov
A: g.graffino at tim.it
Cc: ncl-talk at ucar.edu
Inviato: lunedì 24 ottobre 2022 22:10
Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept
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.
There are two different methods for calling external C functions:
fortran wrapper, and shared object. Please study the WRAPIT
documentation carefully.
On Mon, Oct 24, 2022 at 1:35 PM Giorgio Graffino via ncl-talk
<ncl-talk at mailman.ucar.edu <mailto:ncl-talk at mailman.ucar.edu> > wrote:
Hello,
I'm doing some modifications to the 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 fortran subroutine is different than in regCoef_n,
so the subroutine is probably going through some more steps, possibly
involving this script
(https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c
<https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c> ).
Am I right?
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?
I need help please.
Giorgio
------ Messaggio Originale ------
Da: ncl-talk at mailman.ucar.edu <mailto:ncl-talk at mailman.ucar.edu>
A: shea at ucar.edu <mailto:shea at ucar.edu>
Cc: ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
Inviato: venerdì 21 ottobre 2022 13:14
Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept
Hi Dennis, Dave
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?
Cheers,
Giorgio
------ Messaggio Originale ------
Da: shea at ucar.edu <mailto:shea at ucar.edu>
A: g.graffino at tim.it <mailto:g.graffino at tim.it>
Cc: dave.allured at noaa.gov <mailto:dave.allured at noaa.gov> ;
ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
Inviato: giovedì 20 ottobre 2022 19:17
Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept
The f77 code is attached.
On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk
<ncl-talk at mailman.ucar.edu <mailto:ncl-talk at mailman.ucar.edu> > wrote:
Hi Dave,
Thanks for the advice. I looked at the examples in
https://www.ncl.ucar.edu/Applications/regress.shtml
<https://www.ncl.ucar.edu/Applications/regress.shtml> , 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.
Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please
point me where it is?
Cheers,
Giorgio
------ Messaggio Originale ------
Da: dave.allured at noaa.gov <mailto:dave.allured at noaa.gov>
A: g.graffino at tim.it <mailto:g.graffino at tim.it>
Cc: ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
Inviato: giovedì 13 ottobre 2022 18:47
Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept
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.
https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html
<https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html>
On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk
<ncl-talk at mailman.ucar.edu <mailto:ncl-talk at mailman.ucar.edu> > wrote:
Hi NCL community,
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?
Can you also please tell me where I can find the function? I did a grep
recursive search in my $NCARG_ROOT directory but I couldn't find it.
Cheers,
Giorgio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20221026/602e1cc4/attachment.htm>
More information about the ncl-talk
mailing list