diff -u ORG/anam/adeq.f90 anam/adeq.f90
--- ORG/anam/adeq.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/adeq.f90	2018-05-15 18:18:10.000000000 +0900
@@ -206,6 +206,7 @@
   dv = sqrt(ss / float(ndpt))
   write(6,'(a,i4,a,f8.2,a,f7.2)')   &
     ' loop', klp, '   rms.Step :', ds, '   rms.Residual :', dv
+  flush(6)        !--- or  call flush(6)
   open(9,status='scratch')
   write(9,*) klp, ds, dv
 
@@ -230,6 +231,7 @@
     dv = sqrt(ss / float(ndpt))
     write(6,'(a,i4,a,f8.2,a,f7.2)')   &
     ' loop', klp, '   rms.Step :', ds, '   rms.Residual :', dv
+    flush(6)        !--- or  call flush(6)
     write(9,*) klp, ds, dv
   enddo
   close(20)
diff -u ORG/anam/adeqc.f90 anam/adeqc.f90
--- ORG/anam/adeqc.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/adeqc.f90	2018-05-15 18:18:10.000000000 +0900
@@ -205,6 +205,7 @@
   lp = 0
   write(6,'(a,i4,i3,a,f8.2,a,f7.2)')   &
     ' loop', klp, lp, '   rms.Step :', ds, '   rms.Residual :', dv
+  flush(6)        !--- or  call flush(6)
   open(9,status='scratch')
   write(9,*) klp, lp, ds, dv
 
@@ -235,6 +236,7 @@
     endif
     write(6,'(a,i4,i3,a,f8.2,a,f7.2)')   &
       ' loop', klp, lp, '   rms.Step :', ds, '   rms.Residual :', dv
+    flush(6)        !--- or  call flush(6)
     write(9,*) klp, lp, ds, dv
     if ((lp >= 5) .or. (dv < 0.1) .or. (ilp >= nloop)) exit
   enddo
diff -u ORG/anam/adeqs.f90 anam/adeqs.f90
--- ORG/anam/adeqs.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/adeqs.f90	2018-05-15 18:18:10.000000000 +0900
@@ -209,6 +209,7 @@
   dv = sqrt(ss / float(ndpt))
   write(6,'(a,i4,a,f8.2,a,f7.2)')   &
     ' loop', klp, '   rms.Step :', ds, '   rms.Residual :', dv
+  flush(6)        !--- or  call flush(6)
   open(9,status='scratch')
   write(9,*) klp, ds, dv
 
@@ -233,6 +234,7 @@
     dv = sqrt(ss / float(ndpt))
     write(6,'(a,i4,a,f8.2,a,f7.2)')   &
       ' loop', klp, '   rms.Step :', ds, '   rms.Residual :', dv
+    flush(6)        !--- or  call flush(6)
     write(9,*) klp, ds, dv
   enddo
   close(20)
diff -u ORG/anam/adeqsc.f90 anam/adeqsc.f90
--- ORG/anam/adeqsc.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/adeqsc.f90	2018-05-15 18:18:10.000000000 +0900
@@ -209,6 +209,7 @@
   lp = 0
   write(6,'(a,i4,i3,a,f8.2,a,f7.2)')   &
     ' loop', klp, lp, '   rms.Step :', ds, '   rms.Residual :', dv
+  flush(6)        !--- or  call flush(6)
   open(9,status='scratch')
   write(9,*) klp, lp, ds, dv
 
@@ -239,6 +240,7 @@
     endif
     write(6,'(a,i4,i3,a,f8.2,a,f7.2)')   &
       ' loop', klp, lp, '   rms.Step :', ds, '   rms.Residual :', dv
+    flush(6)        !--- or  call flush(6)
     write(9,*) klp, lp, ds, dv
     if ((lp >= 5) .or. (dv < 0.1) .or. (ilp >= nloop)) exit
   enddo
