Browse Source

changed wording to use "report" instead of "reports" everywhere

priors
Sebastian Heimann 2 years ago
parent
commit
832a1122f3
9 changed files with 103 additions and 100 deletions
  1. +1
    -1
      docs/source/config/problems/index.rst
  2. +1
    -1
      docs/source/examples/waveform_regional/index.rst
  3. +1
    -1
      docs/source/examples/waveform_wphase/index.rst
  4. +21
    -21
      docs/source/overview/index.rst
  5. +14
    -14
      docs/source/report/index.rst
  6. +13
    -13
      src/apps/grond.py
  7. +3
    -3
      src/report/app/index.html
  8. +1
    -1
      src/report/app/report.html
  9. +48
    -45
      src/report/base.py

+ 1
- 1
docs/source/config/problems/index.rst View File

@ -46,7 +46,7 @@ problem configurations:
.. glossary::
``name_template``
can be any string and provides a stem for the result folders `runs` and `reports` to identify different optimisations. Meaningful is to use short event and problem identifications in this string.
can be any string and provides a stem for the result folders `runs` and `report` to identify different optimisations. Meaningful is to use short event and problem identifications in this string.
``norm_exponent``
defines the norm of combining several `normalization_family` in the global misfit. This integer value is 1 or larger. Please find here more information on the global `misfit calculation in Grond`_.


+ 1
- 1
docs/source/examples/waveform_regional/index.rst View File

@ -153,7 +153,7 @@ To get some more insight into the setup, we can run
grond report -so config/regional_cmt.gronf gfz2018pmjk
This will plot some diagnostic figures, create web pages in a new directory :file:`reports`, and finally open these in a web browser.
This will plot some diagnostic figures, create web pages in a new directory :file:`report`, and finally open these in a web browser.
Starting the optimisation


+ 1
- 1
docs/source/examples/waveform_wphase/index.rst View File

@ -151,7 +151,7 @@ To get some more insight into the setup, we can now run
grond report -so config/wphase_cmt.gronf gfz2015sfdd
This will plot some diagnostic figures, create web pages in a new directory :file:`reports`, and finally open these in a web browser.
This will plot some diagnostic figures, create web pages in a new directory :file:`report`, and finally open these in a web browser.
Starting the optimisation


+ 21
- 21
docs/source/overview/index.rst View File

