KUPY(3NCARG)

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

πŸ’– KUPY πŸ’– β€” the NCAR Graphics coordinate-converter girlies (3NCARG) πŸ¦‹

okay bestie, listen UP, because this is the glow-up of KUPY from the NCAR Graphics fam, and honestly? It's a whole set of functions that take a coordinate from one NCAR Graphics coordinate system and yeet it into another. Iconic behavior. The full roster of these functions is, and I am literally reading the guest list: CFUX, CFUY, CMFX, CMFY, CMUX, CMUY, CPFX, CPFY, CPUX, CPUY, CUFX, CUFY, KFMX, KFMY, KFPX, KFPY, KMPX, KMPY, KPMX, KPMY, KUMX, KUMY, KUPX, and KUPY. Yes, KUPY is one of them, she's the main character here, but she does NOT ride alone. πŸ’…


🚨 STATUS 🚨 (the tea, and it's lukewarm at best)

Plotter Address Units (PAUs) and Metacode Units (MUs) are no longer used in NCAR Graphics, periodt. So literally every function that has an M or a P as the second or third letter of its name? Considered obsolete. Not cancelled exactly, but like… retired. πŸ™ˆ

The coordinate systems that ARE still recognized right now:

  • GKS world coordinates
  • GKS normalized device coordinates
  • NCAR Graphics fractional coordinates
  • NCAR Graphics user coordinates

If you want the full lore on those, go read the NCAR Graphics document "NCAR Graphics Fundamentals, UNIX Version". It's giving textbook but it's the source of truth, ngl.

Now, because y'all might still need to read or convert old codes that use PAUs or MUs, here are the definitions, preserved like a museum exhibit: πŸ›οΈ

The plotter coordinates of a point are integers IPX and IPY, where IPX is between 1 and 2**MX and IPY is between 1 and 2**MY. MX and MY are internal parameters of SPPS, and each one has a default value of 10. You can set values of MX and MY by calling the routines SETI or SETUSV, and you can get them back by calling the routines GETSI or GETUSV. Slay, parameters are configurable.

The metacode coordinates of a point are integers IMX and IMY between 0 and 32767 inclusive. The area addressed is a square in a "metacode space" that is usually mapped into a square subset of the addressable area of the plotting device. Metacode coordinates were used in calls to the routine PLOTIT and are returned in calls to FL2INT. History lesson over, you're welcome. πŸŽ€


✨ SYNOPSIS ✨

Current (the ones you actually want, bestie):

X = CFUX (RX),  Y = CFUY(RY)
X = CUFX (RX),  Y = CUFY(RY)

Obsolete (respectfully, they're in the retirement home):

X = CMUX (IX),  Y = CMUY(IY)
X = CPUX (IX),  Y = CPUY(IY)
X = CMFX (IX),  Y = CMFY(IY)
X = CPFX (IX),  Y = CPFY(IY)
I = KFMX (RX),  J = KFMY(RY)
I = KUMX (RX),  J = KUMY(RY)
I = KFPX (RX),  J = KFPY(RY)
I = KUPX (RX),  J = KUPY(RY)
I = KPMX (IX),  J = KPMY(IY)
I = KMPX (IX),  J = KMPY(IY)

🌈 C-BINDING SYNOPSIS 🌈

#include <ncarg/ncargC.h>

float c_cfux (float rx)

float c_cfuy (float ry)

float c_cufx (float rx)

float c_cufy (float ry)

Look at the C girlies showing up. Obsessed. 🫢


πŸ’œ DESCRIPTION πŸ’œ

Here's the decoder ring, because the function names are literally spelling out a whole story:

  • RX β€” an input expression of type REAL, and it's an X coordinate in the coordinate system specified by the second letter of the function name. So in a reference to CFUX, RX is a fractional X coordinate; in a reference to CUFX, RX is a user X coordinate. Two moods, one parameter. πŸ’«
  • RY β€” an input expression of type REAL, and it's a Y coordinate in the coordinate system specified by the second letter of the function name. In a reference to CFUY, RY is a fractional Y coordinate; in a reference to CUFY, RY is a user Y coordinate.
  • IX and IY β€” these only show up as arguments in references to some of the obsolete functions. They represent input expressions of type INTEGER, specifying the X and Y coordinates of a point in either PAUs or MUs (which one depends on the second letter of the function name, obviously).

Now the naming scheme, because it's actually so clever and nobody talks about it enough:

  • The first letter of the function name is a C if the result is of type REAL, and a K if the result is of type INTEGER. That second one only happens for some of the obsolete ones. This conforms to the usual FORTRAN convention for implicit typing. Respect the classics. πŸ‘‘
  • The second letter of the function name specifies the coordinate system of the argument.
  • The third letter of the function name specifies the coordinate system of the functional result. So in references to CFUX and CFUY, the result is in the user system; in references to CUFX and CUFY, the result is in the fractional system. It's giving symmetry, it's giving mirror.
  • The fourth letter of the function name is an X or a Y, depending on whether an X or a Y coordinate is being converted. As if you couldn't guess. 😭

πŸŽ€ C-BINDING DESCRIPTION πŸŽ€

The C-binding argument description is the same as the FORTRAN argument description. That's it. That's the whole section. Copy-paste energy but make it official.


πŸ”₯ EXAMPLES πŸ”₯

Use the ncargex command to see the following relevant examples which use coordinate converters: mpex10, cbex10, sfex02, epltch.

And like, if you want to actually get your hands on one of these files, the command

ncargex -n mpex10

will load the driver mpex10.f into your current working directory, where you can examine the file using a local editor, or the UNIX more command. Go look at it, bestie, it's right there. 🌸


πŸ‘‘ ACCESS πŸ‘‘

There were originally 24 conversion functions in the original set. Twenty-four. A whole squad. These functions (12 for the X coordinate of a point, and 12 for the Y coordinate) allowed one to convert between any combination of PAUs, MUs, fractional coordinates, and user coordinates. That's a full combinatorial grid, that's the whole periodic table of coordinate conversions. πŸ’€

But PAUs and MUs are now obsolete, so only four of the conversion functions are still pertinent:

  • CFUX and CFUY β€” these let you convert the X and Y coordinates of a point from the fractional system to the user system.
  • CUFX and CUFY β€” these do the exact opposite.

To use any of these conversion routines, load the NCAR Graphics libraries ncarg, ncarg_gks, and ncarg_c, preferably in that order. Order matters, don't be chaotic about it. πŸ™


πŸ’– SEE ALSO πŸ’–

Online: cfux, cfuy, cmfx, cmfy, cmux, cmuy, cpfx, cpfy, cpux, cpuy, cufx, cufy, kfmx, kfmy, kfpx, kfpy, kmpx, kmpy, kpmx, kpmy, kumx, kumy, kupx, kupy, spps, ncarg_cbind

Hardcopy: NCAR Graphics Fundamentals, UNIX Version; User's Guide for NCAR GKS-0A Graphics


Copyright (C) 1987-2009 University Corporation for Atmospheric Research

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


okay that's the whole page, bestie, you're officially fluent in coordinate converters now, no cap 🧚✨

this icon was brought to you by the UNIX girlies, dated March 1993, and filed under SPPS_converters(3NCARG) β€” stay slay, stay converted, mwah πŸ’…πŸ¦‹

πŸ“¦ where this page comes from