c_css2cd(3NCARG)
π c_css2cd β the NCAR Graphics girlie's guide to turning lat/lon into XYZ π
okay bestie, welcome to the c_css2cd page from the NCAR GRAPHICS manual (3NCARG, if we're being official about it). she's a C function, she's double precision, and she is so ready to convert your latitude/longitude coordinates into Cartesian ones. let's get into it β¨
β¨ NAME β¨
c_css2cd β convert from lat/lon coordinates to Cartesian coordinates. that's it, that's the job, and she does it flawlessly π
π«Ά FUNCTION PROTOTYPE π«Ά
void c_css2cd(int, double *, double *, double *, double *, double *);
look at her. six args. zero drama. iconic.
π SYNOPSIS π
c_css2cd(n, rlat, rlon, x, y, z);
πΈ DESCRIPTION πΈ
here's the tea on every single argument, no skipping, no summarizing, we respect the lore:
nβ the number of input lat/lon coordinates. like, how many are we converting today bestie?rlatβ an array holding the latitudes of the input coordinates, in degrees.rlonβ an array holding the longitudes of the input coordinates, in degrees. yes, also degrees. both of them. degrees degrees.xβ an array holding the X component of the Cartesian coordinates of the output data. and the way that(x[i],y[i],z[i])is the Cartesian coordinate corresponding to the lat/lon coordinate(rlat[i],rlon[i])fori=0ton-1?? obsessed. literally the whole mapping in one line π¦yβ an array holding the Y component of the Cartesian coordinates of the output data. and again,(x[i],y[i],z[i])is the Cartesian coordinate corresponding to the lat/lon coordinate(rlat[i],rlon[i])fori=0ton-1. same energy, different axis πzβ an array holding the Z component of the Cartesian coordinates of the output data. and fr fr,(x[i],y[i],z[i])is the Cartesian coordinate corresponding to the lat/lon coordinate(rlat[i],rlon[i])fori=0ton-1. three for three, she ate π₯
π USAGE π
so when do you call her? you call c_css2cd when you need the equivalent Cartesian coordinates on a unit sphere for some latitude and longitude coordinates you already have. unit sphere. not a big sphere, not a small sphere, the unit sphere. periodt.
the vibe check you need to remember: the coordinate of 0. latitude and 0. longitude converts to Cartesian coordinate (1.,0.,0.). that's the anchor point, that's the home base, don't forget it π
latitudes and longitudes are assumed to be in degrees (saying it again because it matters, iykyk).
and the little flex: c_css2cd is a double precision version of c_css2c. so if you wanted the single-precision one, that's a different girl. we're precision girlies over here β¨
β RETURN VALUE β
c_css2cd does not return a value. she gives you everything through x, y, and z and asks for nothing back. main character energy honestly π
π ACCESS π
to use c_css2cd, load the NCAR Graphics library ngmath. that's the one. don't forget it or she simply will not be there for you π
π₯ SEE ALSO π₯
go read these too, they're all in the family:
css_overviewc_cssgridc_csc2sd
and if you want the full deep dive, complete documentation for Cssgrid lives at this URL:
http://ngwww.ucar.edu/ngdoc/ng/ngmath/cssgrid/csshome.html
π COPYRIGHT π
Copyright (C) 2000
University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.
so yeah, it's theirs, and using it means you're playing by the License Agreement. read it, bestie, fr fr π
reminder: degrees, unit sphere, (1.,0.,0.) at zero-zero. that's the whole personality. slay.
and that's a wrap on this page from NCAR Graphics β UNIX, MAY 2000 edition π stay precise, stay double, and go convert some coordinates π¦β¨
π¦ 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