@ -34,7 +34,7 @@ Project folder layout
To use Grond with your own dataset, we suggest the following folder structure.
Single files and data formats listed here are explained below. The folders ``runs`` and ``reports`` are generated during and after the optimisation, respectively.
Single files and data formats listed here are explained below. The folders ``runs`` and ``report`` are generated during and after the optimisation, respectively.
.. code-block :: none
@ -45,34 +45,34 @@ Single files and data formats listed here are explained below. The folders ``run
├── data
│ └── events # several events could be set up here
│ ├── laquila2009
│ ├── laquila2009
│ │ ├── event.txt
│ │ ├── insar
│ │ ├── insar
│ │ │   ├── dsc_insar.npz
│ │ │   ├── dsc_insar.yml
│ │ │ :
│ │ │
│ │ ├── waveforms
│ │ ├── waveforms
│ │ │ ├── raw # contains Mini-SEED files
│ │ │ │ ├── trace_BK-CMB--BHE_2009-04-06_00-38-31.mseed
│ │ │ │ ├── trace_BK-CMB--BHN_2009-04-06_00-38-31.mseed
│ │ │ │   :
│ │ │ │ ├── trace_BK-CMB--BHE_2009-04-06_00-38-31.mseed
│ │ │ │ ├── trace_BK-CMB--BHN_2009-04-06_00-38-31.mseed
│ │ │ │   :
│ │ │ └── stations.xml
│ │ │
│ │ └── gnss
│ │ └── gnss.yml
│ :
├── gf_stores # contains Green's functions
├── gf_stores # contains Green's functions
│ ├── Abruzzo_Ameri_nearfield # static near-field GF store
│ │ └── ...
│ ├── global_2s_25km # dynamic far-field GF store
│ │ └── ...
│ :
├── runs # created at runtime, contains individual optimisation results
│ └── ...
└── reports
└── report
└── ...
Input data (observations)
@ -161,7 +161,7 @@ An empty project structure can be created with the subcommand :option:`grond ini
.. tip::
Existing project folders can be overwritten using ``grond init --force <project-folder>``
You can create an initial Grond configuration file for a centroid moment tensor optimisation based on global seismic waveforms with
.. code-block :: sh
@ -201,7 +201,7 @@ The scenario can contain the following synthetic observations:
* GNSS surface displacements
.. code-block :: sh
grond scenario --targets=waveforms,insar <project-folder>
A map of the random scenario is plotted in :file:`scenario_map.pdf`.
@ -243,8 +243,8 @@ During the optimisation, results are aggregated in an output directory, referred
│ └── ...
├── data
│ └── ...
├── gf_stores
│ └── ...
├── gf_stores
│ └── ...
├── runs # contains individual optimisation results
│ ├── laquila2009_joint.grun
│ │ ├── ... # some bookkeeping yaml-files
@ -256,7 +256,7 @@ During the optimisation, results are aggregated in an output directory, referred
│ │ └── models
│ :
└── reports
└── report
└── ...
@ -272,7 +272,7 @@ Finally, you may run
grond report <rundir>
to aggregate and visualize results to a browsable summary, (by default) under the directory `reports`.
to aggregate and visualize results to a browsable summary, (by default) under the directory `report`.
.. code-block :: sh
@ -282,9 +282,9 @@ to aggregate and visualize results to a browsable summary, (by default) under th
│ └── ...
├── gf_stores
│ └── ...
├── runs
│ └── ...
└── reports # contains all graphical presentations of the results in 'runs'
├── runs
│ └── ...
└── report # contains all graphical presentations of the results in 'runs'
├── index.html # open in browser to surf through all 'runs'
├── ... # more bookeeping yaml-files
@ -301,10 +301,10 @@ to aggregate and visualize results to a browsable summary, (by default) under th
│ │ ├── fits_satellite # visual comparison of data and synthetics
│ │ │ └── ...
│ │ :
Please find detailed information on the reports and automatic plots in the section :doc:`/report/index`.
Please find detailed information on the report and automatic plots in the section :doc:`/report/index`.
The results can be exported in various ways by running the subcommand


+ 14
- 14
docs/source/report/index.rst View File

@ -31,36 +31,36 @@ When an inversion is finished, you can create and open a report with:
grond report -so <rundir>
By default, the report is generated in the directory ``reports``. Results from
multiple runs are aggregated into a single ``reports`` directory by repeatedly
By default, the report is generated in the directory ``report``. Results from
multiple runs are aggregated into a single ``report`` directory by repeatedly
calling ``grond report <rundir>``.
The flag ``-s`` will serve the HTML pages locally with a built-in web server
and ``-o`` will open it in your web browser (see :option:`grond report`
``--help``). Alternatively, you can simply open the file ``reports/index.html``
``--help``). Alternatively, you can simply open the file ``report/index.html``
with your web browser. If doing so, it may be necessary to adjust browser
permissions to access the report locally (through a ``file://...`` URL).
Sharing reports on the local network
------------------------------------
Sharing a report on the local network
-------------------------------------
When running Grond on a remote machine, run ``grond report -S`` to serve the
reports directory on the local network. Point the web browser on your desktop
machine to the URL printed on the terminal. If the default server port cannot
be opened, choose a different one using ``--port=<number>`` with a port number
in the range 1025 - 65535.
``report`` directory on the local network. Point the web browser on your
desktop machine to the URL printed on the terminal. If the default server port
cannot be opened, choose a different one using ``--port=<number>`` with a port
number in the range 1025 - 65535.
Sharing reports on the internet
-------------------------------
Sharing a report on the internet
--------------------------------
The ``reports`` directory is self-contained and can be transferred to a
The ``report`` directory is self-contained and can be transferred to a
different computer for viewing. Place it into a web server directory to share
it with the world.
For convenience, the archive file ``grond-reports.tar.gz`` contains the
complete report directory. You can find it in the ``reports`` directory or
For convenience, the archive file ``grond-report.tar.gz`` contains the
complete report directory. You can find it in the ``repors`` directory or
under a link on the report web page. After unpacking, place the archive file
into the unpacked directory to keep the archive file link operational.


+ 13
- 13
src/apps/grond.py View File

@ -137,7 +137,7 @@ Check out the YAML configuration in {config} and start the optimisation by:
grond go {config}
'''
report = '''
To open the reports in your web browser, run
To open the report in your web browser, run
grond report -s --open {config}
'''
@ -1030,7 +1030,7 @@ def command_report(args):
help='quick-and-dirty update parameter files without plotting')
parser.add_option(
'--parallel', dest='nparallel', type=int, default=1,
help='set number of reports to generate in parallel, '
help='set number of runs to process in parallel, '
'If set to more than one, --status=quiet is implied.')
parser, options, args = cl_parse('report', args, setup)
@ -1058,18 +1058,18 @@ def command_report(args):
die(str(e))
if len(args) == 1 and op.exists(op.join(args[0], 'index.html')):
conf.reports_base_path = conf.rel_path(args[0])
conf.report_base_path = conf.rel_path(args[0])
s_conf = ' %s' % args[0]
args = []
reports_base_path = conf.expand_path(conf.reports_base_path)
report_base_path = conf.expand_path(conf.report_base_path)
if options.index_only:
report_index(conf)
report_archive(conf)
args = []
reports_generated = False
entries_generated = False
payload = []
if args and all(op.isdir(rundir) for rundir in args):
@ -1090,17 +1090,17 @@ def command_report(args):
die(str(e))
if payload:
reports_generated = []
entries_generated = []
for result in parimap.parimap(
make_report, *zip(*payload), nprocs=options.nparallel):
reports_generated.append(result)
entries_generated.append(result)
all_failed = not any(reports_generated)
reports_generated = any(reports_generated)
all_failed = not any(entries_generated)
entries_generated = any(entries_generated)
if all_failed:
die('no reports generated')
die('no report entries generated')
report_index(conf)
report_archive(conf)
@ -1121,14 +1121,14 @@ def command_report(args):
elif options.open:
import webbrowser
url = 'file://%s/index.html' % op.abspath(reports_base_path)
url = 'file://%s/index.html' % op.abspath(report_base_path)
webbrowser.open(url)
else:
if not reports_generated and not options.index_only:
if not entries_generated and not options.index_only:
logger.info('nothing to do, see: grond report --help')
if reports_generated and not (options.serve or options.serve_external):
if entries_generated and not (options.serve or options.serve_external):
logger.info(CLIHints('report', config=s_conf))


+ 3
- 3
src/report/app/index.html View File

@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en" ng-app="reportApp">
<head>
<head ng-controller="InfoController">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Grond - Earthquake Reports</title>
<title>{{ get_info().title }}</title>
<!-- CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
@ -57,7 +57,7 @@
<div class="col-10">
<p class="text-center">
<a href="https://pyrocko.org/grond/" target="_blank">Busted with Grond</a> -
<span ng-if="get_report_grond_versions().length > 0">Reports:
<span ng-if="get_report_grond_versions().length > 0">Report:
<span ng-repeat="vers in get_report_grond_versions()">
v{{ vers + ($last ? '' : ', ') }}
</span> -


+ 1
- 1
src/report/app/report.html View File

@ -2,7 +2,7 @@
<script>$("#browser-warning").hide();</script>
<nav class="navbar navbar-main navbar-expand navbar-dark fixed-top bg-dark shadow flex-fill">
<a href="" class="navbar-brand">Grond Reports</a>
<a href="" class="navbar-brand">Grond Report</a>
<input
class="form-control form-control-dark"
type="text"


+ 48
- 45
src/report/base.py View File

@ -37,11 +37,11 @@ class ReportIndexEntry(Object):
class ReportConfig(HasPaths):
reports_base_path = Path.T(default='reports')
report_sub_path = String.T(
report_base_path = Path.T(default='report')
entries_sub_path = String.T(
default='${event_name}/${problem_name}')
title = Unicode.T(
default=u'Grond Reports',
default=u'Grond Report',
help='Title shown on report overview page.')
description = Unicode.T(
default=u'This interactive document aggregates earthquake source '
@ -90,8 +90,8 @@ def write_config(config, path):
'cannot write Grond report configuration file: %s' % path)
def iter_report_dirs(reports_base_path):
for path, dirnames, filenames in os.walk(reports_base_path):
def iter_report_entry_dirs(report_base_path):
for path, dirnames, filenames in os.walk(report_base_path):
for dirname in dirnames:
dirpath = op.join(path, dirname)
stats_path = op.join(dirpath, 'problem.yaml')
@ -122,54 +122,54 @@ def report(env, report_config=None, update_without_plotting=False,
event_name = env.get_current_event_name()
problem = env.get_problem()
logger.info('Creating report for event %s...' % event_name)
logger.info('Creating report entry for run "%s"' % problem.name)
fp = report_config.expand_path
report_path = expand_template(
entry_path = expand_template(
op.join(
fp(report_config.reports_base_path),
report_config.report_sub_path),
fp(report_config.report_base_path),
report_config.entries_sub_path),
dict(
event_name=event_name,
problem_name=problem.name))
if op.exists(report_path) and not update_without_plotting:
shutil.rmtree(report_path)
if op.exists(entry_path) and not update_without_plotting:
shutil.rmtree(entry_path)
try:
problem.dump_problem_info(report_path)
problem.dump_problem_info(entry_path)
guts.dump(env.get_config(),
filename=op.join(report_path, 'config.yaml'),
filename=op.join(entry_path, 'config.yaml'),
header=True)
util.ensuredir(report_path)
plots_dir_out = op.join(report_path, 'plots')
util.ensuredir(entry_path)
plots_dir_out = op.join(entry_path, 'plots')
util.ensuredir(plots_dir_out)
event = env.get_dataset().get_event()
guts.dump(event, filename=op.join(report_path, 'event.reference.yaml'))
guts.dump(event, filename=op.join(entry_path, 'event.reference.yaml'))
try:
rundir_path = env.get_rundir_path()
core.export(
'stats', [rundir_path],
filename=op.join(report_path, 'stats.yaml'))
filename=op.join(entry_path, 'stats.yaml'))
core.export(
'best', [rundir_path],
filename=op.join(report_path, 'event.solution.best.yaml'),
filename=op.join(entry_path, 'event.solution.best.yaml'),
type='event-yaml')
core.export(
'mean', [rundir_path],
filename=op.join(report_path, 'event.solution.mean.yaml'),
filename=op.join(entry_path, 'event.solution.mean.yaml'),
type='event-yaml')
core.export(
'ensemble', [rundir_path],
filename=op.join(report_path, 'event.solution.ensemble.yaml'),
filename=op.join(entry_path, 'event.solution.ensemble.yaml'),
type='event-yaml')
except (environment.NoRundirAvailable, ProblemInfoNotAvailable,
@ -182,7 +182,7 @@ def report(env, report_config=None, update_without_plotting=False,
pcc = report_config.plot_config_collection.get_weeded(env)
plot.make_plots(
env,
plots_path=op.join(report_path, 'plots'),
plots_path=op.join(entry_path, 'plots'),
plot_config_collection=pcc)
rie = ReportIndexEntry(
@ -191,25 +191,27 @@ def report(env, report_config=None, update_without_plotting=False,
grond_version=problem.grond_version,
run_info=env.get_run_info())
fn = op.join(report_path, 'event.solution.best.yaml')
fn = op.join(entry_path, 'event.solution.best.yaml')
if op.exists(fn):
rie.event_best = guts.load(filename=fn)
fn = op.join(report_path, 'event.reference.yaml')
fn = op.join(entry_path, 'event.reference.yaml')
if op.exists(fn):
rie.event_reference = guts.load(filename=fn)
fn = op.join(report_path, 'index.yaml')
fn = op.join(entry_path, 'index.yaml')
guts.dump(rie, filename=fn)
except Exception as e:
logger.warn(
'report generation failed, removing incomplete report dir: %s'
% report_path)
'failed to create report entry, removing incomplete subdirectory: '
'%s' % entry_path)
raise e
if op.exists(report_path):
shutil.rmtree(report_path)
if op.exists(entry_path):
shutil.rmtree(entry_path)
logger.info('Done creating report entry for run "%s".' % problem.name)
if make_index:
report_index(report_config)
@ -222,50 +224,51 @@ def report_index(report_config=None):
if report_config is None:
report_config = ReportConfig()
reports_base_path = report_config.reports_base_path
reports = []
for report_path in iter_report_dirs(reports_base_path):
report_base_path = report_config.report_base_path
entries = []
for entry_path in iter_report_entry_dirs(report_base_path):
fn = op.join(report_path, 'index.yaml')
fn = op.join(entry_path, 'index.yaml')
if not os.path.exists(fn):
logger.warn(
'Skipping indexing of incomplete report: %s' % report_path)
'Skipping indexing of incomplete report entry: %s'
% entry_path)
continue
logger.info('Indexing %s...' % report_path)
logger.info('Indexing %s...' % entry_path)
rie = guts.load(filename=fn)
report_relpath = op.relpath(report_path, reports_base_path)
report_relpath = op.relpath(entry_path, report_base_path)
rie.path = report_relpath
reports.append(rie)
entries.append(rie)
guts.dump_all(
reports,
filename=op.join(reports_base_path, 'report_list.yaml'))
entries,
filename=op.join(report_base_path, 'report_list.yaml'))
guts.dump(
ReportInfo(
title=report_config.title,
description=report_config.description,
version_info=info.version_info()),
filename=op.join(reports_base_path, 'info.yaml'))
filename=op.join(report_base_path, 'info.yaml'))
app_dir = op.join(op.split(__file__)[0], 'app')
copytree(app_dir, reports_base_path)
logger.info('Created report in %s/index.html' % reports_base_path)
copytree(app_dir, report_base_path)
logger.info('Created report in %s/index.html' % report_base_path)
def report_archive(report_config):
if report_config is None:
report_config = ReportConfig()
reports_base_path = report_config.reports_base_path
report_base_path = report_config.report_base_path
logger.info('Generating report\'s archive...')
with tarfile.open(op.join(reports_base_path, 'grond-reports.tar.gz'),
with tarfile.open(op.join(report_base_path, 'grond-report.tar.gz'),
mode='w:gz') as tar:
tar.add(reports_base_path, arcname='grond-reports')
tar.add(report_base_path, arcname='grond-report')
def serve_ip(host):
@ -314,7 +317,7 @@ def serve_report(
if report_config is None:
report_config = ReportConfig()
path = report_config.expand_path(report_config.reports_base_path)
path = report_config.expand_path(report_config.report_base_path)
os.chdir(path)
host, port = addr


Loading…
Cancel
Save