c_csa2ls(3NCARG)

πŸ’– c_csa2ls β€” cubic spline approximation, simple entry for two-dimensional input, list output πŸ’–

okay bestie, listen up. this is c_csa2ls, and it lives in the NCAR GRAPHICS manual (section 3NCARG). it's the simple entry point for fitting an approximating cubic spline to 2-D scattered data and then asking it for values at a whole list of coordinates. the whole vibe is "give me your points, i'll give you a spline, and i'll hand back a pointer to the answers." no cap. πŸ¦‹


✨ FUNCTION PROTOTYPE ✨

float *c_csa2ls(int, float [], float [], float [], int [],
                int, float [], float [], int *);

✨ SYNOPSIS ✨

int c_csa2ls(int n, float xi[], float yi[], float zi[], int knots[2],
            int no, float xo[], float yo[], int *ier);

🌸 DESCRIPTION 🌸

here's the full tea on every single argument, and i mean every one, because we do not skip. πŸ’…

  • n β€” (integer, input) how many input data points you've got. it must be that n is greater than 3, and depending on the size of knots down below, n may have to be larger. so like, check yourself before you wreck yourself. 🫢
  • xi β€” (real, input) an array dimensioned for n holding the X coordinate values of your input function.
  • yi β€” (real, input) an array dimensioned for n holding the Y coordinate values of your input function.
  • zi β€” (real, input) an array holding the functional values of the input function β€” meaning zi[k] is the functional value at (xi[k], yi[k]) for k=0,n-1. yes bestie, it's a 1-D array doing 2-D duty. iconic. πŸ‘‘
  • knots β€” (integer, input) how many knots to use when building the approximation spline. knots[0] and knots[1] must be at least 4. and here's the trade-off: the larger the value for knots, the closer the approximated curve will come to passing through the input function values. more knots = more clingy, basically.
  • no β€” (integer, input) the number of X - Y coordinate values to be calculated for the output array.
  • xo β€” (real, input) an array dimensioned for no containing the X coordinates of the output list.
  • yo β€” (real, output) an array dimensioned for no containing the Y coordinates of the output list.
  • ier β€” (pointer to integer, output) the error return value. if *ier comes back as 0, then no errors were detected β€” slay. if *ier is non-zero, then refer to the error list in the error table for details. 🚨

πŸ”₯ USAGE πŸ”₯

c_csa2ls is called to find values of an approximating cubic spline at specified two-dimensional coordinates. that's the whole job. πŸ’–

but real talk β€” if you want to weight the input data values, calculate derivatives, or handle data sparse areas specially, then you will need to use c_csa2lxs instead. this one is the simple entry, remember? she's not doing all that. πŸ™ˆ

c_csa2ls returns a pointer to a linear array of data that contains the approximated values calculated at the input list of coordinate values. that is, if out is declared as

float *out;

and we set:

out = c_csa2ls(n, x, y, z, knots, no, xo, yo, &ier);

then out[i] is the approximated function value at coordinate point (xo[i], yo[i]) for 0 <= i < no. ✨ and the space for out is allocated internal to c_csa2ls and is no floats in size. so don't you dare free it, bestie, she handles her own business. πŸ’…


πŸŽ€ ACCESS πŸŽ€

to use c_csa2ls, load the NCAR Graphics library ngmath. that's it, that's the access. 🌈


πŸ‘‘ SEE ALSO πŸ‘‘

  • csagrid
  • c_csa2s
  • c_csa2xs
  • c_csa2lxs

complete documentation for Csagrid is available at URL http://ngwww.ucar.edu/ngdoc/ng/ngmath/csagrid/csahome.html β€” go read it, iykyk. πŸ“š


Copyright (C) 2000 University Corporation for Atmospheric Research

the use of this Software is governed by a License Agreement.


and that's the whole page, bestie. c_csa2ls really said "simple entry, no thoughts, just splines." 🧚

mwah πŸ’‹ this was brought to you by the UNIX manual, January 1999, NCAR GRAPHICS edition β€” vintage but still eating. ⭐