Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata in Synthetics Calculation with FK in MTUQ #291

Open
SeismoFelix opened this issue Jan 15, 2025 · 5 comments
Open

Metadata in Synthetics Calculation with FK in MTUQ #291

SeismoFelix opened this issue Jan 15, 2025 · 5 comments

Comments

@SeismoFelix
Copy link
Member

Hello,

I am facing an interesting situation when I am calculating synthetics in MTUQ with an FK database. Basically with these two lines I am doing all the job:

pre_synthetics = greens.map(process_sw)
synthetics = pre_synthetics.get_synthetics(mt, components=['Z', 'R', 'T'])

The synthetics calculation worked. However, when I tried to save the synthetics, I realized that the streams in synthetics list do not contain most of the metadata that is required for obtaining the station name, network, station location, etc. Interestingly, this only happens in the newest version of MTUQ. When I tried with an old version, the synthetics contains a comprehensive amount of metadata.

With old version:
print(pair[0].stats)

           network: IR
           station: TNSJ
          location: 
           channel: Z
         starttime: 2017-12-01T02:31:44.000000Z
           endtime: 2017-12-01T02:34:13.980000Z
     sampling_rate: 50.0
             delta: 0.02
              npts: 7500
             calib: 1.0
           _format: SAC
        depth_in_m: None
    elevation_in_m: None
                id: IR.TNSJ.
          latitude: 33.9633
         longitude: 56.6089
               sac: AttribDict({'delta': 0.02, 'depmin': -0.29059753, 'depmax': 0.22340882, 'b': -60.0, 'e': 555.98, 'o': 0.0, 'stla': 33.9633, 'stlo': 56.6089, 'stel': 1123.0, 'stdp': 0.0, 'evla': 30.734, 'evlo': 57.39, 'evdp': 6.0, 'dist': 365.57446, 'az': 348.60342, 'baz': 168.18732, 'gcarc': 3.2871227, 'depmen': 1.4267704e-06, 'cmpaz': 348.60446, 'cmpinc': 0.0, 'nzyear': 2017, 'nzjday': 335, 'nzhour': 2, 'nzmin': 32, 'nzsec': 44, 'nzmsec': 0, 'nvhdr': 6, 'npts': 30800, 'iftype': 1, 'idep': 7, 'iztype': 9, 'leven': 1, 'lpspol': 0, 'lovrok': 1, 'lcalda': 1, 'unused23': 0, 'kstnm': 'TNSJ', 'kevnm': '', 'kcmpnm': 'BHR', 'knetwk': 'IR', 'kinst': 'Tr40'})

With new version:

     network: 
     station: 
    location: 
     channel: Z
   starttime: 2017-12-01T02:33:31.129997Z
     endtime: 2017-12-01T02:36:01.109997Z

sampling_rate: 50.0
delta: 0.02
npts: 7500
calib: 1.0
_component: T
_format: SAC
processing: ["ObsPy 1.4.1: detrend(options={}::type='demean')", "ObsPy 1.4.1: detrend(options={}::type='linear')", "ObsPy 1.4.1: taper(max_length=None::max_percentage=0.05::side='both'::type='hann')", "ObsPy 1.4.1: filter(options={'zerophase': False, 'freqmin': 0.030303030303030304, 'freqmax': 0.06666666666666667}::type='bandpass')"]
sac: AttribDict({'delta': 0.1, 'b': 48.23, 'e': 457.73, 'o': 0.0, 'dist': 366.0, 'nvhdr': 6, 'npts': 4096, 'iftype': 1, 'iztype': 11, 'leven': 1, 'kevnm': ''})


In both cases, I used the same script and the same data, I only changed the MTUQ environment. On the other hand, this problem is not seen when I use Specfem3D GFs database. I also noticed that the starttime and endtime are also different despite I used the same origin time in both cases: '2017-12-01T02:32:44.000000Z'

If you can shed some light on what happened wit the .get_synthetics subroutine in the most recent version, I would appreciate it a lot. Without the metadata, it is difficult to figure out to what station corresponds a given synthetic trace.

Thanks for your help,

Felix

@SeismoFelix
Copy link
Member Author

Probably this commit may be helpful for this discussion: 7668898 . Thanks @thurinj

@rmodrak
Copy link
Member

rmodrak commented Jan 16, 2025 via email

@rmodrak
Copy link
Member

rmodrak commented Jan 22, 2025

Hi Felix, You mentioned a specific commit (7668898). Could you double check that you are using this version or a more recent one? I am finding that for such versions, the synthetic traces have the requested metadata

@rmodrak
Copy link
Member

rmodrak commented Jan 22, 2025

For reference, I used the current upstream version (f3d6cc7) and added these two lines to SerialGridSearch.DoubleCouple.py:

    synthetics_sw = greens_sw.get_synthetics(best_mt)
    print(synthetics_sw[0][0].stats)

The resulting standard output is

         network: YV
         station: BIGB
        location: 
         channel: Z
       starttime: 2009-04-07T20:11:15.360003Z
         endtime: 2009-04-07T20:14:05.340003Z
   sampling_rate: 50.0
           delta: 0.02
            npts: 8500
           calib: 1.0
      depth_in_m: None
  elevation_in_m: None
              id: YV.BIGB.
        latitude: 61.5919
       longitude: -149.8174

I also tried adding

    synthetics_sw = greens_sw.get_synthetics(best_mt, components=['Z','R','T'])
    print(synthetics_sw[0][0].stats)

and got the same result.

@rmodrak
Copy link
Member

rmodrak commented Jan 22, 2025

So at least get_synthetics() seems to give the requested metadata in examples/SerialGridSearch.DoubleCouple.py

If the behavior still continues in your case, could you post fuller example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants