1
0
Fork 0

Fixed [hopefully] the magvar decoding. The last four digits are quite

clearly the date of installation at that particular offset.  Offsets are
usually not changed because this would imply moving intersection points,
fixes, changing approaches, and all sorts of cascading effects.  GEP near
my house hasn't been adjusted since 1965; it is now about 8 degrees off the
real current magvar.
This commit is contained in:
curt 2003-04-10 18:04:40 +00:00
parent d53b612e2a
commit b86a09cd7f

View file

@ -94,6 +94,18 @@ sub write_navaid {
$magvar, $name, $TYPE_NAMES[$type]); $magvar, $name, $TYPE_NAMES[$type]);
} }
sub make_dmagvar {
my($coord) = shift;
my( $value );
my( $dir, $deg, $date ) = $coord =~ m/^([EW])(\d\d\d\d)(\d\d\d\d)/;
$value = $deg / 10.0;
if ( $dir eq "W" ) {
$value = -$value;
}
return $value;
}
<>; # skip header line <>; # skip header line
@ -125,8 +137,13 @@ while (<>)
if ($magvar eq '') { if ($magvar eq '') {
$magvar = 'XXX'; $magvar = 'XXX';
} else { } else {
$magvar =~ /^([EW])([0-9.]+)( .*)?/; my $tmp = make_dmagvar( $magvar );
$magvar = sprintf("%02d%s", $2/100000, $1); # print "$magvar $tmp\n";
if ( $tmp <= 0 ) {
$magvar = sprintf("%02.0fW", -$tmp );
} else {
$magvar = sprintf("%02.0fE", $tmp );
}
} }
my $name = $F[5]; my $name = $F[5];