Aim is to have a record of the entire NZGMDB process so it is clear on what exactly is being done.
CURRENTLY IN DRAFTING PHASE SO WILL BE RANDOM QUICK NOTES
Geonet Mseed Creation:1: Downloads the recent earthquake data from geonet within the given date range When fetching the event line for the source table If the prefer_mag_type is m then gets all the event cat magnitudes and finds the max for mb ml and mlv Otherwise if it isnt m for the prefer_mag_type then just set the magnitude uncertainty values to the preferred magnitude values When grabbing the station magnitude lines it gets the stations within a given radius The inventory is then looped over and the waveform is extracted from the client.
The start time is ptime_est - the in_time_difference which is set to 15 in the config
Where ds is the output from the AS_16 model from openquake (previously was using a custom model that had incorrect coefficients) Only channel codes that are selected are HN? and BN? For the station magnitude line the station magnitude is obtained from the Z channel where the first 2 channel codes match if possible otherwise is set to None and the type is set to the pref_mag_type Multiprocessing per event_id Note: check for response adding the same for all channels |
Tectonic Domain Addition:Takes the earthquake source table as an input and a bunch of shape files with CMT and NZSMDB data
Then the regions are used with a horizontal and vertical threshold from each lat lon to each point on the region and depth to determine the tect class
If the NZSMDB then has a tect_class defined for the given evid then it is replaced and the tect_method is set to be the NZSMDB. |
Phase_arrival:p wave picker and a gen phase arrival for creating the table needed for output csv
mseed file PosixPath('/home/joel/local/gmdb/testing_folder/waveforms/2021/2021p001797/mseed/2021p001797_PAWZ_EH.mseed') has 2 P wave picks but are both exactly the same |
SNR Calculation:Takes in an input of a phase arrival table and mseed files to write SNR files in the snr_fas directory A common frequency vector is used which is defined as Applies initial processing on the record such as
Grabs the tp from the phase arrival table. (Index in the waveform where the p-wave arrives not just datetime) If all these steps pass then SNR / FAS is calculated as below
The output is the snr_fas files in the given event directory as well as a single metadata csv in the flatfiles directory with the skipped records and reasons why they were skipped. TODOChange SNR output names, remove last channel and add loc Random SNR write issue, leaking into extra columns? Might be a once off strange error, maybe a check to redo if persist 2 tapers for processing?? Do we need to specify no taper or zero padding in initial processing? |
Fmax calculation:Still to be intergrated into the workflow
I'd say the steps for this also need to be investigated and approved by the wider team (later work to be done) |
GMC:Blackbox, just requires mseed files TODOMake work with the full workflow (Upgrade to tensorflow2) |
Process records:Takes a fmax file and the gmc predictions for fmin and fmax and requires mseed files A quick check is done that there is all 3 components (This is some bug that needs to be fixed in geonet.py) Initial pre_processing (Same as whats written in SNR) is then performed and processing is skipped if the Inventory failed to fetch or failed to remove sensitivity fmax and fmin values are then extracted from the gmc and fmax dataframes Then the 000, 090 and ver components are selected from the initial processed mseed (rotated)
After all that saves as individual component files named the same as the mseed but with the extentions of .000 .090 and .ver in the waveforms directory but under "processed" |
IM Calculation:psa_periods = np.asarray([0.01, 0.02, 0.03, 0.04, 0.05, 0.075, 0.1, 0.12, 0.15, 0.17, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.9, 1.0, 1.25, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 7.5, 10.0]) Maybe remove the gm_all? - Maybe just rename or combine by default Add in the year to output directory steps for consistancy |
Merge Faltfiles:Original steps:
|