CPCNRC(3NCARG)
π NAME π
okay so this whole page is CPCNRC(3NCARG) from the NCAR GRAPHICS manual, and it's genuinely iconic β¨ β CPCNRC draws black and white contours with a single call. That's the whole vibe: one call, contours, done. It's giving the behavior of the old routine CONREC; it has the same arguments and produces similar output. no cap π
πΈ SYNOPSIS πΈ
CALL CPCNRC (ZDAT, KZDT, MZDT, NZDT, FLOW, FHGH, FINC,
+ NSET, NHGH, NDSH)
π C-BINDING SYNOPSIS π
#include <ncarg/ncargC.h>
void c_cpcnrc (float *zdat, int kzdt, int mzdt, int nzdt,
float flow, float fhgh, float finc, int nset, int nhgh,
int ndsh)
β¨ DESCRIPTION β¨
okay bestie, here come the arguments. every single one. hydrate first π§
π«Ά ZDAT π«Ά
(REAL array, dimensioned KZDT x n, where "n" is greater than or equal to NZDT, input) β this is the array holding the data you want contoured. the whole point, the main character π
π«Ά KZDT π«Ά
(INTEGER, input) β the first dimension of the FORTRAN array ZDAT.
π«Ά MZDT π«Ά
(INTEGER, input) β the first dimension of the array of data in ZDAT. and listen, MZDT must be less than or equal to KZDT. no exceptions, it's the rules π
π«Ά NZDT π«Ά
(INTEGER, input) β the second dimension of the array of data in ZDAT. NZDT must be less than or equal to the declared second dimension of the array ZDAT.
π«Ά FLOW π«Ά
(REAL, input) β your desired lowest contour level π₯Ί but plot twist: if FLOW is equal to or greater than FHGH, Conpack will choose the set of contour levels itself. it said "I got this".
π«Ά FHGH π«Ά
(REAL, input) β your desired highest contour level. and same energy: if FHGH is equal to or less than FLOW, Conpack will choose the set of contour levels. let her cook π
π«Ά FINC π«Ά
(REAL, input) β this one says how contour levels are to be chosen. there are two possibilities:
- if
FINCis greater than zero, it specifies the desired contour interval to be used. in this case, ifFLOWis less thanFHGH, the intervals used will beFLOW,FLOW+FINC,FLOW+2*FINC, ...FLOW+n*FINC, where "n" is the largest integer such thatFLOW+n*FINCis less than or equal toFHGH. but ifFLOWis greater than or equal toFHGH, the contour levels will be those integer multiples ofFINCwhich fall between the minimum value inZDATand the maximum value inZDAT. - if
FINCis less than or equal to zero, Conpack will choose the contour interval in such a way as to give at least 16 contour levels (ifFINCis zero) orMAX(1,INT(-FINC))contour levels (ifFINCis less than zero) between the minimum and maximum values inZDAT. all the contour levels will be integer multiples of the chosen interval. and ifFLOWis less thanFHGH, no contour lines will be drawn for chosen contour levels which are outside the range(FLOW,FHGH).
π«Ά NSET π«Ά
(INTEGER, input) β this says how the contour plot is to be mapped onto the plotter frame. three basic possibilities, bestie, stay with me:
- if the value of
NSET, modulo three, is zero, the "standard configuration" will be used. Conpack will be directed to callSET. the portion of the plotter frame bounded by the lines"X=.05","X=.95","Y=.05", and"Y=.95"(in the "fractional" or "normalized-device-coordinate" system) will be used. the shape of the plot will be determined by the values of the internal parameters'WDL','WDR','WDB', and'WDT'; by default, the ratio of the plot's width to its height will beMZDT/NZDT. and if the ratio of the width to the height is less than1/4or greater than4, the plot will be made square.CPBACKwill be called to draw a perimeter. - if the value of
NSET, modulo three, is equivalent to minus one, the contour plot will fill the current viewport. Conpack will be directed to callSET. the portion of the plotter frame used will be that bounded by the lines"X=xl","X=xr","Y=yb", and"Y=yt", where"xl","xr","yl", and"yr"are obtained by means of a
CALL GETSET (xl,xr,yl,yr,...)
the plot will fill this entire area. CPBACK will not be called to draw a perimeter.
- if the value of
NSET, modulo three, is equivalent to plus one, Conpack will be directed not to callSET. it will be assumed that the user has done the appropriate call.CPBACKwill not be called to draw a perimeter. use this option when overlayingCPCNRCoutput on an existing background (one drawn by Ezmap, for example). layering, we love to see it π§
and here's the tea π: if the value of NSET is -1, 0, or 1, CPCNRC will, prior to returning control to the caller, restore the SET call to what it was on entry (which is how CONREC works). but if the value of NSET is less than -1 or greater than 1, CPCNRC will not so restore the SET call; this may be useful if other objects are to be drawn on the plot produced by CPCNRC.
π«Ά NHGH π«Ά
(INTEGER, input) β says whether highs and lows or data points are to be labeled. three possibilities:
- if
NHGHis zero, each high is marked with an"H"and each low is marked with an"L"; the value is written as a subscript of the"H"or"L". cute and classic π - if
NHGHis greater than zero, each data point is marked with the value at that point. no attempt is made to cull overlapping values, so using this option when there are too many data points may result in a mess π. the values of the Conpack parameters'HLA'and'HLS'are retrieved and used to determine the angle at which the values are written and the size of the characters used. they may be used to reduce the clutter somewhat. - if
NHGHis less than zero, neither of the above is done. nothing. silence. periodt.
π«Ά NDSH π«Ά
(INTEGER, input) β may be used to specify a 10-bit dash pattern to be used. (if ABS(NDSH) is 0, 1, or 1023, all solid lines are used.) if NDSH is greater than zero, the specified dash pattern is used for all contour lines; if NDSH is less than zero, the dash pattern is used only for negative-valued contour lines. dash patterns? we love a little texture π
Note: the 10-bit pattern is actually made into a 16-bit pattern by appending a copy of the high-order six bits. yes bestie, it gets stretched, that's just how it is.
π C-BINDING DESCRIPTION π
the C-binding argument descriptions are the same as the FORTRAN argument descriptions, with the following exceptions (so read closely, the dimensions flip around on you π):
π¦ zdat π¦
dimensioned n by kzdt, where n is greater than or equal to nzdt.
π¦ kzdt π¦
the second dimension of the array zdat.
π¦ mzdt π¦
the second dimension of the array of data in zdat. mzdt must be less than or equal to kzdt.
π¦ nzdt π¦
the first dimension of the array of data in zdat. nzdt must be less than or equal to the declared first dimension of the array zdat.
β¨ USAGE β¨
okay bestie, so the look of the plot from CPCNRC can change depending on how the internal parameters of Conpack are set. Here's the tea you gotta note:
- By default, contour lines get labeled the old CONREC way β the label for a line is just tacked onto that line's dash pattern. If you want one of the new schemes, drop a
CALL CPSETI ('LLP - LINE LABEL POSITIONING',n)
where n is 2 or 3, before the call to CPCNRC. CPCNRC peeks at the value of 'LLP', and if it's a 2 or a 3, it changes up the calls it does so labels get properly shielded from contour lines trying to draw straight through them. π
- By default, high-quality characters are used in the informational label, in high/low labels, in point-value labels, and in contour-line labels written when
'LLP'is2or3. To go lower-quality, place a
CALL PCSETI ('QUALITY',1)
or a
CALL PCSETI ('QUALITY',2)
prior to the call to CPCNRC.
Quick note: these calls are to subroutines that start with the letters PC, because the routine you're calling lives in the utility Plotchar. (Conpack uses Plotchar to plot characters.) π
- If the output from
CPCNRCis gonna be overlaid on an Ezmap background, and longitude is a linear function of the first subscript of the data array, and latitude is a linear function of the second subscript of the data array, then you can do this whole sequence:- Call Ezmap to draw the background.
- Set the parameter
'MAP'to1. - Set the parameters
'XC1','XCM','YC1', and'YCN'to specify the longitude and latitude ranges. Note:'XCM'must be numerically larger than'XC1'. If, for example, your data run from175degrees east of Greenwich at the left edge to160degrees west of Greenwich at the right edge (which is-160degrees east), then you should set'XC1'=175and'XCM'=200to achieve the proper mapping. πΊοΈ - Call
CPCNRCto draw the contour plot.
- To smooth the contour lines the same way they would've been smoothed by the
"smooth"or"super"versions of CONREC, insert
CALL CPSETR ('T2D - TENSION ON THE 2D SPLINES',t),
where t is the desired tension, to turn on the smoother. β¨
- By default, no scale factor is used. (Because Conpack can write contour line labels in scientific notation, it was considered less important to use a scale factor.) If you want a scale factor, set the value of the internal parameter
'SFS'prior to callingCPCNRC. CPCNRCcontains a real workspace array, an integer workspace array, and an area map, which is used to prevent contour lines from passing through labels when'LLP'has the value2or3. The lengths of these arrays are5000,2000, and12000, respectively. If that's not enough, you must obtain a copy of the code forCPCNRC, adjust the dimensions as required, and compile it in place of the default version. π- Certain internal parameters are used by
CPCNRC; user calls to reset them before the call toCPCNRCwill therefore have no effect. These parameters are as follows:
'AIA' 'AIB' 'CIS' 'CIU' 'CLC' 'CLD' 'CLL' 'CLS' 'CLV' 'CLU' 'CMN'
'CMX' 'HLT' 'HIT' 'LOT' 'LLC' 'LLT' 'NCL' 'SET' 'VPB' 'VPL' 'VPR'
'VPS' 'VPT'
- Subroutines with names of the form
CPCHxx(the change subroutines) will be of more value when used withCPCNRCthan when used with the more basic Conpack subroutines. For example, the only way to change the color of the zero contour line drawn by a call toCPCNRCis to supply your own version of the routineCPCHCL; there is no way, short of modifying the code ofCPCNRC, to use the internal parameter that controls the color of the zero contour line. π - Like CONREC,
CPCNRCdoes no call toFRAME. To advance the frame, put aCALL FRAMEafter the call toCPCNRC. π
πΈ EXAMPLES πΈ
Use the ncargex command to see the following relevant examples: ccpcnrc, cpex09, tconpa. β¨
π¦ ACCESS π¦
To use CPCNRC or c_cpcnrc, load the NCAR Graphics libraries ncarg, ncarg_gks, and ncarg_c, preferably in that order. π«Ά
π SEE ALSO π
Online: conpack, cpback, cpchcf, cpchcl, cpchhl, cpchil, cpchll, cpcica, cpclam, cpcldm, cpcldr, cpcltr, cpdrpl, cpezct, cpgetc, cpgeti, cpgetr, cplbam, cplbdr, cpmpxy, 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.
this whole page is giving UNIX manual, March 1993, CPCNRC(3NCARG) β periodt. πβ¨
π¦ 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