NCAR
view release on metacpan or search on metacpan
test/cpex12.t view on Meta::CPAN
BEGIN { plan tests => 1 };
use NCAR;
ok(1); # If we made it this far, we're ok.;
#########################
# Insert your test code below, the Test module is use()ed here so read
# its man page ( perldoc Test ) for help writing this test script.
unlink( 'gmeta' );
use PDL;
use NCAR::Test;
use strict;
#
# This program demonstrates the use of the new dashed-line package
# DASHPACK, which became a part of NCAR Graphics in August, 1994.
#
# Define error file, Fortran unit number, workstation type, and
# workstation ID.
#
my ( $IERRF, $LUNIT, $IWTYPE, $IWKID ) = ( 6, 2, 1, 1 );
#
# Declare an array to hold the data to be contoured.
#
my $ZDAT = zeroes float, 37, 27;
#
# 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.
#
my $IAMA = zeroes long, 25000;
#
# Declare the routine which will draw contour lines but avoid drawing
# them through labels.
#
# EXTERNAL CPDRPL
#
# Open GKS.
#
&NCAR::gopks ($IERRF, my $ISZDM);
&NCAR::gopwk ($IWKID, $LUNIT, $IWTYPE);
&NCAR::gacwk ($IWKID);
#
# Turn off clipping by GKS.
#
&NCAR::gsclip (0);
#
# Generate an array of test data.
#
my @t;
open DAT, "<data/cpex12.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 .. 27 ) {
for my $I ( 1 .. 37 ) {
set( $ZDAT, $I-1, $J-1, shift( @t ) );
}
}
#
# Change the range of the data somewhat.
#
for my $I ( 1 .. 37 ) {
for my $J ( 1 .. 27 ) {
set( $ZDAT, $I-1, $J-1, at( $ZDAT, $I-1, $J-1 ) + 10000 );
}
}
#
# Put explanatory labels at the top and bottom of the plot.
#
&NCAR::plchhq (&NCAR::cfux(.5),&NCAR::cfuy(.930),'A CONPACK EXAMPLE',.018,0.,0.);
#
&NCAR::plchhq (&NCAR::cfux(.5),&NCAR::cfuy(.897),'Using the New Dashed-Line Package DASHPACK',.015,0.,0.);
#
&NCAR::plchhq (&NCAR::cfux(.5),&NCAR::cfuy(.093),
'Note that contour labels are written by PLCHHQ and that they can be made to:C:bend with the line (which works best when, as here, the lines are very smooth).',
.010,0.,0.);
#
# Tell CONPACK to choose contour levels for itself and to use more than
# the usual number of them.
#
&NCAR::cpseti ('CLS - CONTOUR LEVEL SELECTOR',32);
#
# Tell CONPACK to use characters a little smaller than the default size
# in the contour-line labels.
#
&NCAR::cpsetr ('DPS - DASH PATTERN CHARACTER SIZE',.0075);
#
# Tell CONPACK to use the new dash package (because 'DPU' is negative)
# and to use 1 repetition of the dash pattern between each line label
# and the next (because the absolute value of 'DPU' is 1).
#
&NCAR::cpseti ('DPU - DASH PACKAGE USE FLAG',-1);
#
# Tell CONPACK to use gaps and solids that are half the default size
# when drawing the contour lines.
#
&NCAR::cpsetr ('DPV - DASH PATTERN VECTOR SIZE',.0025);
#
# Turn on the drawing of the high and low label boxes.
#
&NCAR::cpseti ('HLB - HIGH/LOW LABEL BOX FLAG',1);
#
# Tell CONPACK to delete high/low labels which overlap the informational
# label, another high/low label, or the edge.
#
&NCAR::cpseti ('HLO - HIGH/LOW LABEL OVERLAP FLAG',7);
#
# Force the use of an exponent form in all numeric labels.
#
&NCAR::cpseti ('NEU - NUMERIC EXPONENT USE FLAG',0);
#
( run in 0.510 second using v1.01-cache-2.11-cpan-71847e10f99 )