source: issm/branches/trunk-jpl-damage/src/m/model/parameterization/parameterize.py@ 12946

Last change on this file since 12946 was 12946, checked in by cborstad, 13 years ago

CHG: merged trunk-jpl into branch through revision 12945

File size: 922 bytes
Line 
1import os
2import datetime
3from addnote import *
4
5def parameterize(md,parametername):
6 """
7 PARAMETERIZE - parameterize a model
8
9 from a parameter python file, start filling in all the model fields that were not
10 filled in by the mesh.py and mask.py model methods.
11 Warning: the parameter file must be able to be run in Python
12
13 Usage:
14 md=parameterize(md,parametername)
15
16 Example:
17 md=parameterize(md,'Square.par');
18 """
19
20 #some checks
21 if not os.path.exists(parametername):
22 raise IOError("parameterize error message: file '%s' not found!" % parametername)
23
24 #Try and run parameter file.
25 execfile(parametername)
26
27 #Name and notes
28 if not md.miscellaneous.name:
29 md.miscellaneous.name=os.path.basename(parametername).split('.')[0]
30
31 md=addnote(md,"Model created by using parameter file: '%s' on: %s." % (parametername,datetime.datetime.strftime(datetime.datetime.now(),'%c') ))
32
33 return md
34
Note: See TracBrowser for help on using the repository browser.