[cig-commits] [commit] devel, master: new version of python script which updates Par_files (9119d4c)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Jun 18 15:23:20 PDT 2014
Repository : https://github.com/geodynamics/specfem2d
On branches: devel,master
Link : https://github.com/geodynamics/specfem2d/compare/fc67e6fd7ad890705b2b72b4b3c509accb22249e...e9ca46c40131588d89d7b0883250bc6584ce6b4c
>---------------------------------------------------------------
commit 9119d4cca2d898a650f309f4f5414442ce033c76
Author: Paul Cristini <cristini at lma.cnrs-mrs.fr>
Date: Sat May 4 11:12:41 2013 +0000
new version of python script which updates Par_files
>---------------------------------------------------------------
9119d4cca2d898a650f309f4f5414442ce033c76
...e_their_format_when_new_parameters_are_added.py | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py b/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
index 1ad84ff..0eba89a 100755
--- a/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
+++ b/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
@@ -528,6 +528,37 @@ def ProcessParfile_r21278(fic):
print 'xxxxx------> '+fic+' processed to r21278'
return
#------------------------------------------------------------------------------
+def ProcessParfile_r21820(fic):
+ # define the release number
+ release_number='r21820'
+ # Open the file and get all lines from Par_file
+ ligs= LoadLig(fic)
+
+ # Test if already processed
+ for lig in ligs:
+ if lig.startswith('save_ASCII_kernels'):
+ print '----> '+fic+' already processed to '+release_number
+ return
+ #
+ a1='save_ASCII_kernels = .true. # save sensitivity'+ \
+ 'kernels in ASCII format(much bigger files, but compatibles with'+ \
+ ' current GMT scripts) or in binary format\n'
+ #--------------------------------------------------------------------------
+ # Add new parameters
+ #
+ for ilg, lig in enumerate(ligs):
+ if lig.startswith('rec_normal_to_surface'):
+ ligs.insert(ilg+1,a1)
+ #
+ move(fic,fic+'.before_update_to_'+release_number)
+ #
+ fm = open(fic,'w')
+ fm.writelines(ligs)
+ fm.close()
+ #
+ print 'xxxxx------> '+fic+' processed to '+release_number
+ return
+#------------------------------------------------------------------------------
if __name__=='__main__':
## List of all files of current directory
Fichiers=[]
@@ -555,6 +586,7 @@ if __name__=='__main__':
ProcessParfile_r20859(fic)
ProcessParfile_r21000(fic)
ProcessParfile_r21278(fic)
+ ProcessParfile_r21820(fic)
print '~'*80
#
print 'Number of Par_file analysed : ', Ct_Par_file
More information about the CIG-COMMITS
mailing list