c_csa2s(3NCARG)

πŸ“¦ version 6.6.2, in epel 9, fedora 43, fedora 44

✨ c_csa2s β€” the NCAR GRAPHICS bestie ✨

okay so real talk, this is a page from the NCAR GRAPHICS manuals, and today we're doing c_csa2s(3NCARG) πŸ’–


πŸ’… NAME πŸ’…

c_csa2s β€” cubic spline approximation, simple entry for two-dimensional input, gridded output πŸ¦‹

like... it fits a smooth cubic spline surface through your scattered 2D points and hands you back a grid. simple entry, gridded output, no cap.


🌸 FUNCTION PROTOTYPE 🌸

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

πŸŽ€ SYNOPSIS πŸŽ€

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

✨ DESCRIPTION ✨

okay bestie, let's meet the whole cast 🫢

  • n β€” (integer, input) the number of input data points. it must be that n is greater than 3 and, depending on the size of knots below, n may have to be larger. so like, more than 3 minimum, but honestly check your knots first πŸ‘‘
  • xi β€” (real, input) an array dimensioned for n containing the X coordinate values for the input function.
  • yi β€” (real, input) an array dimensioned for n containing the Y coordinate values for the input function.
  • zi β€” (real, input) an array containing the functional values of the input function β€” zi[k] is the functional value at (xi[k], yi[k]) for k=0,n-1. yes, exactly that indexing, don't fight it πŸ’œ
  • knots β€” (integer, input) the number of knots to be used in each coordinate direction in constructing the approximation spline. knots[0] and knots[1] must be at least 4. the larger the value for knots, the closer the approximated curve will come to passing through the input function values. so bigger knots = snugger fit, periodt πŸ”₯
  • no β€” (integer, input) the number of X coordinate values to be calculated for the output surface.
  • mo β€” (integer, input) the number of Y coordinate values to be calculated for the output surface.
  • xo β€” (real, input) an array dimensioned for no containing the X coordinates of the output grid.
  • yo β€” (real, output) an array dimensioned for mo containing the Y coordinates of the output grid. (yes bestie, it says output here, we are reading it exactly as written, no notes πŸ™ˆ)
  • ier β€” (pointer to integer, output) an error return value. if *ier comes back as 0, then no errors were detected. if *ier is non-zero, then go look at the error list in the error table for the deets. lowkey always check it πŸ’€

🌈 USAGE 🌈

so you call c_csa2s when you want to find an approximating cubic spline surface for two-dimensional input data. it's giving "I just want the surface, please" ✨

but heads up: if you want to weight the input data values, calculate derivatives, or handle data sparse areas specially, then you will need to use c_csa2xs instead. c_csa2s is the simple entry β€” it's not doing all that, and that's on purpose πŸ’…

here's the cute part. c_csa2s returns a pointer to a linear array of data that is the approximated grid stored in row-major order. that is, if out is declared as

float *out;

and we set:

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

then out[i*mo+j] is the approximated function value at coordinate point (xo[i], yo[j]) for 0 <= i < no and 0 <= j < mo. πŸ“

the space for out is allocated internal to c_csa2s and is no * mo floats in size. iconic allocation behaviour, we love to see it πŸ‘‘


🧚 ACCESS 🧚

to use c_csa2s, load the NCAR Graphics library ngmath.

that's it. that's the whole vibe check. 🌸


πŸ¦‹ SEE ALSO πŸ¦‹

  • csagrid
  • c_csa2xs
  • c_csa2ls
  • c_csa2lxs

complete documentation for Csagrid is available at URL http://ngwww.ucar.edu/ngdoc/ng/ngmath/csagrid/csahome.html β€” go read it, it's the source material fr fr πŸ’–


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!! πŸ’œ this one shipped as part of the NCAR GRAPHICS manual, dated January 1999, and you'll find it filed under the manual name c_csa2s(3NCARG) on a good old UNIX system. go make some surfaces, you've got this πŸŽ€βœ¨πŸ«Ά

πŸ“¦ where this page comes from