diff -urN ORG/dpam/dmaq2asc.c dpam/dmaq2asc.c
--- ORG/dpam/dmaq2asc.c	2017-12-23 18:00:00.000000000 +0900
+++ dpam/dmaq2asc.c	2019-12-17 10:44:00.000000000 +0900
@@ -5,18 +5,20 @@
 void opnpinc(int argc, char *argv[]);
 void clspin();
 void gparma(char *str, int lnam, char *nam);
+void gparmi(char *str, int *iv);
 char *strdtm();
 int lwkdir_(int *len, char *dnm, size_t ls);
 void abendm_(char *ems, size_t len);
 
 int main(int argc, char *argv[])
-{ char buf[1024+256], sgps[85], shmst[13], smdy[9], zz[9], tz[6], ns[2], ew[2];
+{ char buf[1024+256], sgps[85], shmst[13], smdy[11], zz[9];
+  char rmdy[11]="--/--/----", rhmst[13];
+  char ns[2], ew[2], tz[6]="";
   char wdr[80], flog[80], fnam[80], fout[80];
   double tdif, fm1, fm2, utc, dlat, dlon, tgps, tsec, secg;
   float fgx, fgy, fgz, ralt, balt, ad6, ad7, ad8, galt, sec, dif;
-  int l, li, np, nc, n, ker, nd, krec, lz, tzsec;
-  int key, i, j, nh, nm, hh, mm, k, gQ, gN;
-  int len, ll, lnl[1025];
+  int l, li, np, nc, n, ker, nd, krec, tzsec, iymd=0;
+  int i, j, nh, nm, hh, mm, k, gQ, gN, len, ll, lnl[1025];
   long flen, loff;
   FILE *fp, *fp1, *fp2;
 
@@ -28,33 +30,33 @@
   gparma("Enter LOG filename ==> ", l, &flog[li]);
   gparma("Enter Input filename  ==> ", l, &fnam[li]);
   if ((fp=fopen(fnam, "rb")) == NULL)
-    { abendm_("input file open fail", (size_t)20); }
+    abendm_("input file open fail", (size_t)20);
   gparma("Enter Output filename ==> ", l, &fout[li]);
   if ((fp2=fopen(fout, "wb")) == NULL)
-    { abendm_("output file open fail", (size_t)21); }
-    gparma("Localtime-Zone string ?  \"[+/-]HHMM\" [default: +0900] ==> ",
-            6, tz);
-    if (strlen(tz) == 0) strcpy(tz, "+0900");
-    if ((tz[0] != '+') && (tz[0] != '-'))
-        abendm_("invalid timezone specification", (size_t)30);
-    for (i=1,j=0; i<5; i++) {
-        if ((tz[i] < '0') || (tz[i] > '9'))
-            abendm_("invalid timezone specification", (size_t)30);
-        j = j*10 + (tz[i] - '0');
-        if (i == 2) { nh = j; j = 0; }
-        if (i == 4) { nm = j; j = 0; }
-    }
-    if ((nh>23) || (nm>59))
-        abendm_("invalid timezone specification", (size_t)30);
-    tzsec = nh*3600 + nm*60;
-    if (tz[0] == '-') tzsec = -tzsec;
+    abendm_("output file open fail", (size_t)21);
+  gparma("Localtime-Zone string ?  \"[+/-]HHMM\" [default: +0900] ==> ",
+          6, tz);
+  if (strlen(tz) == 0) strcpy(tz, "+0900");
+  if ((tz[0] != '+') && (tz[0] != '-'))
+      abendm_("invalid timezone specification", (size_t)30);
+  for (i=1,j=0; i<5; i++) {
+      if ((tz[i] < '0') || (tz[i] > '9'))
+          abendm_("invalid timezone specification", (size_t)30);
+      j = j*10 + (tz[i] - '0');
+      if (i == 2) { nh = j; j = 0; }
+      if (i == 4) { nm = j; j = 0; }
+  }
+  if ((nh>23) || (nm>59))
+      abendm_("invalid timezone specification", (size_t)30);
+  tzsec = nh*3600 + nm*60;
+  if (tz[0] == '-') tzsec = -tzsec;
   clspin();
   printf("----------------------------------------\n");
   printf("DMAQ2ASC: Convert G858+GPS DLded data into ASCII format\n");
   printf(" Input filename  : %s\n", fnam);
   printf(" Output filename : %s\n", fout);
   printf(" Localtime zone  : %s\n", tz);
-    printf("   GPS-UTC will be converted into LTsec\n");
+  printf("   GPS-UTC will be converted into LTsec\n");
 /******** data check *********/
   printf("First scanning Data format\n");
   n = 0; ker = 0; np = 0; tdif = 0.;
@@ -63,18 +65,16 @@
     if (nd != 1) {
       ker++; fprintf(stderr, "L.%d: data format error\n", n);
     } else if (krec == 0) {
-      nd = sscanf(buf, "%d %lf %lf %s %s %d %8s",
-                  &krec, &fm1, &fm2, shmst, smdy, &lz, zz);
-      if (nd != 6) {
+      nd = sscanf(buf, "%d %lf %lf %12s %10s",
+                  &krec, &fm1, &fm2, shmst, smdy);
+      if (nd != 5) {
         fprintf(stderr, "L.%d: [0] data format error\n", n); ker++;
       }
     } else if (krec == 21) {
-      nd = sscanf(buf, "%d %s %s %s %d %d %8s",
-                  &krec, sgps, shmst, smdy, &key, &lz, zz);
-      if (nd == 6) {
+      nd = sscanf(buf, "%d %s %12s %10s", &krec, sgps, shmst, smdy);
+      if (nd == 4) {
         if (strncmp(sgps,"$GPGGA",6) == 0) {
-          nd = sscanf(&sgps[6],
-                      ",%lf,%*f,%1[NS],%*f,%1[EW],%*d,%*d,%*f,%*f,M,%f,M",
+          nd = sscanf(&sgps[6], ",%lf,%*f,%1[NS],%*f,%1[EW],%*d,%*d,%*f,%f",
                       &utc, ns, ew, &galt);
           if (nd == 4) {
             j = (int)(utc/10000.); utc -= j*4000;
@@ -87,7 +87,7 @@
               tgps = (double)((hh*60+mm)*60) + sec;
               np++; dif = secg - tgps; tdif += dif;
               if ((dif < -1000.) || (dif > +1000.))
-                abendm_("Mistaken TimeZone or Abnormal Time data", (size_t)39);
+                abendm_("Abnormal Time data or TimeZone", (size_t)30);
             } else {
               fprintf(stderr, "L.%d: TimeStamp error\n", n); ker++;
             }
@@ -101,13 +101,28 @@
         fprintf(stderr, "L.%d: [21] data format error\n", n); ker++;
       }
     } else if (krec == 6) {
-      nd = sscanf(buf, "%d %lf %lf %s %s %d %d",
-                  &krec, &fm1, &fm2, shmst, smdy, &key, &lz);
-      if (nd != 7) {
+      nd = sscanf(buf, "%d %lf %lf %12s %10s",
+                  &krec, &fm1, &fm2, shmst, smdy);
+      if (nd != 5) {
         fprintf(stderr, "L.%d: [6] unexpected rec-format\n", n); ker++;
       }
-    } else {
-      fprintf(stderr, "L.%d: unexpected rec-type = %d\n", n, krec); ker++;
+    }
+    if (iymd == 0) {
+      fprintf(stderr, "DateString: %s\n", smdy);
+      if (sscanf(smdy, "%d/%d/%d", &i,&j,&n) != 3)
+        abendm_("illegal Date-string format", (size_t)26);
+      if ((i<1) || (i>12) || (j<1) || (j>31) || (n<0))
+        abendm_("invalid Date (MM/DD/YY or MM/DD/YYYY)", (size_t)37);
+      if (n < 100) { if (n>=80) n += 1900; else n += 2000; }
+      iymd = n*10000 + i*100 + j;
+      strcpy(rmdy, smdy);
+    }
+    if (strcmp(smdy, rmdy) != 0) {
+      fprintf(stderr, "L.%d: [0] different DATE data\n", n); ker++;
+    }
+    if (krec == 6) {
+      strcpy(rhmst, shmst);
+      fprintf(stderr, "Discontinuity Time: %s\n", shmst);
     }
   }
   if (ker != 0) {
@@ -121,6 +136,7 @@
     tdif /= (double)np; tdif = (double)(int)(tdif*100.) / 100.;
     printf(" G858 TimeVal data will be Shifted by  %+.2f sec.\n", tdif);
   }
+  printf("/DateTime: %08d %s\n", iymd, rhmst);
 /**********************************************/
   if ((fp1=tmpfile()) == NULL)
     { fprintf(stderr, "tmpfile open FAIL\n"); exit(1); }
@@ -155,7 +171,7 @@
   rewind(fp1);
   fclose(fp);
 /**********************************************/
-  fprintf(fp2, "//dmaq2asc v.2017-10-16 by T. Nakatsuka\n");
+  fprintf(fp2, "//dmaq2asc  v.2018-08-18\n");
   fprintf(fp2, "//InputDataFilename: %s\n", fnam);
   if (np == 0) {
     fprintf(fp2, "//G858 TimeVal were conserved.\n");
@@ -163,22 +179,20 @@
     fprintf(fp2, "//G858 TimeVal were Shifted by  %+.2f sec.\n", tdif);
   }
   k = 0;
+  fprintf(fp2, "/DateTime: %08d %s\n", iymd, rhmst);
   fprintf(fp2, "/GPS-UTC was converted into LTsec of Timezone %s\n", tz);
   fprintf(fp2, "/   FID     SYSTIME      t200       MAG");
   fprintf(fp2, "     FGx     FGy     FGz");
   fprintf(fp2, "    Ralt    Balt     AD6     AD7     AD8");
   fprintf(fp2, "    LTsec         LAT          LON     ALT  Q  N\n");
-  strcpy(shmst, "00:00:00.00");
   fgx = fgy = fgz = ralt = balt = ad6 = ad7 = ad8 = 0.;
   while (fgets(buf,1024,fp1) != NULL) {
     sscanf(buf, "%d", &krec);
     if (krec == 21) {
-      sscanf(buf, "%*d %s %s %s %d %d", sgps,shmst,smdy,&key,&lz);
+      sscanf(buf, "%*d %s %12s %10s", sgps,shmst,smdy);
       sscanf(sgps, "%6s,%n", zz, &nc); k = 1;
-      if ((nc != 7) || (strncmp(zz,"$GPGGA",6) != 0)){
-        fprintf(stderr, "*** Unknown Non $GPGGA Pos.data\n");
-        exit(1);
-      }
+      if ((nc != 7) || (strncmp(zz,"$GPGGA",6) != 0))
+        abendm_("*** Unknown: Non $GPGGA Pos.data", (size_t)32);
       sscanf(&sgps[7], "%lf,%lf,%1[NS],%lf,%1[EW],%d,%d,%*f,%f",
              &utc,&dlat,ns,&dlon,ew,&gQ,&gN,&galt);
       j = (int)(utc/10000.); utc -= j*4000;
@@ -194,7 +208,7 @@
       dlon = dlon/60. + (double)j;
       if (ew[0] == 'W') dlon = -dlon;  // dlon in degrees
     } else if (krec == 0) {
-      sscanf(buf, "%*d %lf %lf %s %s %d", &fm1,&fm2,shmst,smdy,&lz);
+      sscanf(buf, "%*d %lf %lf %12s %10s", &fm1,&fm2,shmst,smdy);
       sscanf(shmst, "%d:%d:%f", &hh,&mm,&sec);
       tsec = (double)((hh*60 + mm)*60) + sec + tdif;
       if ((tsec < 0.) || (tsec > 86399.9)) {
@@ -226,6 +240,7 @@
     fprintf(fp2, " Output filename ==> %s\n", fout);
     fprintf(fp2, " Localtime zone  : %s\n", tz);
     fprintf(fp2, "   GPS-UTC was converted into LTsec\n");
+    fprintf(fp2, " DateTime: %08d %s\n", iymd, rhmst);
     if (np == 0) {
       fprintf(fp2, " G858 TimeVal were conserved\n");
       fprintf(fp2, "  because GPS data do not contain any reliable ones\n"); 
diff -urN ORG/dpam/ggrids.f90 dpam/ggrids.f90
--- ORG/dpam/ggrids.f90	2017-12-23 18:00:00.000000000 +0900
+++ dpam/ggrids.f90	2019-12-17 10:44:00.000000000 +0900
@@ -386,6 +386,7 @@
     write(99,'(a,a)') '  trim radius :', strim
     write(99,'(a,a)')   &
       ' Surface grid output filename : ', fnam2(1:lrtrim(fnam2))
+    write(99,'(8x,a,a)') 'Mag. anomaly, and Surface elevation ', can
     write(99,'(a12,a8,6x,a6,i4,4x,4i8)')   &
       'Areaname :  ', area, 'Coord.', ncc, iorg, korg, ispa, ispb
     write(99,'(4x,a)')   &
diff -urN ORG/dpam/pltrk.f90 dpam/pltrk.f90
--- ORG/dpam/pltrk.f90	2017-12-23 18:00:00.000000000 +0900
+++ dpam/pltrk.f90	2021-08-11 20:00:00.000000000 +0900
@@ -2,17 +2,18 @@
   implicit none
   integer :: lwkdir, lrtrim
   external cviken
-  real :: v(30)
+  real(8) :: v(30)
   character(80) :: wdr, flog, fnin, fnam
   character(150) :: buf;  character(20) :: sdtm
-  character(8) :: area, aval;  character(6) :: cu
-  character(4) :: anc;  character(3) :: cg, spl;  character(1) :: yn
+  character(10) :: aval
+  character(8) :: area;  character(6) :: cu, ss
+  character(4) :: s4;  character(3) :: cg, spl;  character(1) :: yn
   integer :: ldr, nc, ncc, iorg, korg, ispa, ispb, IER, i1, i2
   integer :: ktyp, kg, ku, k1, k2, kmx, mc, kpl, kscl, klll, kshl, k
-  integer :: km, iinc, kinc, kp, lc, i, isf, itf, ksf, ktf, idf, kdf
-  real :: xs, ys, rx, ry, fscl, high, wide, ccm, sclr, sclu, dscl
-  real :: vlat, vlon, tlat, tlon, wlat, wlon, ye, xn, px, py, alt, x, y
+  integer :: km, ls, iinc, kinc, kp, lc, i, isf, itf, ksf, ktf, idf, kdf
+  real(8) :: ye, xn, vlat, vlon, tlat, tlon, wlat, wlon, alt
   real :: fi1, fi2, fi3, fi4, fk1, fk2, fk3, fk4
+  real :: xs, ys, rx, ry, fscl, high, wide, ccm, sclr, sclu, dscl, px, py
 
   call premsg('PLTRK : plot trackline path from AM line data')
   call opnpin()
@@ -82,7 +83,7 @@
   if (fnam(ldr:ldr) == ' ') fnam(1:1) = char(0)
   if (fnam(80:80) /= ' ') call abendm('too long filename')
   call gparma('  Areaname (8 chrs max) : ', 8, area)
-  call gparmi('Select Coordinate Number (+200 for WGS) ==> ', ncc)
+  call gparmi('Select Coordinate Number (+800 for Old-TOKYO) ==> ', ncc)
   if (ncc >= 800) then
     mc = 0;  nc = ncc - 800
   else
@@ -135,24 +136,61 @@
   fscl = fscl * 100.
   ccm = fscl/100000.
   kscl = 0;  sclr = 0.;  sclu = 0.;  klll = 0;  kshl = 0
-  km = nint(fscl)/25000
-  if (km < 2) then;  km = 1
-  else if (km < 5) then;  km = 2
-  else if (km < 10) then;  km = 5
-  else if (km < 20) then;  km = 10
-  else if (km < 50) then;  km = 20
-  else;  km = 50
-  endif
-  iinc = km;  kinc = km + km/2
-  if (km == 50) iinc = 60
-  if ((km == 1) .or. (km == 5) .or. (km == 50)) kinc = iinc
-  dscl = float(km)/ccm
+  if (fscl < 25000.) then               !ScaleBar (km [m])
+    km = nint(fscl)/25
+    if (km < 2) then
+      km = 1;  ss = '1 m';  ls = 3
+    else if (km < 5) then
+      km = 2;  ss = '2 m';  ls = 3
+    else if (km < 10) then
+      km = 5;  ss = '5 m';  ls = 3
+    else if (km < 20) then
+      km = 10;  ss = '10 m';  ls = 4
+    else if (km < 50) then
+      km = 20;  ss = '20 m';  ls = 4
+    else if (km < 100) then
+      km = 50;  ss = '50 m';  ls = 4
+    else if (km < 200) then
+      km = 100;  ss = '100 m';  ls = 5
+    else if (km < 500) then
+      km = 200;  ss = '200 m';  ls = 5
+    else
+      km = 500;  ss = '500 m';  ls = 5
+    endif
+      iinc = 1;  kinc = 1               ![LatLonIntv]: 1min x 1min
+    dscl = float(km*100) / fscl
+  else                                  !ScaleBar (km [km])
+    km = nint(fscl)/25000
+    if (km < 2) then
+      km = 1;  ss = '1 km';  ls = 4     ![LatLonIntv]: 1min x 1min
+    else if (km < 5) then
+      km = 2;  ss = '2 km';  ls = 4         !  2min x 3min
+    else if (km < 10) then
+      km = 5;  ss = '5 km';  ls = 4         !  5min x 5min
+    else if (km < 20) then
+      km = 10;  ss = '10 km';  ls = 5       ! 10min x 15min
+    else if (km < 50) then
+      km = 20;  ss = '20 km';  ls = 5       ! 20min x 30min
+    else if (km < 100) then
+      km = 50;  ss = '50 km';  ls = 5       !  1deg x 1deg
+    else if (km < 200) then
+      km = 100;  ss = '100 km';  ls = 6     !  2deg x 3deg
+    else if (km < 500) then
+      km = 200;  ss = '200 km';  ls = 6     !  5deg x 5deg
+    else
+      km = 500;  ss = '500 km';  ls = 6     ! 10deg x 10deg
+    endif
+    iinc = km;  if (km >= 50) iinc = km + km/5;  kinc = iinc
+    if ((km==2) .or. (km==10) .or. (km==20) .or. (km==100))   &
+      kinc = iinc + iinc/2
+    dscl = float(km)/ccm
+  endif
   call prompt('  Draw  Scale Bar  ?  ')
   call gparma('  "y" for Yes, othewise No ==> ', 1, yn)
   if ((yn == 'y') .or. (yn == 'Y')) then
     kscl = 1
-    write(anc,'(f4.1)') dscl
-    call premsg('      size :' // anc // 'cm Wide, 0.8cm High')
+    write(s4,'(f4.1)') dscl
+    call premsg('      size :' // s4 // 'cm Wide, 0.8cm High')
     call prompt('    Lower-Left Pos. ? (right and up)')
     call gparmf2(' in cm ==> ', sclr, sclu)
   endif
@@ -182,8 +220,8 @@
   write(6,'(a,a)') ' Output PS filename  : ', fnam(1:lrtrim(fnam))
   write(6,'(a12,a8,6x,a6,i4,4x,4i8)')   &
     'Areaname :  ', area, 'Coord.', ncc, iorg,korg, ispa,ispb
-  write(6,'(12x,a,f8.2,a,f8.2)') 'SW corner :      x =', xs, '   y =', ys
-  write(6,'(12x,a,f8.2,a,f8.2)') '  area size :    NS=', rx, '   EW=', ry
+  write(6,'(12x,a,f10.3,a,f10.3)') 'SW corner :      x =', xs, '   y =', ys
+  write(6,'(12x,a,f10.3,a,f10.3)') '  area size :    NS=', rx, '   EW=', ry
   write(6,'(6x,a,f8.0,4x,a3,f8.1,a1,f8.1,a1)')   &
     'scale  1 /', fscl, spl, high, 'H', wide, 'W'
   if ((kscl /= 0) .or. (klll /= 0) .or. (kshl /= 0)) then
@@ -202,15 +240,15 @@
   call cvinit(ncc,float(iorg),float(korg),float(ispa),float(ispb))
   call plots(1.5, 1.5)
   call wrect(0., 0., wide, high)
-  call lstyle('T', 0.4, 0., 0, -255)
-  write(aval,'(f8.1)') xs
-  call ptext(aval, 8, -0.1, 0., 1)
-  write(aval,'(f8.1)') xs+rx
-  call ptext(aval, 8, -0.1, high-0.28, 1)
-  write(aval,'(f8.1)') ys
-  call ptext(aval, 8, 0.7, -0.4, 1)
-  write(aval,'(f8.1)') ys+ry
-  call ptext(aval, 8, wide, -0.4, 1)
+  call lstyle('T', 0.4, 0., 0, -999)
+  write(aval,'(f10.3)') xs
+  call ptext(aval, 10, 0.7, 0.05, 1)
+  write(aval,'(f10.3)') xs+rx
+  call ptext(aval, 10, 0.7, high-0.35, 1)
+  write(aval,'(f10.3)') ys
+  call ptext(aval, 10, 1.5, -0.35, 1)
+  write(aval,'(f10.3)') ys+ry
+  call ptext(aval, 10, wide, -0.35, 1)
   kp = 3
   do
     read(1,'(a)',iostat=IER) buf
@@ -243,15 +281,15 @@
       vlat = v(k1)*60. + v(k1+1);  vlon = v(k2)*60. + v(k2+1)
     endif
     if ((kg == 1) .and. (ncc >= 800)) then
-      call xw84t(vlat, vlon, 0., tlat, tlon, alt)
-      call cviken(tlat, tlon, ye, xn)
+      call xw84td(vlat, vlon, 0.d0, tlat, tlon, alt)
+      call cvdiken(tlat, tlon, ye, xn)
     else if ((kg == 2) .and. (ncc < 800)) then
-      call xtw84(vlat, vlon, 0., wlat, wlon, alt)
-      call cviken(wlat, wlon, ye, xn)
+      call xtw84d(vlat, vlon, 0.d0, wlat, wlon, alt)
+      call cvdiken(wlat, wlon, ye, xn)
     else
-      call cviken(vlat, vlon, ye, xn)
+      call cvdiken(vlat, vlon, ye, xn)
     endif
-    px = (ye-ys) / ccm;  py = (xn-xs) / ccm
+    px = sngl(ye-ys) / ccm;  py = sngl(xn-xs) / ccm
     call plot(px, py, kp)
     kp = 2
   enddo
@@ -264,9 +302,8 @@
     call plot(sclr+dscl, sclu,     2)
     call plot(sclr,      sclu,     2)
     call plot(sclr,      sclu+0.3, 2)
-    write(anc,'(i2,a2)') km, 'km'
     call lstyle('T', 0.5, 0., 0, -255)
-    call ptext(anc, 4, sclr+dscl/2., sclu+0.5, 2)
+    call ptext(ss, ls, sclr+dscl/2., sclu+0.5, 2)
     call newpen(1)
   endif
   call scisor(0., 0., wide, high)
@@ -276,30 +313,30 @@
     call cvenik(ys+ry, xs,    fi2, fk2)
     call cvenik(ys,    xs+rx, fi3, fk3)
     call cvenik(ys+ry, xs+rx, fi4, fk4)
-    isf = nint(amin1(fi1,fi2) - 0.5)
-    itf = nint(amax1(fi3,fi4) + 0.5)
-    ksf = nint(amin1(fk1,fk3) - 0.5)
-    ktf = nint(amax1(fk2,fk4) + 0.5)
+    isf = nint(dmin1(fi1,fi2) - 0.5)
+    itf = nint(dmax1(fi3,fi4) + 0.5)
+    ksf = nint(dmin1(fk1,fk3) - 0.5)
+    ktf = nint(dmax1(fk2,fk4) + 0.5)
   endif
   if (klll /= 0) then
     do i=isf/iinc,itf/iinc
       idf = i * iinc
       if ((idf < isf) .or. (idf > itf)) cycle
-      call cviken(float(idf), float(ksf), y, x)
-      call plot((y-ys)/ccm, (x-xs)/ccm, 3)
+      call cvdiken(dble(idf), dble(ksf), ye, xn)
+      call plot(sngl(ye-ys)/ccm, sngl(xn-xs)/ccm, 3)
       do kdf=ksf+1,ktf
-        call cviken(float(idf), float(kdf), y, x)
-        call plot((y-ys)/ccm, (x-xs)/ccm, 2)
+        call cvdiken(dble(idf), dble(kdf), ye, xn)
+        call plot(sngl(ye-ys)/ccm, sngl(xn-xs)/ccm, 2)
       enddo
     enddo
     do k=ksf/kinc,ktf/kinc
       kdf = k * kinc
       if ((kdf < ksf) .or. (kdf > ktf)) cycle
-      call cviken(float(isf), float(kdf), y, x)
-      call plot((y-ys)/ccm, (x-xs)/ccm, 3)
+      call cvdiken(dble(isf), dble(kdf), ye, xn)
+      call plot(sngl(ye-ys)/ccm, sngl(xn-xs)/ccm, 3)
       do idf=isf+1,itf
-        call cviken(float(idf), float(kdf), y, x)
-        call plot((y-ys)/ccm, (x-xs)/ccm, 2)
+        call cvdiken(dble(idf), dble(kdf), ye, xn)
+        call plot(sngl(ye-ys)/ccm, sngl(xn-xs)/ccm, 2)
       enddo
     enddo
   endif
@@ -324,8 +361,8 @@
     write(99,'(a,a)') ' Output PS filename  : ', fnam(1:lrtrim(fnam))
     write(99,'(a12,a8,6x,a6,i4,4x,4i8)')   &
       'Areaname :  ', area, 'Coord.', ncc, iorg,korg,ispa,ispb
-    write(99,'(12x,a,f8.2,a,f8.2)') 'SW corner :      x =', xs, '   y =', ys
-    write(99,'(12x,a,f8.2,a,f8.2)') '  area size :    NS=', rx, '   EW=', ry
+    write(99,'(12x,a,f10.3,a,f10.3)') 'SW corner :      x =', xs, '   y =', ys
+    write(99,'(12x,a,f10.3,a,f10.3)') '  area size :    NS=', rx, '   EW=', ry
     write(99,'(6x,a,f8.0,4x,a3,f8.1,a1,f8.1,a1)')   &
       'scale  1 /', fscl, spl, high, 'H', wide, 'W'
     if ((kscl /= 0) .or. (klll /= 0) .or. (kshl /= 0)) then
diff -urN ORG/dpam/xldam.f90 dpam/xldam.f90
--- ORG/dpam/xldam.f90	2017-12-23 18:00:00.000000000 +0900
+++ dpam/xldam.f90	2019-12-17 10:44:00.000000000 +0900
@@ -8,7 +8,7 @@
 !*************************************************************
   implicit none
   real,parameter :: xdeg = 111111.1         ! length (m) of 1 deg. meridian
-  real(8),parameter :: pai = (3.14159265359/180.)
+  real,parameter :: pai = (3.14159/180.)
   integer :: lwkdir, lrtrim
   real :: fid(300), fx(300), fy(300), fz(300)
   real(8) :: tmag(300), wtm(300), secs(300)
@@ -127,7 +127,7 @@
         write(str(1:8),'(f8.1)') fid(1)
         call premsg('--- GPS data lost after Fid.=' // str(1:8))
       endif
-      sec = secs(nps) - secn
+      sec = sngl(secs(nps) - secn)
       write(6,'(a,f8.2,a,f7.1)')   &
         '  AM time-offset: ', sec, ' sec at Fid.=', fid(nps)
       write(9,'(a,f8.2,a,f7.1)')   &
@@ -142,17 +142,18 @@
     do while ((it <= 80) .and. (str(it:it) /= ' '));  it = it + 1;  enddo
     if (it > 80) call abendm('Lines.Inf. data illegal')
     name = str(is:it-1)
+!***
     if (kc == 0) then
       read(str(it:80),*) tms, tme
+      xnc = 0.;  yec = 0.;  zuc = 0.
     else
-!***
       read(str(it:80),*) tms, tme, dir
       dir = dir * pai
       xnc = forwd*cos(dir) - strbd*sin(dir)
       yec = forwd*sin(dir) + strbd*cos(dir)
       zuc = -dwnwd
-!***
     endif
+!***
     write(str,'(a8,1x,i9,1x,f9.2,1x,f9.2)') name, iymd, tms, tme
     call premsg('   Line: ' // str(1:38))
     write(20,'(a1,a)') '&', str(1:38)
@@ -175,7 +176,7 @@
         if (secs(mps) < secst) cycle
         kintv = kintv - 1
         if (kintv == 0) then
-          f = (secs(mps)-sec1) / (secn-sec1)
+          f = sngl(secs(mps)-sec1) / sngl(secn-sec1)
           dido = dido1 + (didon-dido1)*f
           dkdo = dkdo1 + (dkdon-dkdo1)*f
           falt = falt1 + (faltn-falt1)*f
@@ -189,7 +190,7 @@
           if ((dido < -80.) .or. (dido > 80.))  &
             call abendm('Polar region not supported')
           if (abs(dido-didop) > 0.175) then
-            didop = dido;  ydeg = xdeg * cos(dido * pai)
+            didop = dido;  ydeg = xdeg * cos(sngl(dido) * pai)
           endif
           dido = dido + xnc/xdeg;  dkdo = dkdo + yec/ydeg;  falt = falt + zuc
 !***
@@ -280,6 +281,7 @@
     write(99,'(a,f7.2)') '   Year of survey  : ', year
     write(99,'(a,i2)')   '   IGRF generation : ', ngn
     write(99,'(a,i3)')   '  Data thin-out ratio :', intv
+!***
     if (kc == 0) then
       write(99,'(a)')   '  Not corrected for Mag.Sensor offset from GPS'
     else
@@ -287,6 +289,7 @@
       write(99,'(3(6x,a,f6.2))')  &
         'Forward:', forwd, 'Starboard:', strbd, 'Downward:', dwnwd
     endif
+!***
     do
       read(9,'(a)',iostat=IER) line
       if (IER < 0) exit
diff -urN ORG/dpam/xldpn.f90 dpam/xldpn.f90
--- ORG/dpam/xldpn.f90	2017-12-23 18:00:00.000000000 +0900
+++ dpam/xldpn.f90	2019-12-17 10:44:00.000000000 +0900
@@ -8,7 +8,7 @@
 !*************************************************************
   implicit none
   real,parameter :: xdeg = 111111.1         ! length (m) of 1 deg. meridian
-  real(8),parameter :: pai = (3.14159265359/180.)
+  real,parameter :: pai = (3.14159/180.)
   integer :: lwkdir, lrtrim
   character(80) :: wdr, flog, finf, fnam, fpos, fout
   character(160) :: line;  character(80) :: str;  character(60) :: ss
@@ -19,7 +19,7 @@
   real :: fid, fx, fy, fz, year, sec
   real :: falt, falta, faltb, f, tigrf, tres
   real(8) :: wtm, tms, tme, tmsr, tmer
-  real :: sect, seca, secb, secst, seced
+  real(8) :: sect, seca, secb, secst, seced
   real(8) :: tmag, dido, didoa, didob, dkdo, dkdoa, dkdob, didop
 
   call premsg('XLDPN : Extract Line data  from daq2asc output')
@@ -56,6 +56,7 @@
   call gparmi(' Generation number of IGRF : ', ngn)
   call gparmi(' Thin-out Ratio N (crop 1 out of N) ==> ', intv)
   if (intv <= 0) intv = 1
+!***
   call premsg(' Correction for Mag.Sensor offset from GPS antenna')
   call premsg('  (To disable correction, Enter blank line or "0  0  0")')
   call parmin('    [Forward, Starboard, Downward] (in m)  ==> ', 80, str)
@@ -70,6 +71,7 @@
       (dwnwd > 50.) .or. (dwnwd < -50.))  &
     call abendm('Abnormal offset data')
   if ((forwd == 0.) .and. (strbd == 0.) .and. (dwnwd == 0.)) kc = 0;
+!***
   call clspin()
   write(6,'(a)') '----------------------------------------'
   write(6,'(a)') 'XLDPN : Extract Line data  from daq2asc output'
@@ -86,9 +88,11 @@
   write(6,'(a,f7.2)') '   Year of survey  : ', year
   write(6,'(a,i2)')   '   IGRF generation : ', ngn
   write(6,'(a,i3)')   '  Data thin-out ratio :', intv
+!***
   write(6,'(a)')   ' Mag.Sensor offset from GPS antenna (m)'
   write(6,'(3(6x,a,f6.2))')  &
     'Forward:', forwd, 'Starboard:', strbd, 'Downward:', dwnwd
+!***
   call gigrf(ngn, year)
   open(9,status='scratch')
   kam = 0; kpn = 0
@@ -167,8 +171,10 @@
     do while ((it <= 80) .and. (str(it:it) /= ' '));  it = it + 1;  enddo
     if (it > 80) call abendm('Lines.Inf. data illegal')
     name = str(is:it-1)
+!***
     if (kc == 0) then
       read(str(it:80),*) tms, tme
+      xnc = 0.;  yec = 0.;  zuc = 0.
     else
       read(str(it:80),*) tms, tme, dir
       dir = dir * pai
@@ -176,6 +182,7 @@
       yec = forwd*sin(dir) + strbd*cos(dir)
       zuc = -dwnwd
     endif
+!***
     read(str(it:80),*) tms, tme
     write(str,'(a8,1x,i9,1x,f9.2,1x,f9.2)') name, iymd, tms, tme
     call premsg('   Line: ' // str(1:38))
@@ -228,7 +235,7 @@
       enddo
       kintv = kintv - 1
       if (kintv == 0) then
-        f = (sect-seca) / (secb-seca)
+        f = sngl(sect-seca) / sngl(secb-seca)
         dido = didoa + (didob-didoa)*f
         dkdo = dkdoa + (dkdob-dkdoa)*f
         falt = falta + (faltb-falta)*f
@@ -242,7 +249,7 @@
         if ((dido < -80.) .or. (dido > 80.))  &
           call abendm('Polar region not supported')
         if (abs(dido-didop) > 0.175) then
-          didop = dido;  ydeg = xdeg * cos(dido * pai)
+          didop = dido;  ydeg = xdeg * cos(sngl(dido) * pai)
         endif
         dido = dido + xnc/xdeg;  dkdo = dkdo + yec/ydeg;  falt = falt + zuc
 !***
@@ -287,6 +294,7 @@
     write(99,'(a,f7.2)') '   Year of survey  : ', year
     write(99,'(a,i2)')   '   IGRF generation : ', ngn
     write(99,'(a,i3)')   '  Data thin-out ratio :', intv
+!***
     if (kc == 0) then
       write(99,'(a)')   '  Not corrected for Mag.Sensor offset from GPS'
     else
@@ -294,6 +302,7 @@
       write(99,'(3(6x,a,f6.2))')  &
         'Forward:', forwd, 'Starboard:', strbd, 'Downward:', dwnwd
     endif
+!***
     do
       read(9,'(a)',iostat=IER) line
       if (IER < 0) exit
