KFMY(3NCARG)

✨ KFMY ✨ β€” a lil NCAR Graphics page, bestie edition πŸ’…

okay so real quick, this whole thing lives in the NCAR Graphics manual (the 3NCARG section, if you're keeping score), and it's technically filed under KFMY but honestly it's also the family portrait for a whole squad of coordinate-converter functions called SPPS_converters. Grab a strawberry πŸ“ and let's get into it.


πŸŽ€ NAME πŸŽ€

KFMY β€” she converts from fractional coordinates to metacode coordinates. that's the whole job. that's her whole thing. periodt. πŸ’–

And the group name? spps_converters β€” it's a set of functions, each one transforming a coordinate from one NCAR Graphics coordinate system to another. The full roster is, deep breath:

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.

that's 24 besties. no cap. πŸ‘‘


⚠️ STATUS ⚠️

Plotter Address Units (PAUs) and Metacode Units (MUs) are no longer used in NCAR Graphics. so literally every function with an M or a P as the second or third letter of the name is considered obsolete. it's giving legacy code. πŸ’€

The coordinate systems that actually count rn are:

  • 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". πŸ“š

Now, because some of y'all are still out here reading old code, here are the definitions of the PAU and MU coordinate systems, provided for the purpose of interpreting and converting codes which use PAUs or MUs:

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 MX and MY by calling the routines SETI or SETUSV, and you can retrieve them by calling the routines GETSI or GETUSV. πŸŽ›οΈ

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's 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. πŸ¦‹


✨ SYNOPSIS ✨

The ones you should actually be using:

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

The ones that are, respectfully, obsolete:

Obsolete:
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 🌈

yes bestie, there's a C binding too, she's bilingual πŸ’œ

#include <ncarg/ncargC.h>

float c_cfux (float rx)

float c_cfuy (float ry)

float c_cufx (float rx)

float c_cufy (float ry)

πŸ’– DESCRIPTION πŸ’–

okay here's the decoding ring for the argument names, because these are positional meanings, not vibes:

  • RX β€” an input expression of type REAL, 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.
  • RY β€” an input expression of type REAL, a Y coordinate in the coordinate system specified by the second letter of the function name. So 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're 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. 🫠

Now the naming scheme, and honestly? it ate. every letter is load-bearing:

  • The first letter is a C if the result is of type REAL, and a K if the result is of type INTEGER (which only happens for some of the obsolete ones). This conforms to the usual FORTRAN convention for implicit typing. πŸ“
  • The second letter specifies the coordinate system of the argument.
  • The third letter specifies the coordinate system of the functional result. 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.
  • The fourth letter is an X or a Y, depending on whether an X or a Y coordinate is being converted.

like… four letters, four jobs. iconic. πŸ‘‘


πŸ’œ C-BINDING DESCRIPTION πŸ’œ

The C-binding argument description is the same as the FORTRAN argument description. same energy, different syntax, we love a consistent queen. πŸ’…


🧚 EXAMPLES 🧚

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

And fr fr, this one is handy:

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.

so you can literally just pull the driver down and read it with more. no gatekeeping. 🌸


🫢 ACCESS 🫢

There were 24 conversion functions in the original set. 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. iconic range, truly.

But PAUs and MUs are now obsolete, so only four of the conversion functions are still pertinent: CFUX and CFUY let you convert the X and Y coordinates of a point from the fractional system to the user system, while CUFX and CUFY do the opposite. that's it. four girls carrying the whole legacy. πŸ’…

To use any of the conversion routines, load the load the NCAR Graphics libraries ncarg, ncarg_gks, and ncarg_c, preferably in that order. (yes, the original says "load the load the" β€” I'm not touching it, that's canon, we respect the text πŸ’€)


⭐ 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 bestie that's the whole page πŸ’– go forth and convert those coordinates, you absolute main character. stay fractional, stay iconic, and remember: the Ms and the Ps are obsolete, so don't let anyone catch you using them in 2025. πŸ¦‹βœ¨

this lil walkthrough was brought to you by the SPPS_converters page, straight outta the NCAR Graphics collection, dated March 1993, living under the UNIX banner. mwah. πŸ’‹πŸŽ€