[cig-commits] r19364 - seismo/2D/SPECFEM2D/trunk/UTILS
dkomati1 at geodynamics.org
dkomati1 at geodynamics.org
Mon Jan 16 06:05:53 PST 2012
Author: dkomati1
Date: 2012-01-16 06:05:53 -0800 (Mon, 16 Jan 2012)
New Revision: 19364
Modified:
seismo/2D/SPECFEM2D/trunk/UTILS/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
Log:
new version of Paul Cristini's Python script to automatically update old Par_files to the new format
Modified: seismo/2D/SPECFEM2D/trunk/UTILS/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
===================================================================
--- seismo/2D/SPECFEM2D/trunk/UTILS/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py 2012-01-16 13:06:06 UTC (rev 19363)
+++ seismo/2D/SPECFEM2D/trunk/UTILS/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py 2012-01-16 14:05:53 UTC (rev 19364)
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 15 09:00:00 2011
-Updated on Wed Jan 11 2012
+Updated on Fri Jan 13 2012
Processing of Par_file to update them to new format
@@ -134,6 +134,35 @@
fm.close()
#
print 'xxxxx------> '+fic+' processed to r19346'
+ return
+#------------------------------------------------------------------------------
+def ProcessParfile_r19xxx(fic):
+ # Open the file and get all lines from Par_file
+ ligs= LoadLig(fic)
+ # Teste si le traitement a déjà été fait
+ for lig in ligs:
+ if 'time_stepping_scheme' in lig:
+ print '----> '+fic+' already processed to r19xxx'
+ return
+ #
+ a1='time_stepping_scheme = 1 # 1 = Newmark (2nd order), \
+ 2 = LDDRK4-6 (4th-order 6-stage low storage Runge-Kutta), \
+ 3 = classical 4th-order 4-stage Runge-Kutta\n'
+
+ #--------------------------------------------------------------------------
+ # Ajout des parametres supplementaires
+ #
+ for ilg, lig in enumerate(ligs):
+ if lig.startswith('USER_T0'):
+ ligs.insert(ilg+1,a1)
+ #
+ move(fic,fic+'.before_update_to_r19xxx')
+ #
+ fm = open(fic,'w')
+ fm.writelines(ligs)
+ fm.close()
+ #
+ print 'xxxxx------> '+fic+' processed to r19xxx'
return
#------------------------------------------------------------------------------
if __name__=='__main__':
@@ -154,8 +183,9 @@
ProcessParfile_r19201(fic)
ProcessParfile_r19340(fic)
ProcessParfile_r19346(fic)
+ ProcessParfile_r19xxx(fic)
print '~'*80
#
print 'Number of Par_file analysed : ', Ct_Par_file
print 'END OF Par_file PROCESSING'
-
+
\ No newline at end of file
More information about the CIG-COMMITS
mailing list