[cig-commits] [commit] devel: moved some old files from DATA to utils/oldstuff (5b48368)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu May 8 14:58:28 PDT 2014


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

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d_globe/compare/d2496e9d1ee801b35cabc43ebeea15747190d6bc...63d29617b6d3c3082710c9925d3229e27ab67a32

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

commit 5b48368d9130a323c3bc34e9d45c480b58cc8df2
Author: Dimitri Komatitsch <see_my_GitHub_web_page>
Date:   Thu May 8 23:54:45 2014 +0200

    moved some old files from DATA to utils/oldstuff


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

5b48368d9130a323c3bc34e9d45c480b58cc8df2
 DATA                                            |  2 +-
 setup/constants.h.in                            |  8 ---
 utils/oldstuff/convert_etopo2_bin2ascii_Sun.f90 | 96 +++++++++++++++++++++++++
 utils/oldstuff/swap_topo_bathy_Sun.f90          | 40 +++++++++++
 4 files changed, 137 insertions(+), 9 deletions(-)

diff --git a/DATA b/DATA
index 414b996..6a9ff13 160000
--- a/DATA
+++ b/DATA
@@ -1 +1 @@
-Subproject commit 414b9967a8db10aaddbcda86322e651a49a4f9c3
+Subproject commit 6a9ff13efd515ff32eeaad99ba8ba872b1b5fb5f
diff --git a/setup/constants.h.in b/setup/constants.h.in
index 84affc8..5deff49 100644
--- a/setup/constants.h.in
+++ b/setup/constants.h.in
@@ -101,14 +101,6 @@
 !!-----------------------------------------------------------
 !! (uncomment desired resolution)
 
-!!--- ETOPO5 5-minute model, smoothed Harvard version
-!! size of topography and bathymetry file
-!  integer, parameter :: NX_BATHY = 4320,NY_BATHY = 2160
-!! resolution of topography file in minutes
-!  integer, parameter :: RESOLUTION_TOPO_FILE = 5
-!! pathname of the topography file
-!  character (len=*), parameter :: PATHNAME_TOPO_FILE = 'DATA/topo_bathy/topo_bathy_etopo5_smoothed_Harvard.dat'
-
 !! DK DK for Roland_Sylvain this below could be changed if needed (i.e. using a non-smoothed version for instance)
 !---  ETOPO4 4-minute model created by subsampling and smoothing etopo-2
 ! size of topography and bathymetry file
diff --git a/utils/oldstuff/convert_etopo2_bin2ascii_Sun.f90 b/utils/oldstuff/convert_etopo2_bin2ascii_Sun.f90
new file mode 100644
index 0000000..6266bb4
--- /dev/null
+++ b/utils/oldstuff/convert_etopo2_bin2ascii_Sun.f90
@@ -0,0 +1,96 @@
+!=====================================================================
+!
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  3 . 4
+!          --------------------------------------------------
+!
+!                 Dimitri Komatitsch and Jeroen Tromp
+!    Seismological Laboratory - California Institute of Technology
+!        (c) California Institute of Technology August 2003
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+
+  program convert_etopo2_bin2ascii
+!
+!---- convert etopo-2 raw binary Sun file to ASCII - use on Sun GPS machines at Caltech
+!
+  implicit none
+
+!--- ETOPO2 2-minute model
+! size of topography and bathymetry file
+  integer, parameter :: NX_BATHY = 10800,NY_BATHY = 5400
+
+! use integer array to store values
+  integer(kind=2) ibathy_topo(NX_BATHY,NY_BATHY)
+
+  integer itopo_x,itopo_y
+
+! read the topography file
+  print *,'reading topo file in Sun-Sparc binary format'
+  call read_topo_bathy_bin_etopo2(ibathy_topo)
+
+  print *,'min and max of original topography = ',minval(ibathy_topo),maxval(ibathy_topo)
+
+! save the ASCII file
+!! DK DK beware, longitude blocks MUST be swapped
+  stop 'beware, longitude blocks MUST be swapped, see file swap_topo_bathy_Sun.f90 for details'
+  open(unit=13,file='topo_bathy_etopo2.dat',status='unknown')
+  do itopo_y=1,NY_BATHY
+    do itopo_x=1,NX_BATHY
+      write(13,*) ibathy_topo(itopo_x,itopo_y)
+    enddo
+  enddo
+  close(13)
+
+  print *
+  print *,'can filter white spaces from topo_bathy_etopo2.dat to save space'
+  print *
+
+  end program convert_etopo2_bin2ascii
+
+! -------------------------------------------
+
+  subroutine read_topo_bathy_bin_etopo2(ibathy_topo)
+!
+!---- read topography and bathymetry file once and for all
+!
+  implicit none
+
+!--- ETOPO2 2-minute model
+! size of topography and bathymetry file
+  integer, parameter :: NX_BATHY = 10800,NY_BATHY = 5400
+
+! use integer array to store values
+  integer(kind=2) ibathy_topo(NX_BATHY,NY_BATHY)
+
+  integer iadd1,iel1,icurrent_rec
+
+! this is the path on the Caltech GPS Sun network
+  open(unit=13,file='/home/datalib/Topography/ETOPO-02/etopo2.raw',status='old',access='direct',recl=2)
+
+  icurrent_rec = 1
+
+  do iadd1=1,NY_BATHY
+    do iel1=1,NX_BATHY
+      read(13,rec=icurrent_rec) ibathy_topo(iel1,iadd1)
+      icurrent_rec = icurrent_rec + 1
+    enddo
+  enddo
+
+  close(13)
+
+  end subroutine read_topo_bathy_bin_etopo2
+
diff --git a/utils/oldstuff/swap_topo_bathy_Sun.f90 b/utils/oldstuff/swap_topo_bathy_Sun.f90
new file mode 100644
index 0000000..d04d386
--- /dev/null
+++ b/utils/oldstuff/swap_topo_bathy_Sun.f90
@@ -0,0 +1,40 @@
+
+!---- swap longitude blocks in topography and bathymetry file once and for all
+!---- to switch from the convention used in the original file on the Sun
+!---- to the convention used in SPECFEM3D
+
+  program swap_topo_bathy_Sun
+
+  implicit none
+
+  include "../../constants.h"
+
+! use integer array to store values
+  integer ibathy_topo(NX_BATHY,NY_BATHY)
+
+  integer itopo_x,itopo_y
+
+  open(unit=13,file='topo_bathy_etopo4_from_etopo2_subsampled.dat',status='old')
+  do itopo_y=1,NY_BATHY
+    do itopo_x=1,NX_BATHY
+      read(13,*) ibathy_topo(itopo_x,itopo_y)
+    enddo
+  enddo
+  close(13)
+
+! blocks of longitude in [0,180[ and [180,360[ must be swapped
+! in the final file, itopo_x = 1 should correspond to longitude = 0
+! therefore one should see Africa on the left of the JPEG image of topography
+  open(unit=13,file='topo_bathy_etopo4_from_etopo2_subsampled_2.dat',status='unknown')
+  do itopo_y=1,NY_BATHY
+    do itopo_x=NX_BATHY/2+1,NX_BATHY
+      write(13,*) ibathy_topo(itopo_x,itopo_y)
+    enddo
+    do itopo_x=1,NX_BATHY/2
+      write(13,*) ibathy_topo(itopo_x,itopo_y)
+    enddo
+  enddo
+  close(13)
+
+  end program swap_topo_bathy_Sun
+



More information about the CIG-COMMITS mailing list