c_dsgrid3s(3NCARG)

πŸ’– c_dsgrid3s β€” the 3D gridding bestie πŸ’–

okay so real talk, this is a page from the NCAR GRAPHICS manual, and today we're getting into c_dsgrid3s β€” the primary single precision C entry for 3D gridding. she's the main character of 3D grids, no cap. πŸ¦‹


✨ NAME ✨

c_dsgrid3s β€” primary single precision C entry for 3D gridding

πŸ“œ FUNCTION PROTOTYPE πŸ“œ

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

πŸŽ€ SYNOPSIS πŸŽ€

float  *c_dsgrid3s(int n, float x[], float y[], float z[],
          float u[], int nx, int ny, int nz, float xo[],
          float yo[], float zo[], int *ier);

πŸ’… DESCRIPTION πŸ’…

okay bestie, here's the whole cast of characters, one by one. every single one matters. 🫢

  • n β€” the number of input data points. like, how many little guys you're feeding her.
  • x β€” an array holding the X coordinates of the input data points.
  • y β€” an array holding the Y coordinates of the input data points.
  • z β€” an array holding the Z coordinates of the input data points.
  • u β€” an array of size n holding the functional values of the input data points. That is, z[m] is the value of the input function at coordinate (x[m],y[m],z[m]), for 0 <= m < n.
  • nx β€” the number of X values in the output grid.
  • ny β€” the number of Y values in the output grid.
  • nz β€” the number of Z values in the output grid.
  • xo β€” an array of size nx holding the X coordinates of the output data grid. the values in xo must be increasing, but they don't have to be equally spaced, periodt.
  • yo β€” an array of size ny holding the Y coordinates of the output data grid. the values in yo must be increasing, but need not be equally spaced. same energy. ✨
  • zo β€” an array of size nz holding the Z coordinates of the output data grid. the values in zo must be increasing, but need not be equally spaced. she's consistent like that. πŸ’…
  • ier β€” the error return value. if *ier comes back as 0, then no errors were detected, we ate and left no crumbs. if *ier is non-zero, then run, don't walk, to the man page for dsgrid_errors. 😭

πŸ”₯ USAGE πŸ”₯

c_dsgrid3s returns a pointer to a linear array of data β€” that's your interpolated grid, stored in row-major order. so if out is declared as:

float *out;

and we set:

out = *c_dsgrid3s(n, x, y, z, u, nx, ny, nz,
          xo, yo, zo, ier);

then out[nz*ny*i + nz*j + k] is the interpolated function value at coordinate point (xo[i],yo[j],zo[k]) for 0 <= i < nx, 0 <= j < ny, and 0 <= k < nz. the space for out is allocated internal to c_dsgrid3s and is nx*ny*nz floats in size. she handles it. you don't gotta. πŸ‘‘

okay but fr, that indexing math is the whole vibe check of this function β€” nz*ny*i + nz*j + k. memorize her. iykyk. πŸ’€

🌈 ACCESS 🌈

to use c_dsgrid3s, load the NCAR Graphics library ngmath. that's it, that's the door code. πŸšͺ✨


πŸ’œ SEE ALSO πŸ’œ

  • dsgrid
  • dsgrid_params
  • c_dsseti
  • c_dsgeti
  • c_dssetr
  • c_dsgetr
  • c_dssetc
  • c_dsgetc

complete documentation for Dsgrid is available at URL http://ngwww.ucar.edu/ngdoc/ng/ngmath/dsgrid/dshome.html β€” go read her, she's iconic. πŸ“–


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 came from the UNIX manual, dated September 1997-1998, and she's filed under c_dsgrid3s(3NCARG) β€” go forth and grid in 3D, you absolute legend. slay. πŸ’–βœ¨πŸ¦‹πŸŒΈπŸ’