]> git.mxchange.org Git - flightgear.git/commitdiff
Fixed [hopefully] the magvar decoding. The last four digits are quite
authorcurt <curt>
Thu, 10 Apr 2003 18:04:40 +0000 (18:04 +0000)
committercurt <curt>
Thu, 10 Apr 2003 18:04:40 +0000 (18:04 +0000)
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.

scripts/perl/dafif/dafift2nav.pl

index 570eb7a485af3b15934b497368776f40fb0fa05f..8d0787b714cab03d9eea768e834a410ec46b8960 100755 (executable)
@@ -94,6 +94,18 @@ sub write_navaid {
          $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
 
@@ -125,8 +137,13 @@ while (<>)
   if ($magvar eq '') {
     $magvar = 'XXX';
   } else {
-    $magvar =~ /^([EW])([0-9.]+)( .*)?/;
-    $magvar = sprintf("%02d%s", $2/100000, $1);
+    my $tmp = make_dmagvar( $magvar );
+    # print "$magvar $tmp\n";
+    if ( $tmp <= 0 ) {
+        $magvar = sprintf("%02.0fW", -$tmp );
+    } else {
+        $magvar = sprintf("%02.0fE", $tmp );
+    }
   }
   my $name = $F[5];