EQTransformer.utils.downloader module

Created on Sat Aug 31 21:21:31 2019

@author: mostafamousavi

last update: 01/29/2021

EQTransformer.utils.downloader.downloadMseeds(client_list, stations_json, output_dir, start_time, end_time, min_lat, max_lat, min_lon, max_lon, chunk_size, channel_list=[], n_processor=None)[source]

Uses obspy mass downloader to get continuous waveforms from a specific client in miniseed format in variable chunk sizes. The minimum chunk size is 1 day.

Parameters:
  • client_list (list) – List of client names e.g. [“IRIS”, “SCEDC”, “USGGS”].
  • stations_json (dic,) – Station informations.
  • output_dir (str) – Output directory.
  • min_lat (float) – Min latitude of the region.
  • max_lat (float) – Max latitude of the region.
  • min_lon (float) – Min longitude of the region.
  • max_lon (float) – Max longitude of the region.
  • start_time (str) – Start DateTime for the beginning of the period in “YYYY-MM-DDThh:mm:ss.f” format.
  • end_time (str) – End DateTime for the beginning of the period in “YYYY-MM-DDThh:mm:ss.f” format.
  • channel_list (str, default=[]) – A list containing the desired channel codes. Downloads will be limited to these channels based on priority. Defaults to [] –> all channels
  • chunk_size (int) – Chunck size in day.
  • n_processor (int, default=None) – Number of CPU processors for parallel downloading.
Returns:

output_name/station_name/*.mseed

Return type:

Miniseed fiels for each station.

Warning

usage of multiprocessing and parallel downloads heavily depends on the client. It might cause missing some data for some network. Please test first for some short period and if It did miss some chunks of data for some channels then set n_processor=None to avoid parallel downloading.

EQTransformer.utils.downloader.downloadSacs(client, stations_json, output_dir, start_time, end_time, patience, n_processor=None)[source]

Uses obspy to get continuous waveforms from IRIS in sac format after preprocessing and in daily chunks. The difference to the mseed downloader is that this function removes the instrument response as it gets the data.

Parameters:
  • client_list (list) – List of client names e.g. [“IRIS”, “SCEDC”, “USGGS”].
  • stations_json (dic,) – Station informations.
  • output_dir (str) – Output directory.
  • start_time (str) – Start DateTime for the beginning of the period in “YYYY-MM-DDThh:mm:ss.f” format.
  • end_time (str) – End DateTime for the beginning of the period in “YYYY-MM-DDThh:mm:ss.f” format.
  • patience (int) – The maximum number of days without data that the program allows continuing the downloading.
  • chunk_size (int) –

    Chunck size in day.

    n_processor: int, default=None
    Number of CPU processors for parallel downloading.
Returns:

output_name/station_name/*.SAC

Return type:

SAC fiels for each station.

Warning

This function was not tested so you should be careful using it and make sure it gets the data.

EQTransformer.utils.downloader.makeStationList(json_path, client_list, min_lat, max_lat, min_lon, max_lon, start_time, end_time, channel_list=[], filter_network=[], filter_station=[], **kwargs)[source]

Uses fdsn to find available stations in a specific geographical location and time period.

Parameters:
  • json_path (str) – Path of the json file that will be returned
  • client_list (list) – List of client names e.g. [“IRIS”, “SCEDC”, “USGGS”].
  • min_lat (float) – Min latitude of the region.
  • max_lat (float) – Max latitude of the region.
  • min_lon (float) – Min longitude of the region.
  • max_lon (float) – Max longitude of the region.
  • start_time (str) – Start DateTime for the beginning of the period in “YYYY-MM-DDThh:mm:ss.f” format.
  • end_time (str) – End DateTime for the beginning of the period in “YYYY-MM-DDThh:mm:ss.f” format.
  • channel_list (str, default=[]) – A list containing the desired channel codes. Downloads will be limited to these channels based on priority. Defaults to [] –> all channels
  • filter_network (str, default=[]) – A list containing the network codes that need to be avoided.
  • filter_station (str, default=[]) – A list containing the station names that need to be avoided.
  • kwargs – special symbol for passing Client.get_stations arguments
Returns:

stations_list.json

Return type:

A dictionary containing information for the available stations.