Skip to Content

Preparations for inversion

This part prepares necessary files to run this examples, including:

  • Download the original traveltime data file raw link 
  • Download the initial model in HDF5 format raw link 

Users can directly run the following codes to generate all necessary files automatically.

cd Script_data_filtering python prepare_input_files.py cd input_data tar -xf src_rec_Turkey.tar.gz cd ../..

Here, we demonstrate the preparation step-by-step. First, please load necessary modules in Python Script:

import os import requests

Download the original data file

The original data file is downloaded as Script_data_filtering/input/src_rec_Turkey.tar.gz. The original data can be obtained from ISC 

url = 'https://zenodo.org/records/18195841/files/src_rec_Turkey.tar.gz?download=1' path = "./input/src_rec_Turkey.tar.gz" # check file existencetar.gz if not os.path.exists(path): try: os.mkdir("./input") except: pass print("Downloading src_rec_Turkey.tar.gz from Zenodo...") response = requests.get(url, stream=True) with open(path, 'wb') as out_file: out_file.write(response.content) print("Download complete.") else: print("src_rec_Turkey.tar.gz already exists.")

Using tar -xf src_rec_Turkey.tar.gz can unzip the compressive data file.

Download initial model

The initial model is downloaded as 2_models/model_1d_crust1.0_N61_121_61.h5. It is a 1-D isotropic model, built by horizontally averaging the crust 1.0 model.

url = 'https://zenodo.org/records/18195841/files/model_1d_crust1.0_N61_121_61.h5?download=1' path = "../2_models/model_1d_crust1.0_N61_121_61.h5" # check file existence if not os.path.exists(path): try: os.mkdir("../2_models") except: pass print("Downloading model_1d_crust1.0_N61_121_61.h5 from Zenodo...") response = requests.get(url, stream=True) with open(path, 'wb') as out_file: out_file.write(response.content) print("Download complete.") else: print("model_1d_crust1.0_N61_121_61.h5 already exists.")
Last updated on