Commit fd26dd4c authored by Qusai Al Shidi's avatar Qusai Al Shidi 💬
Browse files

Fixed Documentation

parent b1af5a37
# Module `swmfpy` {#swmfpy}
# Module [swmfpy](#swmfpy)
A collection of tools to read, write, visualize with the
Space Weather Modeling Framework (SWMF)
......@@ -17,7 +17,7 @@ Space Weather Modeling Framework (SWMF)
# Module `swmfpy.io` {#swmfpy.io}
# Module [swmfpy.io](#swmfpy.io)
Input/Output tools for SWMF
......@@ -30,8 +30,7 @@ Input/Output tools for SWMF
### Function `coarse_filtering` {#swmfpy.io.coarse_filtering}
### Function [swmfpy.io.coarse_filtering](#swmfpy.io.coarse_filtering)
......@@ -42,7 +41,7 @@ Applies coarse filtering to a pandas.DataFrame
### Function `read_gm_log` {#swmfpy.io.read_gm_log}
### Function [swmfpy.io.read_gm_log](#swmfpy.io.read_gm_log)
......@@ -82,7 +81,7 @@ geo["AL"].plot.line()
### Function `read_omni_csv` {#swmfpy.io.read_omni_csv}
### Function [swmfpy.io.read_omni_csv](#swmfpy.io.read_omni_csv)
......@@ -122,7 +121,7 @@ Other Args:
### Function `read_wdc_ae` {#swmfpy.io.read_wdc_ae}
### Function [swmfpy.io.read_wdc_ae](#swmfpy.io.read_wdc_ae)
......@@ -153,7 +152,7 @@ Read an auroral electrojet (AE) indeces from Kyoto's World Data Center
### Function `write_imf_input` {#swmfpy.io.write_imf_input}
### Function [swmfpy.io.write_imf_input](#swmfpy.io.write_imf_input)
......@@ -188,7 +187,7 @@ Other paramaters:
# Module `swmfpy.paramin` {#swmfpy.paramin}
# Module [swmfpy.paramin](#swmfpy.paramin)
Tools to manipulate or create SWMF param.in files
......@@ -201,7 +200,7 @@ Tools to manipulate or create SWMF param.in files
### Function `replace` {#swmfpy.paramin.replace}
### Function [swmfpy.paramin.replace](#swmfpy.paramin.replace)
......
......@@ -167,18 +167,23 @@ def read_gm_log(filename, colnames=None, index_by_time=True):
Args:
filename (str): The filename as a string.
colnames (list(str)): Supply the name of the columns
colnames ([str]): Supply the name of the columns
index_by_time (bool): Change the index to a time index
Returns:
pandas.DataFrame of the log file
Examples:
# To plot AL and Dst get the log files
To plot AL and Dst get the log files
```
geo = swmfpy.read_gm_log("run/GM/IO2/geoindex_e20140215-100500.log")
dst = swmfpy.read_gm_log("run/GM/IO2/log_e20140215-100500.log")
# Then plot using pandas features
```
Then plot using pandas features
```
dst["dst_sm"].plot.line()
geo["AL"].plot.line()
```
"""
# If column names were not specified
if not colnames:
......
"""Tools to manipulate or create SWMF param.in files
"""
import logging
def replace(input_file, replace, output_file="PARAM.in"):
def replace(input_file, parameters, output_file="PARAM.in"):
"""Replace values for the parameters in a PARAM.in file.
Note, if you have repeat commands this will replace all the repeats.
Args:
input_file (str): String of PARAM.in file name.
replace (dict): Dictionary of strs with format
parameters (dict): Dictionary of strs with format
replace = {"#COMMAND": ["value", "comments", ...]}
This is case sensitive.
output_file (str): (default "PARAM.in") The output file to write to.
......@@ -36,9 +35,9 @@ def replace(input_file, replace, output_file="PARAM.in"):
lines = list(paramin)
for line_num, line in enumerate(lines):
words = line.split()
if words and words[0] in replace.keys():
if words and words[0] in parameters.keys():
command = words[0] # Current command
for param, value in enumerate(replace[command]):
for param, value in enumerate(parameters[command]):
newline = ""
for text in value:
newline += text + "\t\t\t"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment