Hi Daniel: I would make sure that the attributes $drng, $rngN and $dtheta
are scalars:
my $dtheta = $nc->getatt( 'seasonde_Angular_Resolution',
sprintf('seasonde_Header_%s',uc($self->{station_site})) )->sclr;
--Doug
[email protected]
Software Engineer
UCAR - COSMIC, Tel. (303) 497-2611
On Tue, 25 Sep 2012, dpath2o wrote:
Hi,
I've been chasing a new problem that appears to be somewhat sinister, but could
be relatively straight forward ... I'm turning
my wheels.
Here's my code:
1 my $nc = PDL::NetCDF->new( $ncfile );
2 my $lon0 = $nc->getatt( 'seasonde_Origin_Longitude',
sprintf('seasonde_Header_%s',uc($self->{station_site})) );
3 my $lat0 = $nc->getatt( 'seasonde_Origin_Latitude' ,
sprintf('seasonde_Header_%s',uc($self->{station_site})) );
4 my $drng = $nc->getatt( 'seasonde_Range_Resolution',
sprintf('seasonde_Header_%s',uc($self->{station_site})) );
5 my $rngN = $nc->getatt( 'seasonde_Range_Limit',
sprintf('seasonde_Header_%s',uc($self->{station_site})) ) * $drng;
6 my $dtheta = $nc->getatt( 'seasonde_Angular_Resolution',
sprintf('seasonde_Header_%s',uc($self->{station_site})) );
7 #my $thetas_degrees = zeroes(360/$dtheta)->xlinvals(0,(360-$dtheta));
8 my $thetas_degrees = zeroes(360/5)->xlinvals(0,355);
9 my $thetas = HFR::degrees2radians( $thetas_degrees );
10 #my $rngs = zeroes($rngN/$drng)->xlinvals($drng,$rngN);
11 my $rngs = zeroes(141237/3138.6)->xlinvals(3138.6,141237);
12 my @rngdims = $rngs->dims;
13 my @thetadims = $thetas->dims;
14 for (my $l1=0;$l1<$rngdims[0];$l1++) {
15 for (my $l2=0;$l2<$thetadims[0];$l2++) {
16 $lonG = $lonG->append( ($rngs($l1)*cos($thetas($l2)))+$lon0 );
17 $latG = $latG->append( ($rngs($l1)*sin($thetas($l2)))+$lat0 );
18 }
19 }
Here's the error message when lines 7 and 10 are uncommented and lines 8 and 11
are commented.
$ncfile
='http://opendap-qcif.arcs.org.au/thredds/dodsC/IMOS/ACORN/radial/CRVT/2011/09/01/IMOS_ACORN_RV_20110901T000000Z_CRVT_FV00_radi
al.nc'
HFR::degrees2radians is very straightforward as the name implies
The error message that I get is:
Must have at least two elements in dimension for xlinvals at
/opt/local/lib/perl5/site_perl/5.12.4/darwin-thread-multi-2level/PDL/Basic.pm
line 245
PDL::xlinvals('PDL=SCALAR(0x7fb13b7f4bb8)', 'PDL=SCALAR(0x7fb13b7f4b40)',
'PDL=SCALAR(0x7fb13b7f4b70)') called at
/opt/local/lib/perl5/site_perl/5.12.4/HFR/ACORN.pm line 368
This implies that xlinvals is not getting the right input. So when I 'foce
feed' xlinvals (as I've tested the code out on the
PDL command line and it works fine) it works fine too. I'm stumped ... any
thoughts? Could there be some conflict with PDL
operators and Perl operators?
Here are the modules I've loaded into this package:
use 5.006;
use strict;
use warnings;
use Data::Dumper;
use Date::Parse;
use DateTime;
use Date::Calc qw ( :all );
use HFR;
use PDL;
use PDL::NiceSlice;
use PDL::Math;
use PDL::Char;
use PDL::NetCDF;
use PDL::Constants qw( PI );
Cheers,
Dan
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl