Last change
on this file since 12878 was 12878, checked in by cborstad, 13 years ago |
merged trunk-jpl into trunk-jpl-damage through revision 12877
|
File size:
935 bytes
|
Line | |
---|
1 | import os
|
---|
2 | import datetime
|
---|
3 | from addnote import *
|
---|
4 |
|
---|
5 | def 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.