NCAR
view release on metacpan or search on metacpan
test/vvex01.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;
&NCAR::gopks( 6, 1 );
&NCAR::gopwk( 1, 2, 1 );
&NCAR::gacwk( 1 );
#
# This example overlays vectors on a polar contour plot using
# data generated with a randomizing algorithm. The first frame colors
# the vectors according to the data used to generate the contour plot,
# with the result that the color of the vectors corresponds to the
# contour level at each location. In the second frame the vectors
# are colored by magnitude.
#
# The contour, vector field component, and area map array declarations:
#
my ( $MSIZE, $NSIZE ) = ( 33, 33 );
my $LAMA=25000;
my $ZDAT = zeroes float, $NSIZE, $MSIZE;
my $U = zeroes float, 60, 60;
my $V = zeroes float, 60, 60;
my $IAMA = zeroes long, $LAMA;
#
# Workspace arrays for Conpack:
#
my $RWRK = zeroes float, 5000;
my $IWRK = zeroes long, 1000;
#
# ARSCAM arrays:
#
my $XCRA = zeroes float, 1000;
my $YCRA = zeroes float, 1000;
my $IARA = zeroes long, 10;
my $IGRA = zeroes long, 10;
#
# Declare the masked rendering routines for drawing and shading the
# contour plot, as well as for drawing the vectors
#
# EXTERNAL DRAWCL
# EXTERNAL SHADER
# EXTERNAL VVUDMV
#
my @t;
open DAT, "<data/vvex01.ZDAT.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 .. $NSIZE ) {
for my $I ( 1 .. $MSIZE ) {
set( $ZDAT, $J-1, $I-1, shift( @t ) );
}
}
#
for my $I ( 1 .. $MSIZE ) {
for my $J ( 1 .. $NSIZE ) {
if( ( ($I-20)*($I-20) + ($J-10)*($J-10) ) < 25 ) {
set( $ZDAT, $J-1, $I-1, 1.E36 );
}
}
}
#
# Subroutine GENARA generates smoothly varying random data in its
# second array argument based upon the contents of the first. Call it
( run in 1.860 second using v1.01-cache-2.11-cpan-5a3173703d6 )