diff -u ORG/anam/amag.f90 anam/amag.f90
--- ORG/anam/amag.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/amag.f90	2018-05-15 18:18:08.000000000 +0900
@@ -245,6 +245,7 @@
   dv = sqrt(ss / float(n))
   write(6,'(a,i4,a,f9.3,a,f7.2)')   &
     ' loop', klp, '   rms.Step :', ds, '   rms.Residual :', dv
+  flush(6)        !--- or  call flush(6)
   open(9,status='scratch')
   write(9,*) klp, ds, dv
 
@@ -272,6 +273,7 @@
     dv = sqrt(ss / float(n))
     write(6,'(a,i4,a,f9.3,a,f7.2)')   &
       ' loop', klp, '   rms.Step :', ds, '   rms.Residual :', dv
+    flush(6)        !--- or  call flush(6)
     write(9,*) klp, ds, dv
   enddo
   write(6,'(1x)')
diff -u ORG/anam/amagc.f90 anam/amagc.f90
--- ORG/anam/amagc.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/amagc.f90	2018-05-15 18:18:08.000000000 +0900
@@ -241,6 +241,7 @@
   dv = sqrt(ss / float(n));  lp = 0
   write(6,'(a,i4,i3,a,f9.3,a,f7.2)')   &
     ' loop', klp, lp, '   rms.Step :', ds, '   rms.Residual :', dv
+  flush(6)        !--- or  call flush(6)
   open(9,status='scratch')
   write(9,*) klp, lp, ds, dv
 
@@ -273,6 +274,7 @@
     endif
     write(6,'(a,i4,i3,a,f9.3,a,f7.2)')   &
       ' loop', klp, lp, '   rms.Step :', ds, '   rms.Residual :', dv
+    flush(6)        !--- or  call flush(6)
     write(9,*) klp, lp, ds, dv
     if ((lp >= 5) .or. (dv < 0.1) .or. (ilp >= nloop)) exit
   enddo
diff -u ORG/anam/ameq.f90 anam/ameq.f90
--- ORG/anam/ameq.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/ameq.f90	2019-12-10 11:45:00.000000000 +0900
@@ -239,6 +239,7 @@
   dv = sqrt(ss / float(n))
   write(6,'(a,i4,a,f8.2,a,f7.2)')   &
     ' loop', klp, '   rms.Step :', ds, '   rms.Residual :', dv
+  flush(6)        !--- or  call flush(6)
   open(9,status='scratch')
   write(9,*) klp, ds, dv
 
@@ -252,14 +253,14 @@
     do j=1,mym; do i=1,mxm;  p(i,j) = v(i,j) + a*p(i,j);  enddo; enddo
     call conv1(g,nfx,nfy, p,mxm,mym, q,mxf,myf)
     pqq = 0.
-    do j=1,myf; do i=1,myf; pqq = pqq + q(i,j)*q(i,j);  enddo; enddo
+    do j=1,myf; do i=1,mxf; pqq = pqq + q(i,j)*q(i,j);  enddo; enddo
     a = pvv / pqq;  ss = 0.
     do j=1,mym; do i=1,mxm
       s(i,j) = s(i,j) + a*p(i,j)
       if (t(i,j) /= tnul) ss = ss + p(i,j)*p(i,j)
     enddo; enddo
     ds = a * sqrt(ss / float(mxm*mym));  n = 0;  ss = 0.
-    do j=1,myf; do i=1,myf
+    do j=1,myf; do i=1,mxf
       if (f(i,j) /= vnul) then
         r(i,j) = r(i,j) - a*q(i,j)
         ss = ss + r(i,j)*r(i,j);  n = n + 1
@@ -268,6 +269,7 @@
     dv = sqrt(ss / float(n))
     write(6,'(a,i4,a,f8.2,a,f7.2)')   &
     ' loop', klp, '   rms.Step :', ds, '   rms.Residual :', dv
+    flush(6)        !--- or  call flush(6)
     write(9,*) klp, ds, dv
   enddo
   close(20)
