swmfpy.paramin.html 7.42 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module swmfpy.paramin</title>
<meta charset="utf-8">
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="swmfpy.html"><font color="#ffffff">swmfpy</font></a>.paramin</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/qusai/Documents/Code/swmfpy/swmfpy/paramin.py">/home/qusai/Documents/Code/swmfpy/swmfpy/paramin.py</a></font></td></tr></table>
    <p><tt>PARAM.in&nbsp;Tools<br>
--------------<br>
&nbsp;<br>
These&nbsp;tools&nbsp;are&nbsp;to&nbsp;help&nbsp;script&nbsp;the&nbsp;editing&nbsp;of&nbsp;PARAM.in&nbsp;files.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="logging.html">logging</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-read_command"><strong>read_command</strong></a>(command, paramin_file<font color="#909090">='PARAM.in'</font>, **kwargs)</dt><dd><tt>Get&nbsp;parameters&nbsp;of&nbsp;a&nbsp;certain&nbsp;command&nbsp;in&nbsp;PARAM.in&nbsp;file.<br>
&nbsp;<br>
This&nbsp;will&nbsp;find&nbsp;the&nbsp;#COMMAND&nbsp;and&nbsp;return&nbsp;a&nbsp;list&nbsp;of&nbsp;values&nbsp;for&nbsp;the&nbsp;parameters.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;&nbsp;&nbsp;command&nbsp;(str):&nbsp;This&nbsp;is&nbsp;the&nbsp;#COMMAND&nbsp;you're&nbsp;looking&nbsp;for.<br>
&nbsp;&nbsp;&nbsp;&nbsp;paramin_file&nbsp;(str):&nbsp;(default:&nbsp;'PARAM.in')&nbsp;The&nbsp;file&nbsp;in&nbsp;which&nbsp;you're<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;looking&nbsp;for&nbsp;the&nbsp;command&nbsp;values.<br>
&nbsp;&nbsp;&nbsp;&nbsp;**kwargs:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num_of_values&nbsp;(int):&nbsp;(default:&nbsp;None)&nbsp;Number&nbsp;of&nbsp;values&nbsp;to&nbsp;take&nbsp;from<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;&nbsp;&nbsp;list:&nbsp;Values&nbsp;found&nbsp;for&nbsp;the&nbsp;#COMMAND&nbsp;in&nbsp;file.&nbsp;Index&nbsp;0&nbsp;is&nbsp;#COMMAND&nbsp;and<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;values&nbsp;follow&nbsp;(1&nbsp;for&nbsp;first&nbsp;argument...)<br>
&nbsp;<br>
Raises:<br>
&nbsp;&nbsp;&nbsp;&nbsp;ValueError:&nbsp;When&nbsp;the&nbsp;#COMMAND&nbsp;is&nbsp;not&nbsp;found.<br>
&nbsp;<br>
Examples:<br>
&nbsp;&nbsp;&nbsp;&nbsp;start_time&nbsp;=&nbsp;swmfpy.paramin.<a href="#-read_command">read_command</a>('#STARTTIME')<br>
&nbsp;&nbsp;&nbsp;&nbsp;end_time&nbsp;=&nbsp;swmfpy.paramin.<a href="#-read_command">read_command</a>('#ENDTIME')<br>
&nbsp;&nbsp;&nbsp;&nbsp;print('Starting&nbsp;month&nbsp;is&nbsp;',&nbsp;start_time[1])<br>
&nbsp;&nbsp;&nbsp;&nbsp;print('Ending&nbsp;month&nbsp;is&nbsp;',&nbsp;end_time[1])<br>
&nbsp;<br>
This&nbsp;will&nbsp;treat&nbsp;all&nbsp;following&nbsp;lines&nbsp;as&nbsp;values&nbsp;for&nbsp;the&nbsp;command.&nbsp;To&nbsp;suppress<br>
this,&nbsp;try&nbsp;using&nbsp;the&nbsp;`num_of_values`&nbsp;keyword.&nbsp;This&nbsp;is&nbsp;helpful&nbsp;if&nbsp;your<br>
PARAM.in&nbsp;is&nbsp;comment&nbsp;heavy.</tt></dd></dl>
 <dl><dt><a name="-replace_command"><strong>replace_command</strong></a>(parameters, input_file, output_file<font color="#909090">='PARAM.in'</font>)</dt><dd><tt>Replace&nbsp;values&nbsp;for&nbsp;the&nbsp;parameters&nbsp;in&nbsp;a&nbsp;PARAM.in&nbsp;file.<br>
&nbsp;<br>
Note,&nbsp;if&nbsp;you&nbsp;have&nbsp;repeat&nbsp;commands&nbsp;this&nbsp;will&nbsp;replace&nbsp;all&nbsp;the&nbsp;repeats.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;&nbsp;&nbsp;parameters&nbsp;(dict):&nbsp;Dictionary&nbsp;of&nbsp;strs&nbsp;with&nbsp;format<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;replace&nbsp;=&nbsp;{'#COMMAND':&nbsp;['value',&nbsp;'comments',&nbsp;...]}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;is&nbsp;case&nbsp;sensitive.<br>
&nbsp;&nbsp;&nbsp;&nbsp;input_file&nbsp;(str):&nbsp;String&nbsp;of&nbsp;PARAM.in&nbsp;file&nbsp;name.<br>
&nbsp;&nbsp;&nbsp;&nbsp;output_file&nbsp;(str):&nbsp;(default&nbsp;'PARAM.in')&nbsp;The&nbsp;output&nbsp;file&nbsp;to&nbsp;write&nbsp;to.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;value&nbsp;of&nbsp;None&nbsp;will&nbsp;not&nbsp;output&nbsp;a&nbsp;file.<br>
Returns:<br>
&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;list&nbsp;of&nbsp;lines&nbsp;of&nbsp;the&nbsp;PARAM.in&nbsp;file&nbsp;that&nbsp;would&nbsp;be&nbsp;outputted.<br>
&nbsp;<br>
Raises:<br>
&nbsp;&nbsp;&nbsp;&nbsp;TypeError:&nbsp;If&nbsp;a&nbsp;value&nbsp;given&nbsp;couldn't&nbsp;be&nbsp;converted&nbsp;to&nbsp;string.<br>
&nbsp;<br>
Examples:<br>
&nbsp;&nbsp;&nbsp;&nbsp;```<br>
&nbsp;&nbsp;&nbsp;&nbsp;change['#SOLARWINDFILE']&nbsp;=&nbsp;[['T',&nbsp;'UseSolarWindFile'],<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;['new_imf.dat',&nbsp;'NameSolarWindFile']]<br>
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;This&nbsp;will&nbsp;overwrite&nbsp;PARAM.in<br>
&nbsp;&nbsp;&nbsp;&nbsp;swmfpy.paramin.replace('PARAM.in.template',&nbsp;change)<br>
&nbsp;&nbsp;&nbsp;&nbsp;```</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>__all__</strong> = ['read_command', 'replace_command']<br>
<strong>__author__</strong> = 'Qusai Al Shidi'<br>
<strong>__email__</strong> = 'qusai@umich.edu'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
    
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Qusai&nbsp;Al&nbsp;Shidi</td></tr></table>
</body></html>