Skip to content

Commit a6f26d6

Browse files
committed
rename Scale to Bounds
1 parent 9904810 commit a6f26d6

1 file changed

Lines changed: 47 additions & 47 deletions

File tree

lib/PDL/Graphics/TriD/Graph.pm

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ package # hide from PAUSE
133133
use base qw(PDL::Graphics::TriD::Object);
134134
sub normalise_scale { # Normalize the smallest differences away.
135135
my ($this) = @_;
136-
my ($min, $max) = $this->{Scale}->dog;
136+
my ($min, $max) = $this->{Bounds}->dog;
137137
my $diff = $max - $min;
138138
my ($got_smalldiff, $got_bigdiff) = PDL::which_both(abs($diff) < 1e-6);
139139
$max->dice_axis(0, $got_smalldiff) .= $min->dice_axis(0, $got_smalldiff) + 1;
@@ -143,7 +143,7 @@ sub normalise_scale { # Normalize the smallest differences away.
143143
package # hide from PAUSE
144144
PDL::Graphics::TriD::EuclidAxes;
145145
use base qw(PDL::Graphics::TriD::AxesBase);
146-
use fields qw(NDiv Scale AxisLabelsObj Transform);
146+
use fields qw(NDiv Bounds AxisLabelsObj Transform);
147147
use PDL;
148148
use PDL::Transform;
149149

@@ -173,17 +173,17 @@ sub new {
173173

174174
sub init_scale {
175175
my ($this) = @_;
176-
$this->{Scale} = undef;
176+
$this->{Bounds} = undef;
177177
}
178178

179179
sub add_scale {
180180
my ($this,$data,$inds) = @_;
181181
PDL::barf "no \$inds given" if !defined $inds;
182182
$data = $data->dice_axis(0, $inds);
183183
my $to_minmax = $data->clump(1..$data->ndims-1); # xyz,...
184-
$to_minmax = $to_minmax->glue(1, $this->{Scale}); # include old min/max
184+
$to_minmax = $to_minmax->glue(1, $this->{Bounds}); # include old min/max
185185
my ($mins, $maxes) = $to_minmax->transpose->minmaxover; # each is xyz
186-
$this->{Scale} = PDL->pdl($mins, $maxes); # xyz,minmax
186+
$this->{Bounds} = PDL->pdl($mins, $maxes); # xyz,minmax
187187
}
188188

189189
sub finish_scale {
@@ -207,9 +207,9 @@ use base qw(PDL::Graphics::TriD::Object);
207207
use fields qw(LatticeObj);
208208
sub add_lattice_axis {
209209
my ($this) = @_;
210-
my @widths = $this->{Scale}->slice('0:1')->t->diff2->list;
210+
my @widths = $this->{Bounds}->slice('0:1')->t->diff2->list;
211211
my @nadd = map $_ > 100 ? 10 : $_ > 30 ? 5 : $_ > 20 ? 2 : 1, @widths;
212-
my @nc = map int($this->{Scale}->slice("$_,0")->sclr/$nadd[$_])*$nadd[$_], 0,1;
212+
my @nc = map int($this->{Bounds}->slice("$_,0")->sclr/$nadd[$_])*$nadd[$_], 0,1;
213213
my @ns = map int($widths[$_]/$nadd[$_])+1, 0,1;
214214
# can be changed to topo heights?
215215
my $verts = PDL->zeroes(PDL::float(),3,$ns[0],$ns[1]);
@@ -229,7 +229,7 @@ sub add_lattice_axis {
229229
package # hide from PAUSE
230230
PDL::Graphics::TriD::CylindricalEquidistantAxes;
231231
use base qw(PDL::Graphics::TriD::LatticeAxes);
232-
use fields qw(Names Scale Center);
232+
use fields qw(Names Bounds Center);
233233
use PDL::Core qw(barf float);
234234
use PDL::Constants qw(DEGRAD);
235235
use constant DEG2RAD => 1/DEGRAD;
@@ -243,20 +243,20 @@ sub new {
243243

244244
sub init_scale {
245245
my ($this) = @_;
246-
$this->{Scale} = PDL->pdl(PDL::float(), 'BAD BAD 100; BAD BAD 1012.5');
246+
$this->{Bounds} = PDL->pdl(PDL::float(), 'BAD BAD 100; BAD BAD 1012.5');
247247
}
248248

249249
sub add_scale {
250250
my ($this,$data,$inds) = @_;
251251
barf "no \$inds given" if !defined $inds;
252252
$data = $data->dice_axis(0, $inds);
253253
my $to_minmax = $data->clump(1..$data->ndims-1); # xyz,...
254-
$to_minmax = $to_minmax->glue(1, $this->{Scale}); # include old min/max
254+
$to_minmax = $to_minmax->glue(1, $this->{Bounds}); # include old min/max
255255
my ($mins, $maxes) = $to_minmax->transpose->minmaxover; # each is xyz
256256
if ($maxes->slice(1) >= 90 or $mins->slice(1) <= -90) {
257257
barf "Error in Latitude ", $maxes->slice(1), " ", $mins->slice(1);
258258
}
259-
$this->{Scale} = PDL->pdl($mins, $maxes); # xyz,minmax
259+
$this->{Bounds} = PDL->pdl($mins, $maxes); # xyz,minmax
260260
# Should make the projection center an option
261261
$this->{Center} = float([($maxes + $mins)->slice("(0)")/2, 0]);
262262
}
@@ -265,40 +265,40 @@ sub finish_scale {
265265
my ($this) = @_;
266266
my @dist;
267267
# Normalize the smallest differences away.
268-
my $scale = $this->{Scale}->t->unpdl;
269-
for (@$scale) {
268+
my $bounds = $this->{Bounds}->t->unpdl;
269+
for (@$bounds) {
270270
if (abs($_->[0] - $_->[1]) < 0.000001) {
271271
$_->[1] = $_->[0] + 1;
272272
}
273273
push(@dist,$_->[1]-$_->[0]);
274274
}
275275
# for the z coordinate reverse the min and max values
276-
my $max = $scale->[2][0];
277-
if ($max < $scale->[2][1]) {
278-
$scale->[2][0] = $scale->[2][1];
279-
$scale->[2][1] = $max;
276+
my $max = $bounds->[2][0];
277+
if ($max < $bounds->[2][1]) {
278+
$bounds->[2][0] = $bounds->[2][1];
279+
$bounds->[2][1] = $max;
280280
}
281-
# Normalize longitude and latitude scale
281+
# Normalize longitude and latitude bounds
282282
if ($dist[1] > $dist[0]) {
283-
$scale->[0][0] -= ($dist[1]-$dist[0])/2;
284-
$scale->[0][1] += ($dist[1]-$dist[0])/2;
283+
$bounds->[0][0] -= ($dist[1]-$dist[0])/2;
284+
$bounds->[0][1] += ($dist[1]-$dist[0])/2;
285285
} elsif ($dist[0] > $dist[1] && $dist[0]<90) {
286-
$scale->[1][0] -= ($dist[0]-$dist[1])/2;
287-
$scale->[1][1] += ($dist[0]-$dist[1])/2;
286+
$bounds->[1][0] -= ($dist[0]-$dist[1])/2;
287+
$bounds->[1][1] += ($dist[0]-$dist[1])/2;
288288
} elsif ($dist[0] > $dist[1]) {
289-
$scale->[1][0] -= (90-$dist[1])/2;
290-
$scale->[1][1] += (90-$dist[1])/2;
289+
$bounds->[1][0] -= (90-$dist[1])/2;
290+
$bounds->[1][1] += (90-$dist[1])/2;
291291
}
292-
$this->{Scale} = PDL->pdl(PDL::float(), $scale)->t;
292+
$this->{Bounds} = PDL->pdl(PDL::float(), $bounds)->t;
293293
$this->add_lattice_axis;
294294
}
295295

296296
sub transform {
297297
my ($this,$point,$data,$inds) = @_;
298298
barf "no \$inds given" if !defined $inds;
299299
barf "Wrong number of arguments to transform $this\n" if @$inds != 3;
300-
my $range2 = $this->{Scale}->t->diff2->t->slice('0:1');
301-
my $pressure_max = $this->{Scale}->slice('2,1');
300+
my $range2 = $this->{Bounds}->t->diff2->t->slice('0:1');
301+
my $pressure_max = $this->{Bounds}->slice('2,1');
302302
$data = $data->dice_axis(0, $inds);
303303
my $data01_ctr = ($data->slice("0:1")-$this->{Center}) / $range2;
304304
$point->slice("(0)") +=
@@ -317,7 +317,7 @@ sub transform {
317317
package # hide from PAUSE
318318
PDL::Graphics::TriD::PolarStereoAxes;
319319
use base qw(PDL::Graphics::TriD::LatticeAxes);
320-
use fields qw(Names Scale Center);
320+
use fields qw(Names Bounds Center);
321321
use PDL::Core qw(barf float);
322322
use PDL::Constants qw(DEGRAD);
323323
use constant DEG2RAD => 1/DEGRAD;
@@ -331,52 +331,52 @@ sub new {
331331

332332
sub init_scale {
333333
my ($this) = @_;
334-
$this->{Scale} = PDL->pdl(PDL::float(), 'BAD BAD 100; BAD BAD 1012.5');
334+
$this->{Bounds} = PDL->pdl(PDL::float(), 'BAD BAD 100; BAD BAD 1012.5');
335335
}
336336

337337
sub add_scale {
338338
my ($this,$data,$inds) = @_;
339339
barf "no \$inds given" if !defined $inds;
340340
$data = $data->dice_axis(0, $inds);
341341
my $to_minmax = $data->clump(1..$data->ndims-1); # xyz,...
342-
$to_minmax = $to_minmax->glue(1, $this->{Scale}); # include old min/max
342+
$to_minmax = $to_minmax->glue(1, $this->{Bounds}); # include old min/max
343343
my ($mins, $maxes) = $to_minmax->transpose->minmaxover; # each is xyz
344344
if ($maxes->slice(1) >= 90 or $mins->slice(1) <= -90) {
345345
barf "Error in Latitude ", $maxes->slice(1), " ", $mins->slice(1);
346346
}
347-
$this->{Scale} = PDL->pdl($mins, $maxes); # xyz,minmax
347+
$this->{Bounds} = PDL->pdl($mins, $maxes); # xyz,minmax
348348
$this->{Center} = (($maxes + $mins)/2)->slice("0:1");
349349
}
350350

351351
sub finish_scale {
352352
my ($this) = @_;
353353
my @dist;
354354
# Normalize the smallest differences away.
355-
my $scale = $this->{Scale}->t->unpdl;
356-
for (@$scale) {
355+
my $bounds = $this->{Bounds}->t->unpdl;
356+
for (@$bounds) {
357357
if (abs($_->[0] - $_->[1]) < 0.000001) {
358358
$_->[1] = $_->[0] + 1;
359359
}
360360
push(@dist,$_->[1]-$_->[0]);
361361
}
362362
# for the z coordinate reverse the min and max values
363-
my $max = $scale->[2][0];
364-
if ($max < $scale->[2][1]) {
365-
$scale->[2][0] = $scale->[2][1];
366-
$scale->[2][1] = $max;
363+
my $max = $bounds->[2][0];
364+
if ($max < $bounds->[2][1]) {
365+
$bounds->[2][0] = $bounds->[2][1];
366+
$bounds->[2][1] = $max;
367367
}
368-
# Normalize longitude and latitude scale
368+
# Normalize longitude and latitude bounds
369369
if ($dist[1] > $dist[0]) {
370-
$scale->[0][0] -= ($dist[1]-$dist[0])/2;
371-
$scale->[0][1] += ($dist[1]-$dist[0])/2;
370+
$bounds->[0][0] -= ($dist[1]-$dist[0])/2;
371+
$bounds->[0][1] += ($dist[1]-$dist[0])/2;
372372
} elsif ($dist[0] > $dist[1] && $dist[0]<90) {
373-
$scale->[1][0] -= ($dist[0]-$dist[1])/2;
374-
$scale->[1][1] += ($dist[0]-$dist[1])/2;
373+
$bounds->[1][0] -= ($dist[0]-$dist[1])/2;
374+
$bounds->[1][1] += ($dist[0]-$dist[1])/2;
375375
} elsif ($dist[0] > $dist[1]) {
376-
$scale->[1][0] -= (90-$dist[1])/2;
377-
$scale->[1][1] += (90-$dist[1])/2;
376+
$bounds->[1][0] -= (90-$dist[1])/2;
377+
$bounds->[1][1] += (90-$dist[1])/2;
378378
}
379-
$this->{Scale} = PDL->pdl(PDL::float(), $scale)->t;
379+
$this->{Bounds} = PDL->pdl(PDL::float(), $bounds)->t;
380380
$this->add_lattice_axis;
381381
}
382382

@@ -386,8 +386,8 @@ sub transform {
386386
my $i = 0;
387387
barf "Wrong number of arguments to transform $this\n" if @$inds != 3;
388388
$data = $data->dice_axis(0, $inds);
389-
my $range2 = $this->{Scale}->t->diff2->t->slice('0:1');
390-
my $pressure_max = $this->{Scale}->slice('2,1');
389+
my $range2 = $this->{Bounds}->t->diff2->t->slice('0:1');
390+
my $pressure_max = $this->{Bounds}->slice('2,1');
391391
my $data01_ctr = ($data->slice("0:1")-$this->{Center}) / $range2;
392392
$point->slice("(0)") +=
393393
0.5+$data01_ctr->slice("(0)")

0 commit comments

Comments
 (0)