c_cssgrid(3NCARG)

πŸ’– c_cssgrid β€” tension spline interpolation on a sphere πŸ’–

okay bestie, welcome to c_cssgrid, a little NCAR Graphics icon from the NCAR GRAPHICS manual. this is the C girlie of the Cssgrid family and she's here to do tension spline interpolation on a sphere. yes she's that girl. let's get into it 🫢


✨ FUNCTION PROTOTYPE ✨

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

🌸 SYNOPSIS 🌸

float *c_cssgrid (n, rlat, rlon, f, ni, nj, plat, plon, ier)

πŸŽ€ DESCRIPTION πŸŽ€

okay so here's what every single one of these lil parameters is doing, no skipping, we go through all of them πŸ’…

  • n β€” the number of input data points, and she requires n > 2. like, she needs at least three, she's not doing math with less.
  • rlat β€” an array holding the latitudes of the input data, in degrees. ⚠️ important: the first three points must not be collinear β€” meaning they can't all lie on a common great circle. don't do that, she will not be happy.
  • rlon β€” an array holding the longitudes of the input data, also in degrees.
  • f β€” the array with your data values. f[i] is the functional value at (rlat[i],rlon[i]) for i = 0 to n-1. literally one-to-one with your input points, slay.
  • ni β€” the number of latitudes in the interpolated grid.
  • nj β€” the number of longitudes in the interpolated grid. and get this, ni and nj can both be 1, which means you can interpolate at a single point. versatile queen πŸŽ€
  • plat β€” an array with the latitudes of the points where you want the interpolated values computed. keep those values in degrees bestie.
  • plon β€” an array of length nj containing the longitudes of the output grid lines. also in degrees, obviously.
  • ier β€” the error return value 🚨. if *ier comes back as 0, then no errors were detected, we're thriving. if *ier is non-zero, go check the error list in cssgrid_errors for the deets.

πŸ’« USAGE πŸ’«

you call c_cssgrid to find an interpolating tension spline for randomly positioned data on a unit sphere. that's the whole vibe. sphere data, random positions, tension spline, done. ✨


πŸ”₯ RETURN VALUE πŸ”₯

c_cssgrid returns a pointer to a linear array of data holding the interpolated values at your user-specified lat/lon pairs. the returned array stores its values as if it were a 2-dimensional C array, with latitude as the first dimension and longitude as the second dimension. periodt.

so if out is declared as

float *out;

and we set:

out = c_cssgrid(n, rlat, rlon, f, nlat, nlon, plat, plon, &ier);

then out[i*nlon+j] is the interpolated function value at coordinate point (plat[i], plon[j]) for 0 <= i < nlat and 0 <= j < nlon. and the space for out? allocated internal to c_cssgrid, and it's nlat * nlon floats in size. she handles the memory, you just vibe. 🫢


🌈 ACCESS 🌈

to use c_cssgrid, load the NCAR Graphics library ngmath. that's it, that's the door code. πŸ”‘


πŸ‘‘ SEE ALSO πŸ‘‘

  • css_overview
  • cssgrid_errors

complete documentation for Cssgrid is available at URL http://ngwww.ucar.edu/ngdoc/ng/ngmath/cssgrid/csshome.html


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 was c_cssgrid from the UNIX manual, dated May 2000, page c_cssgrid(3NCARG). iconic, no cap. go interpolate something pretty 🌸✨