-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from bottero/feature/adding_comments
Added a whole bunch of comments. Also allowed for new versions of specfem to be used
- Loading branch information
Showing
82 changed files
with
2,261 additions
and
1,360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
#!/bin/sh | ||
|
||
rm -rf output* | ||
usage="$(basename "$0") [-h] -- delete directories output, output.stat*, output.optim | ||
and scratch in the current directory | ||
where: | ||
-h show this help text" | ||
|
||
while getopts ':hs:' option; do | ||
case "$option" in | ||
h) echo "$usage" | ||
exit | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND - 1)) | ||
|
||
rm -rf output output.stat* output.optim | ||
rm -rf scratch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,73 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse, os, sys | ||
|
||
from seisflows.config import config, loadpy, names, tilde_expand, Dict, Struct | ||
# | ||
# This is Seisflows | ||
# | ||
# See LICENCE file | ||
# | ||
# sfresume: | ||
# Workflow submission script | ||
# | ||
############################################################################### | ||
|
||
# Import system modules | ||
import argparse | ||
import os | ||
import sys | ||
from os.path import join | ||
|
||
# Local imports | ||
from seisflows.config import loadpy, names, tilde_expand, Dict | ||
from seisflows.tools import unix | ||
from seisflows.tools.tools import loadobj | ||
|
||
|
||
def getargs(): | ||
""" This function run argparse (see | ||
https://docs.python.org/2/howto/argparse.html) to process the arguments | ||
given by the user along with sfresume. Define default behaviour if they are | ||
not given and help message when sfresume -h is run | ||
""" | ||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument('--workdir', nargs='?', | ||
default=os.getcwd()) | ||
parser.add_argument('--workdir', nargs='?', default=os.getcwd(), | ||
help="working directory") | ||
|
||
parser.add_argument('--parameter_file', nargs='?', | ||
default='parameters.py') | ||
parser.add_argument('--parameter_file', nargs='?', default='parameters.py', | ||
help="parameter file") | ||
|
||
parser.add_argument('--path_file', nargs='?', | ||
default='paths.py') | ||
parser.add_argument('--path_file', nargs='?', default='paths.py', | ||
help="paths file") | ||
|
||
return parser.parse_args() | ||
|
||
|
||
if __name__ == "__main__": | ||
### workflow submission script | ||
""" Workflow submission script | ||
""" | ||
|
||
args = getargs() | ||
|
||
# register parameters | ||
# Register parameters | ||
parameters = loadpy(args.parameter_file) | ||
sys.modules['seisflows_parameters'] = Dict(parameters) | ||
|
||
# register paths | ||
# Register paths | ||
paths = tilde_expand(loadpy(args.path_file)) | ||
sys.modules['seisflows_paths'] = Dict(paths) | ||
|
||
unix.mkdir(args.workdir) | ||
unix.cd(args.workdir) | ||
|
||
# reload objects | ||
# Reload objects | ||
for name in names: | ||
fullfile = join(args.workdir, 'output', 'seisflows_'+name+'.p') | ||
sys.modules['seisflows_'+name] = loadobj(fullfile) | ||
|
||
# parameter checking | ||
# Parameter checking | ||
for name in names: | ||
sys.modules['seisflows_'+name].check() | ||
|
||
# submit workflow | ||
# Submit workflow | ||
workflow = sys.modules['seisflows_workflow'] | ||
system = sys.modules['seisflows_system'] | ||
system.submit(workflow) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.