NCAR

 view release on metacpan or  search on metacpan

test/cpex09.t  view on Meta::CPAN

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use Test;
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;

my ( $IERRF, $LUNIT, $IWTYPE, $IWKID ) = ( 6, 2, 1, 1 );
#
# Define an array for the data.
#
my $ZDAT = zeroes float, 40, 40;
#
# Generate dummy data.
#
my @t;
open DAT, "<data/cpex09.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 .. 40 ) {
  for my $I ( 1 .. 40 ) {
    set( $ZDAT, $I-1, $J-1, shift( @t ) );
  }
}
#
# Open GKS.
#
&NCAR::gopks ($IERRF, my $ISZDM);
&NCAR::gopwk ($IWKID, $LUNIT, $IWTYPE);
&NCAR::gacwk ($IWKID);
#
# Turn off clipping by GKS.
#
&NCAR::gsclip (0);
#
# Force the use of medium-quality characters by the package PLOTCHAR.
#
&NCAR::pcseti ('QU - QUALITY OF CHARACTERS',1);
#
# Put a label at the top of the first plot.  (The SET call is not
# needed for CPEZCT, but for the labelling routine.)
#
&NCAR::set (.05,.95,.05,.95,0.,1.,0.,1.,1);
#&NCAR::Test::labtop ('EXAMPLE 9-1',.017);
#
# Put a boundary line at the edge of the plotter frame.
#
&NCAR::Test::bndary();
#
# Contour the data, using the EZCNTR simulator.
#
&NCAR::cpezct ($ZDAT,40,40);
#
# Contour a subset of the data, forcing a contour interval of 20, using
# the CONREC simulator.
#
my $ZDAT1 = $ZDAT->slice( "6:39,8:39" )->copy();
&NCAR::cpcnrc ($ZDAT1,34,32,24,0.,0.,20.,3,0,-682);
#&NCAR::cpcnrc (ZDAT(7,9),40,32,24,0.,0.,20.,3,0,-682);
#
# Put a boundary line at the edge of the plotter frame, label the plot,
# and advance the frame.
#
&NCAR::Test::bndary();
&NCAR::Test::labtop ('EXAMPLE 9-2',.017);
&NCAR::frame();
#
# Switch to the "penalty scheme" for positioning contour-line labels
# and change one of the constants which are used by it.
#
&NCAR::cpseti ('LLP - LINE LABEL POSITIONING',3);
&NCAR::cpsetr ('PC1 - PENALTY SCHEME CONSTANT 1',1.5);
#
# Turn on the smoother, with a relatively high tension.
#
&NCAR::cpseti ('T2D - TENSION ON THE 2D SMOOTHER',4);
#



( run in 0.614 second using v1.01-cache-2.11-cpan-71847e10f99 )