diff -u ORG/anam/ameqc.f90 anam/ameqc.f90
--- ORG/anam/ameqc.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/ameqc.f90	2019-12-10 11:45:00.000000000 +0900
@@ -237,6 +237,7 @@
   lp = 0
   write(6,'(a,i4,i3,a,f8.2,a,f7.2)')   &
     ' loop', klp, lp, '   rms.Step :', ds, '   rms.Residual :', dv
+  flush(6)        !--- or  call flush(6)
   open(9,status='scratch')
   write(9,*) klp, lp, ds, dv
 
@@ -250,14 +251,14 @@
     do j=1,mym; do i=1,mxm;  p(i,j) = v(i,j) + a*p(i,j);  enddo; enddo
     call conv1(g,nfx,nfy, p,mxm,mym, q,mxf,myf)
     pqq = 0.
-    do j=1,myf; do i=1,myf; pqq = pqq + q(i,j)*q(i,j);  enddo; enddo
+    do j=1,myf; do i=1,mxf; pqq = pqq + q(i,j)*q(i,j);  enddo; enddo
     a = pvv / pqq;  ss = 0.
     do j=1,mym; do i=1,mxm
       s(i,j) = s(i,j) + a*p(i,j)
       if (t(i,j) /= tnul) ss = ss + p(i,j)*p(i,j)
     enddo; enddo
     ds = a * sqrt(ss / float(mxm*mym));  n = 0;  ss = 0.
-    do j=1,myf; do i=1,myf
+    do j=1,myf; do i=1,mxf
       if (f(i,j) /= vnul) then
         r(i,j) = r(i,j) - a*q(i,j)
         ss = ss + r(i,j)*r(i,j);  n = n + 1
@@ -271,6 +272,7 @@
     endif
     write(6,'(a,i4,i3,a,f8.2,a,f7.2)')   &
       ' loop', klp, lp, '   rms.Step :', ds, '   rms.Residual :', dv
+    flush(6)        !--- or  call flush(6)
     write(9,*) klp, lp, ds, dv
     if ((lp >= 5) .or. (dv < 0.1) .or. (ilp >= nloop)) exit
   enddo
diff -u ORG/anam/ameqs.f90 anam/ameqs.f90
--- ORG/anam/ameqs.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/ameqs.f90	2019-12-10 11:45:00.000000000 +0900
@@ -242,6 +242,7 @@
   dv = sqrt(ss / float(n))
   write(6,'(a,i4,a,f8.2,a,f7.2)')   &
     ' loop', klp, '   rms.Step :', ds, '   rms.Residual :', dv
+  flush(6)        !--- or  call flush(6)
   open(9,status='scratch')
   write(9,*) klp, ds, dv
 
@@ -255,14 +256,14 @@
     do j=1,mym; do i=1,mxm;  p(i,j) = v(i,j) + a*p(i,j);  enddo; enddo
     call conv1(g,nfx,nfy, p,mxm,mym, q,mxf,myf)
     pqq = 0.
-    do j=1,myf; do i=1,myf; pqq = pqq + q(i,j)*q(i,j);  enddo; enddo
+    do j=1,myf; do i=1,mxf; pqq = pqq + q(i,j)*q(i,j);  enddo; enddo
     a = pvv / pqq;  ss = 0.
     do j=1,mym; do i=1,mxm
       s(i,j) = s(i,j) + a*p(i,j)
       if (t(i,j) /= tnul) ss = ss + p(i,j)*p(i,j)
     enddo; enddo
     ds = a * sqrt(ss / float(mxm*mym));  n = 0;  ss = 0.
-    do j=1,myf; do i=1,myf
+    do j=1,myf; do i=1,mxf
       if (f(i,j) /= vnul) then
         r(i,j) = r(i,j) - a*q(i,j)
         ss = ss + r(i,j)*r(i,j);  n = n + 1
@@ -271,6 +272,7 @@
     dv = sqrt(ss / float(n))
     write(6,'(a,i4,a,f8.2,a,f7.2)')   &
     ' loop', klp, '   rms.Step :', ds, '   rms.Residual :', dv
