Calculate Green Function Database

  • The first step of MCMTpy is to build Green’s function database. All parameters are written into a JSON file named build_GFs.json. Some brief descriptions of the parameters are included here following the definination.

  • We do not recommend using relative paths because of the possibility of errors. Absolute paths are preferred.

  • We used ASDF seismic data format to manage Green Function database, which is convenient to locally build up a database of pre-processed waveforms. ASDF file greatly reduces the number of green functions files, and a single ASDF file can replace thousands of green function files which may threw us into confusion in the management process. We store the Green‘s functions corresponding to Event_ID (QuakeML) in “Waveforms” of ASDF data. In the “Labels” of “Waveforms” , we store the phase (P and S) travel times which can be computed in advance by a given velocity model.

  • The general structure of MCMTpy stores Green‘s function with ASDF file format shown in the image below.

../_images/Green_Function_Database.png
  • You can also find some useful information about parameters in refers to pyfk.

Station and Source

Database_mode

  • Set to be .true. when you want to compute the Green’s function library for some region. For real examples, the GF databases may require up to several GBs of free disc space. In addition you need to set the following parameters correctly:

    Source_depth_min, Source_depth_max, Source_depth_spacing, Station_distance_radius_min, Station_distance_radius_max, Station_distance_spacing, Source_name, Network_name, Station_name, Station_depth_reference

  • Set to be .false. when you want to calculate the Green’s function for stations at which the source is given. You must provide an .txt file named Source_Station_info.txt, which including the longitude latitude and depth information of the source and station. Different sources should be separated by blank lines.

  • Source_Station_info.txt format.

    [source_name] [source_lat] [source_lon] [source_depth]

    [network_name] [station_name] [station_lat] [source_lon] [station_depth]

 1source_1  25.58 99.86  1
 2YN EYA 26.108 99.947 0
 3YN YUL 25.885 99.371 0
 4
 5source_2  25.58 99.86  2
 6YN EYA 26.108 99.947 0
 7YN YUL 25.885 99.371 0
 8XG CFT 25.848 100.517 0
 9YN BAS 25.118 99.146 0
10
11source_3  25.58 99.86  3
12YN WES 23.372 104.253 0
13YN MLP 23.128 104.702 0
14YN FUN 23.624 105.620 0

Source_depth_min

  • The minimum source depth in Green’s function databases (km).

Source_depth_max

  • The maximum source depth in Green’s function databases (km).

Source_depth_spacing

  • Interval of source depths in Green’s function databases (km).

Station_distance_radius_min

  • The minimum distance of the station in Green’s function databases (km or degree, depend by degrees).

Station_distance_radius_max

  • The maximum distance of the station in Green’s function databases (km or degree, depend by degrees).

Station_distance_spacing

  • Horizontal spacing interval in Green’s function databases (km or degree, depend by degrees).

Source_name

  • Source name in Green’s function databases, default value is source, please do not change. Only lowercase letters are supported.

Network_name

  • Network name in Green’s function databases, default value is NET, please do not change.

Station_name

  • Station name in Green’s function databases, default value is STA, please do not change.

Station_depth_reference

  • Depth of all virtual stations (km).

Note

When Database_mode = .false., depths can vary from station to station. But when set to be .true, all stations must use the same depth Station_depth_reference.

MPI

MPI_n

  • CPU number. When Database_mode = .false., the number of call cores should be less than or equal to the number of source. But when set to be .true, there are no limits.

Path

DATADIR

  • The output path of the Green function databases.

DATADIR_splits

  • A subfolder under DATADIR for Green’s function. Please keep the path relative to DATADIR.

SourceModel

source_mechanism

  • Focal mechanism, not used. Please set it to .null..

srcType

  • The type of Green’s function, dc(double-couple) sf(single-couple) ep(explosion). Please set it to .dc..

SeisModel

Velocity_model

  • Path to the velocity model file. And the format:

    thick(km), vs(km/s), vp(km/s), density(g/cm^3), Qs, Qp

 15.01000000   3.17601610   5.41925121   2.50000000   600.00000000   1200.00000000   
 25.01000000   3.36477536   5.67947907   2.55000000   600.00000000   1200.00000000   
 35.01000000   3.52147424   5.93255556   2.60000000   600.00000000   1200.00000000   
 45.01000000   3.55152174   6.00984300   2.65000000   600.00000000   1200.00000000   
 55.01000000   3.54084541   6.02592110   2.70000000   600.00000000   1250.00000000   
 65.01000000   3.58840419   6.14793478   2.75000000   650.00000000   1300.00000000   
 75.01000000   3.75369968   6.48572061   2.80000000   700.00000000   1350.00000000   
 85.01000000   3.94361514   6.86566667   2.90000000   750.00000000   1400.00000000   
 910.01000000   4.12710548   7.20229388   3.00000000   800.00000000   1500.00000000   
