trichter / yam

Yet another monitoring tool using correlations of ambient noise
MIT License
22 stars 11 forks source link

stations order in the cross-correlations are not in the same order defined in conf.json #18

Open alemkhodadadi opened 6 hours ago

alemkhodadadi commented 6 hours ago

After plotting the cross correlations, I see asymmetric arrivals so I wanted to have all the strong arrivals in the casual side. so I tried to change the order between the station1 and station2 in the parameter _stationcombinations in the conf.json file. so I changed "station_combinations": ["PK-PM"] to "station_combinations": ["PM-PK"] but after running the correlate command, I checked the generated stack.h5 again but the trace id for PM-PK is still 'PK.DPT.PM.DPT' . It happens for all other pairs also. My question is, is the code re-ordering the station pairs alphabetically? I also tried to reverse the data array in some traces in the final H5 file withobspy.Stream.write function but it ended up with corruption in the group names in the h5 file and the package (yam) cannot read the stack file again for example for plotting or checking the info.
What would you suggest to have the desired order of stations in all station-pairs?

alemkhodadadi commented 5 hours ago

I temporarily solved my problem just for the plotting by adding an extra argument _station_orderchange=None to the function _plot_corr_vsdist in the imaging.py file. I put the id of the pairs that I need to be reversed and it just changes the order of the trace data just before plotting them.

def plot_corr_vs_dist(arguments, station_order_change=None):
        ###
        for tr in stack:
            if station_order_change is not None:
                if tr.id in station_order_change:
                    tr.data = tr.data[::-1]
                    station1 = tr.stats.station1
                    station2 = tr.stats.station2
                    tr.stats.station1 = station2
                    tr.stats.station2 = station1
        ###

but I look forward to find a way to have the final stack.h5 file with the desired station-pair orders.