11 |
|
my $mult = 179.0; # Multiplier. Default W/sr/m2 -> cd/m2 |
12 |
|
my $label = 'cd/m2'; # Units shown in legend |
13 |
|
my $scale = 1000; # Top of the scale |
14 |
+ |
my $matchscale = 1; # Adjust top of scale to match given label |
15 |
|
my $decades = 0; # Default is linear mapping |
16 |
|
my $pal = 'def'; # Palette |
17 |
|
my $redv = "${pal}_red(v)"; # Mapping functions for R,G,B |
43 |
|
} elsif (m/-s/) { # Scale |
44 |
|
$scale = shift; |
45 |
|
if ($scale =~ m/[aA].*/) { |
46 |
+ |
$matchscale = 0; |
47 |
|
$needfile = 1; |
48 |
< |
} |
48 |
> |
} else { |
49 |
> |
$matchscale = 1; |
50 |
> |
} |
51 |
|
} elsif (m/-l$/) { # Label |
52 |
|
$label = shift; |
53 |
|
} elsif (m/-log/) { # Logarithmic mapping |
98 |
|
} |
99 |
|
} |
100 |
|
|
101 |
+ |
if (($legwidth <= 20) || ($legheight <= 40)) { |
102 |
+ |
# Legend is too small to be legible. Don't bother doing one. |
103 |
+ |
$legwidth = 0; |
104 |
+ |
$legheight = 0; |
105 |
+ |
$loff = 0; |
106 |
+ |
$matchscale = 0; |
107 |
+ |
} |
108 |
+ |
|
109 |
|
# Temporary directory. Will be removed upon successful program exit. |
110 |
|
my $td = tempdir( CLEANUP => 1 ); |
111 |
|
|
133 |
|
# 3.94282 6 |
134 |
|
my $LogLmax = $histo[0]; |
135 |
|
$scale = $mult / 179 * 10**$LogLmax; |
136 |
+ |
} elsif ($matchscale) { |
137 |
+ |
# Adjust scale so legend reflects -s setting |
138 |
+ |
if ($decades > 0) { |
139 |
+ |
$scale *= 10**($decades/(2.*$ndivs)); |
140 |
+ |
} else { |
141 |
+ |
$scale *= $ndivs/($ndivs - .5); |
142 |
+ |
} |
143 |
|
} |
144 |
|
|
145 |
|
my $pc0 = "$td/pc0.cal"; |
283 |
|
my $slabpic = "$td/slab.hdr"; |
284 |
|
my $cmd; |
285 |
|
|
286 |
< |
if (($legwidth > 20) && ($legheight > 40)) { |
286 |
> |
if ($legwidth > 0) { |
287 |
|
# Legend: Create the text labels |
288 |
|
my $sheight = floor($legheight / $ndivs + 0.5); |
289 |
|
$legheight = $sheight * $ndivs; |
313 |
|
$cmd .= qq[ -x $legwidth -y $legheight > $scolpic]; |
314 |
|
system $cmd; |
315 |
|
} else { |
297 |
– |
# Legend is too small to be legible. Don't bother doing one. |
298 |
– |
$legwidth = 0; |
299 |
– |
$legheight = 0; |
300 |
– |
$loff = 0; |
301 |
– |
|
316 |
|
# Create dummy colour scale and legend labels so we don't |
317 |
|
# need to change the final command line. |
318 |
|
open(FHscolpic, ">$scolpic"); |