1010.01000000   4.30825765   7.55049678   3.10000000   850.00000000   1600.00000000   
1110.01000000   4.38069968   7.72566425   3.20000000   850.00000000   1700.00000000   
1290.00000000   4.50000000   7.80000000   3.27000000   900.00000000   1800.00000000   

flattening

  • Set the flatten status of the velocity model, .true. or .false..

Config

The following parameters explanation refers to pyfk <https://github.com/ziyixi/pyfk>.

npt

  • The sampling points is a multiple of 2.

dt

  • Sampling interval in seconds

degrees

  • Use degrees instead of km, defaults to .true.. Only when Database_mode = .true., it can be changed to .false.

taper

  • Taper applies a low-pass cosine filter at fc=(1-taper)*f_Niquest, defaults to 0.3.

filter

  • Apply a high-pass filter with a cosine transition zone between freq. f1 and f2 in Hz, defaults to (0, 0).

dk

  • The non-dimensional sampling interval of wavenumber, defaults to 0.3.

smth

  • Makes the final sampling interval to be dt/smth, defaults to 1.

pmin

  • The min slownesses in term of 1/vs_at_the_source, defaults to 0.

pmax

  • The max slownesses in term of 1/vs_at_the_source, defaults to 1.

kmax

  • The kmax at zero frequency in term of 1/hs, defaults to 15.

rdep

  • Not used now. Please keep the default values of the parameters, defaults to 0 in km.

updn

  • The “up” for up-going wave only, “down” for down-going wave only, “all” for both “up” and “down”, defaults to “all”.

samples_before_first_arrival

  • The number of points before the first arrival, defaults to 50.

Logging file

  • MCMTpy will generates 2 logging files when it builds GFs datebase, that is prepro_para_info.txt and write_Source_Station_info_MPI. They record all the parameter information of GFs datebase. You can find them in DATADIR path.

Example

  • The example_path need to de changed to your path, and run this notebook to set build_GFs.json file.

 1#!/usr/bin/env python3
 2# -*- coding: utf-8 -*-
 3
 4import os
 5import sys
 6import json5
 7
 8
 9# The root directory of the project
10example_path = '/Users/yf/3.Project/8.MCMTpy/MCMTpy-master/data/example_yunnan'
11
12
13#------------------------------------------------------------#
14# we expect no parameters need to be changed below
15#------------------------------------------------------------#
16# 1. get notebook path
17notebook_path = sys.path[0]
18os.chdir(notebook_path)
19
20# 2. change path to Green_Funcs
21os.chdir('../Green_Funcs')
22print(os.listdir())
23
24# 3. show build_GFs.json 
25filename = 'build_GFs.json'
26with open(filename, 'r',encoding='utf-8') as f1:
27    gfs_json=json5.load(f1)
28f1.close()
29
30# 4. change parameters with absolute path
31gfs_json['Source_Station_info'] = os.path.join(example_path,"Green_Funcs/Source_Station_info.txt")
32gfs_json["DATADIR"] = os.path.join(example_path,"Green_Funcs/GFs1")
33gfs_json["DATADIR_splits"] = os.path.join(example_path,"Green_Funcs1/GFs1/GFs_splits")
34gfs_json["Velocity_model"] =  os.path.join(example_path,"v_model/v_model_yunnan.txt")        
35gfs_json_new = os.path.join(example_path,'Green_Funcs/build_GFs_new.json')
36
37with open(gfs_json_new,'w') as f2:
38    json5.dump(gfs_json, f2, indent=2)
39f2.close()
40
41# !mpirun -n 4 MCMTpy build_GFs pyfk -c build_GFs_new.json  > gfs.log
  • Now you can run MCMTpy in bash:

    $ mpirun -n 4 MCMTpy build_GFs pyfk -c build_GFs_new.json  > gfs.log
    

Note

Please follow the above parameter instructions and set all parameters correctly before running the program. Otherwise, it is easy to report an error!