+    flush(6)        !--- or  call flush(6)
     write(9,*) klp, ds, dv
   enddo
   close(20)
diff -u ORG/anam/ameqsc.f90 anam/ameqsc.f90
--- ORG/anam/ameqsc.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/ameqsc.f90	2019-12-10 11:45:00.000000000 +0900
@@ -241,6 +241,7 @@
   lp = 0
   write(6,'(a,i4,i3,a,f8.2,a,f7.2)')   &
     ' loop', klp, lp, '   rms.Step :', ds, '   rms.Residual :', dv
+  flush(6)        !--- or  call flush(6)
   open(9,status='scratch')
   write(9,*) klp, lp, ds, dv
 
@@ -254,14 +255,14 @@
     do j=1,mym; do i=1,mxm;  p(i,j) = v(i,j) + a*p(i,j);  enddo; enddo
     call conv1(g,nfx,nfy, p,mxm,mym, q,mxf,myf)
     pqq = 0.
-    do j=1,myf; do i=1,myf; pqq = pqq + q(i,j)*q(i,j);  enddo; enddo
+    do j=1,myf; do i=1,mxf; pqq = pqq + q(i,j)*q(i,j);  enddo; enddo
     a = pvv / pqq;  ss = 0.
     do j=1,mym; do i=1,mxm
       s(i,j) = s(i,j) + a*p(i,j)
       if (t(i,j) /= tnul) ss = ss + p(i,j)*p(i,j)
     enddo; enddo
     ds = a * sqrt(ss / float(mxm*mym));  n = 0;  ss = 0.
-    do j=1,myf; do i=1,myf
+    do j=1,myf; do i=1,mxf
       if (f(i,j) /= vnul) then
         r(i,j) = r(i,j) - a*q(i,j)
         ss = ss + r(i,j)*r(i,j);  n = n + 1
@@ -276,6 +277,7 @@
     endif
     write(6,'(a,i4,i3,a,f8.2,a,f7.2)')   &
       ' loop', klp, lp, '   rms.Step :', ds, '   rms.Residual :', dv
+    flush(6)        !--- or  call flush(6)
     write(9,*) klp, lp, ds, dv
     if ((lp >= 5) .or. (dv < 0.1) .or. (ilp >= nloop)) exit
   enddo
diff -u ORG/anam/plamag.f90 anam/plamag.f90
--- ORG/anam/plamag.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/plamag.f90	2019-02-09 23:00:00.000000000 +0900
@@ -5,14 +5,14 @@
   real,allocatable :: f(:,:), g(:)
   character(80) :: wdr, flog, fnin, fobs, fnam, buf
   character(72) :: out;  character(20) :: sdtm
-  character(8) :: area, area1; character(4) :: s4
+  character(8) :: area, area1; character(6) :: ss
   character(3) :: spl = '   '; character(1) :: yn
   integer :: ldr, i, j, mc, nks, nkn, nkw, nke, npx, npy
   integer :: nc, ncc, iorg, korg, ispa, ispb
   integer :: nc1, ncc1, iorg1, korg1, ispa1, ispb1
   integer :: ixs, iys, mszx, mszy, nmx, nmy
   integer :: ixs1, iys1, mszx1, mszy1, nmx1, nmy1
-  integer :: ii, ix, mx, iy, my, n, kpl, lcap, kscl, km, iinc, kinc
+  integer :: ii, ix, mx, iy, my, n, kpl, lcap, kscl, km, ls, iinc, kinc
   integer :: klll, kshl, isf, itf, ksf, ktf, idf, kdf, k
   real :: vnul, xs, ys, vnul1, xs1, ys1, dmy, gsum, gmin, gmax, gdev, dg
   real :: step, astp, wide, high, fscl, ccm, dscl, sclr, sclu, x, y
@@ -29,7 +29,7 @@
     read(10,'(a)') buf
     if (buf(1:1) /= '#') exit
   enddo
