[cig-commits] [commit] devel, master: improved topo file filtering routine (2e696a1)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Jun 18 16:10:53 PDT 2014


Repository : https://github.com/geodynamics/specfem3d_globe

On branches: devel,master
Link       : https://github.com/geodynamics/specfem3d_globe/compare/85a8aa3a48b2cf0d9164893edb252f3fe0f28585...1bc4138645fec5dc69d2dcc94a048c7330439566

>---------------------------------------------------------------

commit 2e696a1aaca65e37a348c20c4c7265e39a90d4cf
Author: Dimitri Komatitsch <komatitsch at lma.cnrs-mrs.fr>
Date:   Fri Jun 13 21:46:04 2003 +0000

    improved topo file filtering routine


>---------------------------------------------------------------

2e696a1aaca65e37a348c20c4c7265e39a90d4cf
 topo_bathy/filter_etopo_file.f90    | 86 +++++++++++++++++++++++++++++++++++++
 topo_bathy/smooth_etopo5_etopo2.f90 | 64 ---------------------------
 2 files changed, 86 insertions(+), 64 deletions(-)

diff --git a/topo_bathy/filter_etopo_file.f90 b/topo_bathy/filter_etopo_file.f90
new file mode 100644
index 0000000..f8176b2
--- /dev/null
+++ b/topo_bathy/filter_etopo_file.f90
@@ -0,0 +1,86 @@
+
+  program filter_topo_file
+
+! smooth topo file using a window filter
+
+  implicit none
+
+  include "../../constants.h"
+
+! filter final surface using box filter
+  integer, parameter :: SIZE_FILTER_ONE_SIDE = 2
+
+! impose min and max of topography and bathymetry
+  integer, parameter :: MIN_TOPO = -5000
+  integer, parameter :: MAX_TOPO = +5000
+
+  integer ix,iy,ixconv,iyconv,i,ic,ixcount,iycount
+  integer ixbox,iybox,ixval,iyval
+
+  double precision rlon,rlat,rx,ry,a,b
+  double precision sumval,value,dist,sigma
+
+! use integer array to store values
+  integer itopo(NX_BATHY,NY_BATHY)
+  integer itopo_filtered(NX_BATHY,NY_BATHY)
+
+  integer itopo_x,itopo_y
+
+  print *
+  print *,'size of window filter is ',2*SIZE_FILTER_ONE_SIDE + 1
+  print *
+
+  print *,'imposing min and max of topography and bathymetry = ',MIN_TOPO,MAX_TOPO
+  print *
+
+  open(unit=13,file='topo_bathy_etopo5.dat',status='old')
+  do itopo_y=1,NY_BATHY
+    do itopo_x=1,NX_BATHY
+      read(13,*) itopo(itopo_x,itopo_y)
+    enddo
+  enddo
+  close(13)
+
+  print *,'min and max of original topo file is ',minval(itopo),maxval(itopo)
+
+! impose min and max values
+  do itopo_y=1,NY_BATHY
+    do itopo_x=1,NX_BATHY
+      if(itopo(itopo_x,itopo_y) < MIN_TOPO) itopo(itopo_x,itopo_y) = MIN_TOPO
+      if(itopo(itopo_x,itopo_y) > MAX_TOPO) itopo(itopo_x,itopo_y) = MAX_TOPO
+    enddo
+  enddo
+
+! filter final surface using box filter
+    print *,'filtering topography data file using box filter'
+    do iy = 1,NY_BATHY
+      print *,'doing iy = ',iy,' out of ',NY_BATHY
+      do ix = 1,NX_BATHY
+        sumval = 0.d0
+        do iybox = iy-SIZE_FILTER_ONE_SIDE,iy+SIZE_FILTER_ONE_SIDE
+          do ixbox = ix-SIZE_FILTER_ONE_SIDE,ix+SIZE_FILTER_ONE_SIDE
+            ixval = ixbox
+            iyval = iybox
+            if(ixval < 1) ixval = NX_BATHY - abs(ixval)
+            if(iyval < 1) iyval = NY_BATHY - abs(iyval)
+            if(ixval > NX_BATHY) ixval = ixval - NX_BATHY
+            if(iyval > NY_BATHY) iyval = iyval - NY_BATHY
+            sumval = sumval + dble(itopo(ixval,iyval))
+          enddo
+        enddo
+        itopo_filtered(ix,iy) = nint(sumval/dble((2*SIZE_FILTER_ONE_SIDE+1)**2))
+      enddo
+    enddo
+
+  print *,'min and max of filtered topo file is ',minval(itopo_filtered),maxval(itopo_filtered)
+
+  open(unit=13,file='topo_bathy_etopo5_filtered.dat',status='unknown')
+  do itopo_y=1,NY_BATHY
+    do itopo_x=1,NX_BATHY
+      write(13,*) itopo_filtered(itopo_x,itopo_y)
+    enddo
+  enddo
+  close(13)
+
+  end program filter_topo_file
+
diff --git a/topo_bathy/smooth_etopo5_etopo2.f90 b/topo_bathy/smooth_etopo5_etopo2.f90
deleted file mode 100644
index 0d14e16..0000000
--- a/topo_bathy/smooth_etopo5_etopo2.f90
+++ /dev/null
@@ -1,64 +0,0 @@
-
-  program merge_filter_ori_bathy_topo
-
-!! DK DK smooth original bathy and topo file
-
-  implicit none
-
-  include "../../constants.h"
-
-! filter final surface using box filter
-  integer, parameter :: SIZE_FILTER_ONE_SIDE = 2
-
-  integer ix,iy,ixconv,iyconv,i,ic,ixcount,iycount
-  integer ixbox,iybox,ixval,iyval
-
-  double precision rlon,rlat,rx,ry,a,b
-  double precision sumval,value,dist,sigma
-
-! use integer array to store values
-  integer itopo(NX_BATHY,NY_BATHY)
-  integer itopo_filtered(NX_BATHY,NY_BATHY)
-
-  integer itopo_x,itopo_y
-
-  open(unit=13,file='topo_bathy_etopo5_harvard.dat_ori',status='old')
-  do itopo_y=1,NY_BATHY
-    do itopo_x=1,NX_BATHY
-      read(13,*) itopo(itopo_x,itopo_y)
-    enddo
-  enddo
-  close(13)
-
-! filter final surface using box filter
-    print *,'filtering final surface using box filter'
-    do iy = 1,NY_BATHY
-      print *,'doing iy = ',iy,' out of ',NY_BATHY
-      do ix = 1,NX_BATHY
-        sumval = 0.d0
-        do iybox = iy-SIZE_FILTER_ONE_SIDE,iy+SIZE_FILTER_ONE_SIDE
-          do ixbox = ix-SIZE_FILTER_ONE_SIDE,ix+SIZE_FILTER_ONE_SIDE
-            ixval = ixbox
-            iyval = iybox
-            if(ixval < 1) ixval = 1
-            if(iyval < 1) iyval = 1
-            if(ixval > NX_BATHY) ixval = NX_BATHY
-            if(iyval > NY_BATHY) iyval = NY_BATHY
-            sumval = sumval + dble(itopo(ixval,iyval))
-          enddo
-        enddo
-        itopo_filtered(ix,iy) = nint(sumval/dble((2*SIZE_FILTER_ONE_SIDE+1)**2))
-      enddo
-    enddo
-    itopo(:,:) = itopo_filtered(:,:)
-
-  open(unit=13,file='topo_bathy_etopo5_harvard.dat',status='unknown')
-  do itopo_y=1,NY_BATHY
-    do itopo_x=1,NX_BATHY
-      write(13,*) itopo(itopo_x,itopo_y)
-    enddo
-  enddo
-  close(13)
-
-  end program merge_filter_ori_bathy_topo
-



More information about the CIG-COMMITS mailing list