E - A Time-Independent Experiment

This example shows how to run a realistic testing experiment (based on https://doi.org/10.4401/ag-4844) while summarizing the concepts from the previous tutorials.

TL; DR

In a terminal, navigate to floatcsep/tutorials/case_e and type:

$ floatcsep run config.yml

After the calculation is complete, the results will be summarized in results/report.md.

Experiment Components

The source code can be found in the tutorials/case_e folder or in GitHub. The input structure of the experiment is:

case_e
    └──  models
        ├── gulia-wiemer.ALM.italy.10yr.2010-01-01.xml
        ├── meletti.MPS04.italy.10yr.2010-01-01.xml
        └── zechar.TripleS-CPTI.italy.10yr.2010-01-01.xml
    ├── config.yml
    ├── models.yml
    └── tests.yml

Note

This experiment has only a subset of the original models and evaluations.

Configuration

Time

The time configuration is manifested in the time-config inset.

tutorials/case_e/config.yml
time_config:
  start_date: 2010-1-1T00:00:00
  end_date: 2022-1-1T00:00:00
  intervals: 4
  growth: cumulative

Region

The testing region is the official Italy CSEP Region obtained from csep.core.regions.italy_csep_region.

tutorials/case_e/config.yml
region_config:
  region: italy_csep_region
  mag_min: 5.0
  mag_max: 9.0
  mag_bin: 0.1
  depth_min: -2
  depth_max: 30

Catalog

The catalog is obtained from an authoritative source, namely the Bollettino Sismico Italiano (http://terremoti.ingv.it/en/bsi ), using the function csep.query_bsi()

tutorials/case_e/config.yml
catalog: query_bsi

Models

The models are set in models.yml. For simplicity, there are only three of the nineteen models originally submitted to the Italy Experiment.

tutorials/case_e/models.yml
- ALM:
    path: models/gulia-wiemer.ALM.italy.10yr.2010-01-01.xml
    forecast_unit: 10
    store_db: True
- MPS04:
    path: models/meletti.MPS04.italy.10yr.2010-01-01.xml
    forecast_unit: 10
    store_db: True
- TripleS-CPTI:
    path: models/zechar.TripleS-CPTI.italy.10yr.2010-01-01.xml
    forecast_unit: 10
    store_db: True

The .xml format is automatically detected and parsed by floatcsep readers.

Important

The forecasts are defined in [Earthquakes / 10-years], which is specified with the forecast_unit option (The default is forecast_unit: 1).

Note

The use_db flag allows floatcsep to transform the forecasts into a database (HDF5), which speeds up the calculations.

Post-Process

Additional options for post-processing can set using the postprocess option. Here, we customize the forecasts plotting with:

postprocess:
  plot_forecasts:
    cmap: magma
    region_border: True
    basemap: stock_img
    clabel_fontsize: 14
    cticks_fontsize: 12
    alpha_exp: 0.8
    catalog:
      legend: True
      legend_loc: 1
      legend_fontsize: 14
      legend_titlesize: 16
      markersize: 7

The forecasts are plotted and stored in tutorials/case_e/results/{timewindow}/forecasts/. See plot_spatial_dataset() for forecast plotting options and plot_catalog() for the catalog placed on top of those plots.

Running the experiment

The experiment can be run by navigating to the tutorials/case_e folder in the terminal and typing.

$ floatcsep run config.yml

This will automatically set all the calculation paths (testing catalogs, evaluation results, figures) and will create a summarized report in results/report.md.

Plot command

If only the result plots are desired when the calculation was already completed before, you can type:

$ floatcsep plot config.yml

This can be used, for example, when an additional plot is desired without re-running the entire experiment. Try adding the following line to the postprocess inset of the config.yml file.

postprocess:
  plot_forecasts:
    colormap: magma

and re-run with the plot command. A forecast figure will re-appear in results/{window}/forecasts with a different colormap. Additional forecast and catalog plotting options can be found in the csep.utils.plots.plot_spatial_dataset() and csep.utils.plots.plot_catalog() pycsep functions.