[cig-commits] r21296 - seismo/2D/SPECFEM2D/trunk/EXAMPLES
cristini at geodynamics.org
cristini at geodynamics.org
Fri Jan 25 07:22:23 PST 2013
Author: cristini
Date: 2013-01-25 07:22:23 -0800 (Fri, 25 Jan 2013)
New Revision: 21296
Modified:
seismo/2D/SPECFEM2D/trunk/EXAMPLES/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
Log:
New version of python script for updating Par_files
Modified: seismo/2D/SPECFEM2D/trunk/EXAMPLES/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
===================================================================
--- seismo/2D/SPECFEM2D/trunk/EXAMPLES/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py 2013-01-25 07:54:35 UTC (rev 21295)
+++ seismo/2D/SPECFEM2D/trunk/EXAMPLES/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py 2013-01-25 15:22:23 UTC (rev 21296)
@@ -499,8 +499,35 @@
fm.close()
#
print 'xxxxx------> '+fic+' processed to '+release_number
- return
+ 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 @@
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