[Shake-dev] plotregr bug

Peter Lombard lombard at seismo.berkeley.edu
Mon Aug 27 22:37:54 GMT 2007


Howdy ShakeMappers,

I found a stupid little bug in plotregr that makes it plot flagged stations at
the wrong amplitude. (plotregr is the program for plotting station data
against the regression curves. It is intended only to assist with event
review; its results don't normally get published.)

In the subroutine make_plot, find the section of code like this:

    # Plot each station and maybe its label
    my ($color, $peak, $symbol, $flagged);
    foreach $sta (@$staref) {
	$flagged = $sta->get_any_flag();
	# Station->peak() returns undef if any channel is flagged
	if ($flagged) {  # We have to search for the peak
	    foreach my $chan ($sta->channels()) {
		next if (substr(uc $chan,-1) eq 'Z');
		$peak = $sta->amp($type, $chan) 
		    if ($sta->amp($type, $chan) > $peak);
	    }
	}

Right after the "if ($flagged)" line, add this line:
	    $peak = 0;

The corrected code should look like this:

    # Plot each station and maybe its label
    my ($color, $peak, $symbol, $flagged);
    foreach $sta (@$staref) {
	$flagged = $sta->get_any_flag();
	# Station->peak() returns undef if any channel is flagged
	if ($flagged) {  # We have to search for the peak
	    $peak = 0;
	    foreach my $chan ($sta->channels()) {
		next if (substr(uc $chan,-1) eq 'Z');
		$peak = $sta->amp($type, $chan) 
		    if ($sta->amp($type, $chan) > $peak);
	    }
	}

Sorry if this bug caused any confusion!

Pete

-- 
Pete Lombard
Seismological Laboratory       
215 McCone Hall
University of California
Berkeley, CA 94720-4760

lombard at seismo.berkeley.edu
(510) 642-0073




More information about the Shake-dev mailing list