NCAR
view release on metacpan or search on metacpan
test/cpex15.t view on Meta::CPAN
# are suppressed (by masking against the contents of an area map).
#
# Declare an array to hold the data to be contoured.
#
my $ZDAT = zeroes float, 70, 70;
#
# Declare the required real and integer workspaces.
#
my $RWRK = zeroes float, 5000;
my $IWRK = zeroes long, 1000;
#
# Declare an array to hold an area map. Put in a common block so we
# can get at it from the routines CPCHHL and CPCHLL.
#
my $IAMA = zeroes long, 200000;
#
# Declare the arrays needed by ARSCAM and MAPGRM for x/y coordinates.
#
my $XCRA = zeroes float, 10000;
my $YCRA = zeroes float, 10000;
#
# Declare the arrays needed by ARSCAM and MAPGRM for area and group
# identifiers.
#
my $IARA = zeroes long, 10;
my $IGRA = zeroes long, 10;
#
# Declare the routine that draws contour lines, avoiding labels.
#
# EXTERNAL DRAWCL
#
# Declare the routine that does the shading of a contour band.
#
# EXTERNAL SHADER
#
# Declare the routine that fills the EZMAP background.
#
# EXTERNAL FILLEB
#
# Turn off the clipping indicator.
#
&NCAR::gsclip (0);
#
# Define colors to use for various purposes.
#
&NCAR::gscr (1,2,.5,.5,1.); # light blue (for labels)
&NCAR::gscr (1,3,1.,1.,.5); # light yellow (for labels)
&NCAR::gscr (1,4,1.,.5,.5); # light red (for labels)
&NCAR::gscr (1,5,1.,1.,1.); # white (for land areas)
&NCAR::gscr (1,6,.6,.6,.6); # gray (for ocean areas)
#
# Generate an array of test data.
#
my @t;
open DAT, "<data/cpex15.dat";
{
local $/ = undef;
my $t = <DAT>;
$t =~ s/^\s*//o;
$t =~ s/\s*$//o;
@t = split m/\s+/o, $t;
}
close DAT;
for my $J ( 1 .. 70 ) {
for my $I ( 1 .. 70 ) {
set( $ZDAT, $I-1, $J-1, shift( @t ) );
}
}
#
# Put some labels at the top of the plot.
#
&NCAR::plchhq (.5,.982,'CONPACK EXAMPLE 15',.018,0.,0.);
#
&NCAR::plchhq (.5,.952,'The routines CPCHHL and CPCHLL are used below to suppress labels over land.',.012,0.,0.);
#
&NCAR::plchhq (.5,.928,'They are also used to modify colors and line widths used for the labels.',.012,0.,0.);
#
# Initialize EZMAP.
#
&NCAR::mapsti ('LA - LABELS',0); # no labels
&NCAR::mapsti ('PE - PERIMETER',0); # no perimeter
&NCAR::mappos (.05,.95,.01,.91); # positions the map;
&NCAR::maproj ('OR - ORTHOGRAPHIC',40.,-135.,0.); # projection
&NCAR::mapset ('MA - MAXIMAL AREA',
float( [ 0., 0. ] ),
float( [ 0., 0. ] ),
float( [ 0., 0. ] ),
float( [ 0., 0. ] )
); # map portion
#
&NCAR::mapint(); # initialize;
#
# Tell CONPACK to do no SET call (EZMAP has done it).
#
&NCAR::cpseti ('SET - DO-SET-CALL FLAG',0);
#
# Tell CONPACK to use more contour levels.
#
&NCAR::cpseti ('CLS - CONTOUR LEVEL SELECTOR',32);
#
# Tell CONPACK to position labels using the "regular" scheme.
#
&NCAR::cpseti ('LLP - LINE LABEL POSITIONING',2);
#
# Tweak constants so as to get more labels on each labeled contour.
#
&NCAR::cpsetr ('RC1 - REGULAR SCHEME CONSTANT 1',.05);
&NCAR::cpsetr ('RC2 - REGULAR SCHEME CONSTANT 2',.1);
&NCAR::cpsetr ('RC3 - REGULAR SCHEME CONSTANT 3',0.);
#
# Provide a little more workspace for X and Y coordinates defining
# contour lines, so as not to have labels right next to each other
# on a contour line.
#
&NCAR::cpseti ('RWC - REAL WORKSPACE FOR CONTOURS',200);
#
# Turn on drawing and filling of the high and low label boxes.
#
&NCAR::cpseti ('HLB - HIGH/LOW LABEL BOX FLAG',3);
#
# Tell CONPACK to delete high/low labels which overlap the informational
( run in 0.744 second using v1.01-cache-2.11-cpan-71847e10f99 )