-    if (buf(13:16) == '    ') then      !-- v2005
+  if (buf(13:16) == '    ') then      !-- v2005
     read(buf,'(a8,i4,4x,4i8)') area, ncc, iorg, korg, ispa, ispb
     if ((ncc<0) .or. (ncc>=400)) call abendm('invalid coord.no.')
     nc = ncc
@@ -199,17 +199,55 @@
   endif
   fscl = fscl * 100.;  ccm = fscl/100000.;  sclr = 0.;  sclu = 0.
   kscl = 0;  klll = 0;  kshl = 0
-  km = nint(fscl)/25000
-  if (km == 0)  km = 1
-  if (km > 50) km = 50
-  if ((km > 2) .and. (km < 5))   km = 2
-  if ((km > 5) .and. (km < 10))  km = 5
-  if ((km > 10) .and. (km < 20)) km = 10
-  if ((km > 20) .and. (km < 50)) km = 20
-  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
@@ -255,8 +293,8 @@
   if ((kscl /= 0) .or. (klll /= 0) .or. (kshl /= 0)) then
     write(6,'(a,$)') '      with '
     if (kshl /= 0) write(6,'(a,$)') '  Coast'
-    if (mod(kshl,100)/10 /= 0) write(6,'(a,$)') '+River'
-    if (kshl/100 /= 0) write(6,'(a,$)') '+PrefB'
+    if (mod(kshl/10,10) /= 0) write(6,'(a,$)') '+River'
+    if ((kshl/100) /= 0) write(6,'(a,$)') '+PrefB'
     if (klll /= 0) write(6,'(a,$)') '  LatLonLines'
     if (kscl /= 0) then
       write(6,'(a,f5.1,$)') '  ScaleBar [', sclr
@@ -279,9 +317,8 @@
     call plot(sclr+dscl, sclu,     2)
     call plot(sclr,      sclu,     2)
     call plot(sclr,      sclu+0.3, 2)
-    write(s4,'(i2,a2)') km, 'km'
     call lstyle('T', 0.5, 0., 0, -255)
-    call ptext(s4, 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)
@@ -352,8 +389,8 @@
     if ((kscl /= 0) .or. (klll /= 0) .or. (kshl /= 0)) then
       write(99,'(a,$)') '      with '
       if (kshl /= 0) write(99,'(a,$)') '  Coast'
-      if (mod(kshl,100)/10 /= 0) write(99,'(a,$)') '+River'
-      if (kshl/100 /= 0) write(99,'(a,$)') '+PrefB'
+      if (mod(kshl/10,10) /= 0) write(99,'(a,$)') '+River'
+      if ((kshl/100) /= 0) write(99,'(a,$)') '+PrefB'
       if (klll /= 0) write(99,'(a,$)') '  LatLonLines'
       if (kscl /= 0) then
         write(99,'(a,f5.1,$)') '  ScaleBar [', sclr
diff -u ORG/anam/plamagc.f90 anam/plamagc.f90
--- ORG/anam/plamagc.f90	2017-12-23 18:00:00.000000000 +0900
+++ anam/plamagc.f90	2019-02-09 23:00:00.000000000 +0900
@@ -5,14 +5,14 @@
   real,allocatable :: f(:,:), g(:)
   character(80) :: wdr, flog, fnin, fobs, fnam, buf
   character(72) :: out;  character(20) :: sdtm
-  character(8) :: area, area1; character(4) :: s4
+  character(8) :: area, area1; character(6) :: ss
   character(3) :: spl = '   '; character(1) :: yn
   integer :: ldr, i, j, mc, nks, nkn, nkw, nke, npx, npy
   integer :: nc, ncc, iorg, korg, ispa, ispb
   integer :: nc1, ncc1, iorg1, korg1, ispa1, ispb1
   integer :: ixs, iys, mszx, mszy, nmx, nmy
   integer :: ixs1, iys1, mszx1, mszy1, nmx1, nmy1
