c_dsgrid2s(3NCARG)
π c_dsgrid2s β bestie, it's the main character of 2D gridding π
okay so real talk, this is the primary single precision C entry for 2D gridding, and she's from the NCAR GRAPHICS family (3NCARG manual, iykyk). if you're in C and you want gridded data out of scattered points, this function is literally your girl. πΈ
β¨ FUNCTION PROTOTYPE β¨
float *c_dsgrid2s(int, float [], float [], float [],
int, int, float [], float [], int *);
she takes nine args and hands you back a float *. no cap. π
π¦ SYNOPSIS π¦
float *c_dsgrid2s(int n, float x[], float y[], float z[],
int nx, int ny, float xo[], float yo[], int *ier);
likeβ¦ that's the whole vibe. n, x, y, z, nx, ny, xo, yo, ier. periodt. π
π DESCRIPTION π
okay so here's the tea on every single argument, and I mean every one, no skipping:
nβ the number of input data points you're bringing to the party. πxβ an array holding the X coordinates of your input data points.yβ an array holding the Y coordinates of your input data points.zβ an array of sizenwith the functional values of the input data points. so like,z[m]is the value of the input function at coordinate(x[m],y[m]), for0 <= m < n. got it? got it. πnxβ the number of X values in the output grid. that's how many columns of glow-up you're getting.nyβ the number of Y values in the output grid. the rows, bestie.xoβ an array of sizenxwith the X coordinates of the output data grid. π«Ά the values inxomust be increasing, but they do NOT need to be equally spaced. she's flexible like that.yoβ an array of sizenywith the y coordinates of the output data grid. same rules: the values inyomust be increasing, but need not be equally spaced. β¨ierβ the error return value. if*iercomes back as0, then no errors were detected, slay. if*ieris non-zero, then go read the man page fordsgrid_errors. don't ignore her, she's telling you something. π
π₯ USAGE π₯
so c_dsgrid2s returns a pointer to a linear array of data that is the interpolated grid, stored in row-major order. iconic behaviour honestly.
like, if out is declared as
float *out;
and we set:
out = c_dsgrid2s(n, x, y, z, nx, ny, xo, yo, ier);
then out[i*ny+j] is the interpolated function value at coordinate point (xo[i],yo[j]) for 0 <= i < nx and 0 <= j < ny. that's the indexing, memorize it, it WILL come up. π
and the space for out? allocated internal to c_dsgrid2s and it's nx*ny floats in size. so don't go freeing it yourself unless you know what you're doing, bestie. π
π ACCESS π
to use c_dsgrid2s, load the NCAR Graphics library ngmath. that's it, that's the whole requirement. π«
β SEE ALSO β
go read these too, they're all in the group chat:
dsgriddsgrid_paramsc_dssetic_dsgetic_dssetrc_dsgetrc_dssetcc_dsgetc
and if you want the full lore, complete documentation for Dsgrid is available at URL http://ngwww.ucar.edu/ngdoc/ng/ngmath/dsgrid/dshome.html π§
π COPYRIGHT π
Copyright (C) 2000 University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.
fr fr, read the license, don't be that person. π
and that's the whole page, bestie!! this came out of the UNIX manual, dated September 1997-1998 β yeah she's a vintage icon, an elder stateswoman of gridding, and she still ate. mwah. ππβ¨π¦πΈ
π¦ where this page comes from
- debian bookworm: libncarg-dev 6.6.2.dfsg.1-1
- debian trixie: libncarg-dev 6.6.2.dfsg.1-10+b2
- ubuntu jammy: libncarg-dev 6.6.2-10build2
- ubuntu questing: libncarg-dev 6.6.2.dfsg.1-10build2
- ubuntu resolute: libncarg-dev 6.6.2.dfsg.1-12
- ubuntu stonking: libncarg-dev 6.6.2.dfsg.1-12build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms