[cig-commits] [commit] devel, master: New version of python script for updating Par_files (be6512c)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Jun 18 15:22:45 PDT 2014
Repository : https://github.com/geodynamics/specfem2d
On branches: devel,master
Link : https://github.com/geodynamics/specfem2d/compare/fc67e6fd7ad890705b2b72b4b3c509accb22249e...e9ca46c40131588d89d7b0883250bc6584ce6b4c
>---------------------------------------------------------------
commit be6512c53461e08309d20474d2d933dc8146cb4b
Author: Paul Cristini <cristini at lma.cnrs-mrs.fr>
Date: Fri Jan 25 15:22:23 2013 +0000
New version of python script for updating Par_files
>---------------------------------------------------------------
be6512c53461e08309d20474d2d933dc8146cb4b
...e_their_format_when_new_parameters_are_added.py | 28 ++++++++++++++++++++++
1 file changed, 28 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 a41e96e..1ad84ff 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
@@ -501,6 +501,33 @@ def ProcessParfile_r21000(fic):
print 'xxxxx------> '+fic+' processed to '+release_number
return
#------------------------------------------------------------------------------
+def ProcessParfile_r21278(fic):
+ # Open the file and get all lines from Par_file
+ ligs= LoadLig(fic)
+ # Test if already processed
+ for lig in ligs:
+ if 'use_existing_STATIONS' in lig:
+ print '----> '+fic+' already processed to r21278'
+ return
+ #--------------------------------------------------------------------------
+ # Add new parameters
+ #
+ for ilg, lig in enumerate(ligs):
+ if lig.startswith('generate_STATIONS'):
+ ligs[ilg]=ligs[ilg].replace('generate_STATIONS ', \
+ 'use_existing_STATIONS')
+ ligs[ilg]=ligs[ilg].replace('.false.','.true.')
+ ligs[ilg]=ligs[ilg].replace('.true.','.false.')
+ #
+ move(fic,fic+'.before_update_to_r21278')
+ #
+ fm = open(fic,'w')
+ fm.writelines(ligs)
+ fm.close()
+ #
+ print 'xxxxx------> '+fic+' processed to r21278'
+ return
+#------------------------------------------------------------------------------
if __name__=='__main__':
## List of all files of current directory
Fichiers=[]
@@ -527,6 +554,7 @@ if __name__=='__main__':
ProcessParfile_r20561(fic)
ProcessParfile_r20859(fic)
ProcessParfile_r21000(fic)
+ ProcessParfile_r21278(fic)
print '~'*80
#
print 'Number of Par_file analysed : ', Ct_Par_file
More information about the CIG-COMMITS
mailing list