-  integer :: ii, ix, mx, iy, my, n, kpl, kscl, km, iinc, kinc
+  integer :: ii, ix, mx, iy, my, n, kpl, kscl, km, ls, iinc, kinc
   integer :: klll, kshl, isf, itf, ksf, ktf, idf, kdf, k
   real :: vnul, xs, ys, vnul1, xs1, ys1, dmy, gsum, gmin, gmax, gdev, dg
   real :: step, vmed, cint, vlo, vhi, wide, high, fscl, ccm, dscl, sclr, sclu
@@ -34,14 +34,16 @@
     if ((ncc<0) .or. (ncc>=400)) call abendm('invalid coord.no.')
     nc = ncc
     if (ncc < 200) then
-      nc = ncc; ncc = nc + 800
+      nc = ncc; ncc = nc + 800;  mc = 0
     else
-      ncc = ncc - 200; nc = ncc
+      ncc = ncc - 200; nc = ncc;  mc = 1
     endif
   else                                  !-- v2018
     read(buf,'(a8,4x,i4,4i8)') area, ncc, iorg, korg, ispa, ispb
-    nc = ncc
-    if ((ncc >= 800) .and. (ncc < 1000)) nc = ncc - 800
+    nc = ncc;  mc = 1
+    if ((ncc >= 800) .and. (ncc < 1000)) then
+      nc = ncc - 800;  mc = 0
+    endif
   endif
   if ((nc >= 1) .and. (nc <= 62)) then
     iorg = 0;  ispa = 0;  ispb = 0
@@ -197,17 +199,55 @@
   endif
   fscl = fscl * 100.;  ccm = fscl/100000.;  sclr = 0.;  sclu = 0.
   kscl = 0;  klll = 0;  kshl = 0
-  km = nint(fscl)/25000
-  if (km == 0)  km = 1
-  if (km > 50) km = 50
-  if ((km > 2) .and. (km < 5))   km = 2
-  if ((km > 5) .and. (km < 10))  km = 5
-  if ((km > 10) .and. (km < 20)) km = 10
-  if ((km > 20) .and. (km < 50)) km = 20
-  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
@@ -254,8 +294,8 @@
   if ((kscl /= 0) .or. (klll /= 0) .or. (kshl /= 0)) then
     write(6,'(a,$)') '      with '
     if (kshl /= 0) write(6,'(a,$)') '  Coast'
-    if (mod(kshl,100)/10 /= 0) write(6,'(a,$)') '+River'
-    if (kshl/100 /= 0) write(6,'(a,$)') '+PrefB'
+    if (mod(kshl/10,10) /= 0) write(6,'(a,$)') '+River'
+    if ((kshl/100) /= 0) write(6,'(a,$)') '+PrefB'
     if (klll /= 0) write(6,'(a,$)') '  LatLonLines'
     if (kscl /= 0) then
       write(6,'(a,f5.1,$)') '  ScaleBar [', sclr
@@ -285,9 +325,8 @@
     call plot(sclr+dscl, sclu,     2)
     call plot(sclr,      sclu,     2)
     call plot(sclr,      sclu+0.3, 2)
-    write(s4,'(i2,a2)') km, 'km'
     call lstyle('T', 0.5, 0., 0, -255)
-    call ptext(s4, 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)
@@ -359,8 +398,8 @@
     if ((kscl /= 0) .or. (klll /= 0) .or. (kshl /= 0)) then
       write(99,'(a,$)') '      with '
       if (kshl /= 0) write(99,'(a,$)') '  Coast'
-      if (mod(kshl,100)/10 /= 0) write(99,'(a,$)') '+River'
-      if (kshl/100 /= 0) write(99,'(a,$)') '+PrefB'
+      if (mod(kshl/10,10) /= 0) write(99,'(a,$)') '+River'
+      if ((kshl/100) /= 0) write(99,'(a,$)') '+PrefB'
       if (klll /= 0) write(99,'(a,$)') '  LatLonLines'
       if (kscl /= 0) then
         write(99,'(a,f5.1,$)') '  ScaleBar [', sclr
