c_natgrids(3NCARG)

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

πŸ’– NAME πŸ’–

c_natgrids β€” the main character C entry point for natural neighbor gridding ✨

So basically, bestie, this is the NCAR Graphics function you call when you wanna grid some scattered data points. No cap.


🧚 FUNCTION PROTOTYPE 🧚

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

πŸŽ€ SYNOPSIS πŸŽ€

float *c_natgrids (npnts, x, y, z, numxout, numyout, xi, yi, ier);

🌸 DESCRIPTION 🌸

Okay so here's the tea on every single argument, and yes we're going through all of them, no skipping:

  • npnts β€” the number of input data points you're feeding in. Heads up though: npnts > 3. You need more than three, that's the rule, it's giving non-negotiable. πŸ’…
  • x β€” an array holding all the x coordinates of your input data points.
  • y β€” an array holding all the y coordinates of your input data points.
  • z β€” an array holding the functional values of your input data points. Translation: z[m] is the value of the input function at coordinate (x[m],y[m]), for 0 <= m < npnts. She's the vibe of the data, fr fr.
  • numxout β€” how many x values live in your output grid.
  • numyout β€” how many y values live in your output grid.
  • xi β€” an array of dimension numxout containing the x coordinates of the output data grid. The values in xi must be increasing, but they do not need to be equally spaced. Lowkey flexible, highkey ordered. ✨
  • yi β€” an array of dimension numyout containing the y coordinates of the output data grid. The values in yi must be increasing, but need not be equally spaced. Same energy as xi, just the y-flavored twin. πŸ¦‹
  • ier β€” the error value, aka the vibe check. If *ier comes back as 0, then no errors were detected, slay. If *ier is non-zero, go read the man page for natgrid_errors for the details. πŸ‘‘

🌈 USAGE 🌈

c_natgrids returns a pointer to a linear array of data, and that array is your interpolated grid, stored in row-major order. Periodt.

So say you declare out like this:

float *out;

and then you set:

out = c_natgrids(numin, x, y, z, numxout, numyout, xo, yo, &ier);

then out[i*numyout+j] is the interpolated function value at coordinate point (xo[i],yo[j]) for 0 <= i < numxout and 0 <= j < numyout. 🫢

And the space for out? That gets allocated internally to c_natgrids, and it's numxout*numyout floats in size. She handles her own memory, iconic behavior honestly. πŸ’–


πŸ”₯ ACCESS πŸ”₯

To use c_natgrids, load the NCAR Graphics library ngmath. That's the whole assignment, bestie. πŸ“š


⭐ SEE ALSO ⭐

Go read these too, they're all in the same friend group:

  • natgrid
  • natgrid_params
  • c_nnseti
  • c_nngeti
  • c_nnsetr
  • c_nngetr
  • c_nnsetc
  • c_nngetc

Also! Complete documentation for Natgrid is available at this URL, go tap in:

http://ngwww.ucar.edu/ngdoc/ng/ngmath/natgrid/nnhome.html

Copyright (C) 2000 University Corporation for Atmospheric Research

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

Okay so legal girlies, read the license agreement, it's literally the rules of the house. πŸ™ˆ

And that's a wrap on the c_natgrids(3NCARG) page from the NCAR GRAPHICS manual, UNIX flavor, dated March 1997-1998. Thanks for coming to my TED talk, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from