CPMPXY(3NCARG)
β¨ NAME β¨
okay so bestie, welcome to CPMPXY π β this is the tea from the NCAR GRAPHICS manual, and it's giving coordinate transformation realness.
What does it do? It maps Conpack output from a rectangular coordinate system superimposed on the data grid to some other coordinate system. That's it, that's the whole vibe. π
π SYNOPSIS π
CALL CPMPXY (IMAP, XINP, YINP, XOTP, YOTP)
π DESCRIPTION π
okay let's meet the cast, one by one, no skips, we're doing all of them:
IMAPβ (INTEGER, input) β it's zero if the object of the call is to askCPMPXYabout its mapping capabilities, greater than zero if the object of the call is to do a forward mapping, and less than zero if the object of the call is to do an inverse mapping. WhenIMAPis non-zero, its absolute value matches the current value of the parameter'MAP'and identifies the mapping to be used. literally the "which mode are we in" girlie. πXINPβ (REAL, input) β used in one of three ways, and she's flexible like that:- When
IMAPis zero, the valueINT(XINP)is the index of a mapping about whichCPMPXYis being asked to supply information. - When
IMAPis greater than zero,XINPis the X coordinate of a point on the contour plot. If'XC1'='XCM'(the default situation), thenXINPwill lie in the range from1toM, whereMis the first dimension of the array being contoured (equal to the value of the parameter'ZDM'); in this case, the X coordinate will have the same range as the first index of the data array. If the user sets'XC1'unequal to'XCM', thenXINPwill lie in the range from'XC1'(corresponding to an index value of1) to'XCM'(corresponding to an index value ofM). - When
IMAPis less than zero,XINPis the X coordinate of a point on the contour plot, in a coordinate system consistent with the current window, as specified by arguments 5 through 8 of the last call to the SPPS routineSETor by the equivalent call to GKS.
- When
YINPβ (REAL, input/output) β also used in one of three ways, main character energy fr:- When
IMAPis zero,CPMPXYis expected to return one of the following values ofYINP:YINP=0.indicates that neither the forward nor the inverse transformation is defined. πYINP=1.indicates that the forward transformation is defined, but the inverse is not.YINP=2.indicates that the forward transformation is not defined, but the inverse is.YINP=3.indicates that both the forward and the inverse transformations are defined. slay, fully implemented β¨
- When
IMAPis greater than zero,YINPis the Y coordinate of a point on the contour plot. If'YC1'='YCN'(the default situation), thenYINPwill lie in the range from1toN, whereNis the second dimension of the array being contoured (equal to the value of the parameter'ZDN'); in this case, the Y coordinate will have the same range as the second index of the data array. If the user sets'YC1'unequal to'YCN', thenYINPwill lie in the range from'YC1'(corresponding to an index value of1) to'YCN'(corresponding to an index value ofN). - When
IMAPis less than zero,YINPis the Y coordinate of a point on the contour plot, in a coordinate system consistent with the current window, as specified by arguments 5 through 8 of the last call to the SPPS routineSETor by the equivalent call to GKS.
- When
XOTPandYOTPβ (REAL, output) β used in one of two ways, and honestly they're a matched set, never separate them:- If
IMAPis greater than zero,XOTPandYOTPare the X and Y coordinates of a point on the contour plot, in a coordinate system consistent with the current window, as specified by arguments 5 through 8 of the last call to the SPPS routineSETor by the equivalent call to GKS. - When
IMAPis less than zero,XOTPandYOTPare the X and Y coordinates of a point on the contour plot. If'XC1'='XCM'(the default situation), thenXOTPwill lie in the range from1toM, whereMis the first dimension of the array being contoured (equal to the value of the parameter'ZDM'); in this case, the X coordinate will have the same range as the first index of the data array. If the user sets'XC1'unequal to'XCM', thenXOTPwill lie in the range from'XC1'(corresponding to an index value of1) to'XCM'(corresponding to an index value ofM). Similarly, if'YC1'='YCN'(the default situation), thenYOTPwill lie in the range from1toN, whereNis the second dimension of the array being contoured (equal to the value of the parameter'ZDN'); in this case, the Y coordinate will have the same range as the second index of the data array. If the user sets'YC1'unequal to'YCN', thenYOTPwill lie in the range from'YC1'(corresponding to an index value of1) to'YCN'(corresponding to an index value ofN).
- If
In any case, if the point (XINP,YINP) cannot be mapped for any reason, some recognizable impossible value should be returned for both of XOTP and YOTP and the internal parameter 'ORV' should be given that value, thereby allowing Conpack routines that call CPMPXY to determine whether or not a point being projected is visible or not. The value used for this purpose by the Ezmap routines MAPTRA and MAPTRI is 1.E12. π© not a drill, that's the "can't map this" flag
π¦ USAGE π¦
π¨ bestie listen βCPMPXYis not to be called by the user. It is called by Conpack when the parameter'MAP'is non-zero.
Each call is intended 1) to inquire whether a given mapping is defined by CPMPXY, or 2) to map the X and Y coordinates of a single point, whose position is known relative to the data grid, to X and Y coordinates in some other coordinate system or 3) (as of version 3.1.3) to do the inverse mapping. The default version of CPMPXY is as follows:
SUBROUTINE CPMPXY (IMAP,XINP,YINP,XOTP,YOTP)
IF (IMAP.EQ.0) THEN
IF (INT(XINP).GE.1.AND.INT(XINP).LE.3) THEN
YINP=3.
ELSE
YINP=0.
END IF
ELSE IF (ABS(IMAP).EQ.1) THEN
IF (IMAP.GT.0) THEN
CALL MAPTRA (YINP,XINP,XOTP,YOTP)
ELSE
CALL MAPTRI (XINP,YINP,YOTP,XOTP)
END IF
ELSE IF (ABS(IMAP).EQ.2) THEN
IF (IMAP.GT.0) THEN
XOTP=XINP*COS(.017453292519943*YINP)
YOTP=XINP*SIN(.017453292519943*YINP)
ELSE
XOTP=SQRT(XINP*XINP+YINP*YINP)
YOTP=57.2957795130823*ATAN2(YINP,XINP)
END IF
ELSE
XOTP=XINP
YOTP=YINP
END IF
RETURN
END
okay now let's walk through what that actually means, because it's lowkey elegant:
When CPMPXY is called with IMAP = 0, it assumes it is being asked to return information about its mapping capabilities. XINP is assumed to have been given the value REAL(I), where I is the index of a mapping about which information is desired. CPMPXY sets YINP to indicate whether the mapping selected by I is implemented or not and whether its inverse is implemented or not. In the case of the default version of CPMPXY, mappings 1 through 3 are completely implemented (both forward and reverse), so a "3." is returned as the value of YINP; other mappings are not implemented at all, so a "0." is returned as the value of YINP. π―
When CPMPXY is called with IMAP = 1, the incoming X and Y coordinates are assumed to represent longitude and latitude, respectively; the Ezmap routine MAPTRA is called to find the X and Y coordinates of the projection of the specified point on the globe, and those coordinates are returned as the outgoing X and Y coordinates. When IMAP = -1, the incoming X and Y coordinates are assumed to be the X and Y coordinates of a projected point; the Ezmap routine MAPTRI is called to find the longitude and latitude of the original point on the globe, and those values are returned as the outgoing X and Y coordinates. πβ¨
When IMAP = 2, the incoming X and Y coordinates are assumed to represent rho and theta (in degrees) in polar coordinates; from these are computed the output X and Y coordinates. When IMAP = -2, the incoming X and Y coordinates are used to compute rho and theta and those values are returned. π
If IMAP is anything else, the input X and Y coordinates are simply returned as the output X and Y coordinates. (the "girl just passes it through" behaviour, we love a no-op π
)
A user version of CPMPXY can be made to do any desired mapping. It should also be made, when IMAP = 0, to return correct information about its own capabilities. π«Ά don't forget the capability check bestie, that's the whole vibe check
π ACCESS π
To use CPMPXY, load the NCAR Graphics libraries ncarg, ncarg_gks, and ncarg_c, preferably in that order. (order matters, no cap πΈ)
π SEE ALSO π
Online: conpack, cpback, cpchcf, cpchcl, cpchhl, cpchil, cpchll, cpcica, cpclam, cpcldm, cpcldr, cpcltr, cpcnrc, cpdrpl, cpezct, cpgetc, cpgeti, cpgetr, cplbam, cplbdr, cpmviw, cpmvrw, cppkcl, cppklb, cprect, cprset, cpscae, cpsetc, cpseti, cpsetr, cpsps1, cpsps2, ncarg_cbind
Hardcopy: NCAR Graphics Contouring and Mapping Tutorial
π COPYRIGHT π
Copyright (C) 1987-2009 University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.
and that's the whole page bestie, you ate it π this was CPMPXY, served up from the UNIX corner of the manual, dated March 1993 β yes she's a vintage icon, and she still slays. bye babes, go contour something gorgeous πΈπ¦β¨
π¦ where this page comes from
- epel 9: ncl-devel 6.6.2-59.el9 Β· LicenseRef-Callaway-BSD
- fedora 43: ncl-devel 6.6.2-58.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: ncl-devel 6.6.2-62.fc44 Β· LicenseRef-Callaway-BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms