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

SPECFEM3D_SAC client support depth gridsearch #237

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

SeismoFelix
Copy link
Contributor

@SeismoFelix SeismoFelix commented Nov 9, 2023

SPECFEM3D_SAC.py client script was changed to support depth grid searches. In the MTUQ current version, when SPECFEM3D format is used, the path to the Green Functions (GFs) leads directly to the SAC files. Therefore, it is not possible to implement a moment tensor estimation, allowing a depth grid search. For instance, when using FK GFs, the path does not lead immediately to the SAC files but a manifold of directories named after the GFs database depth. To be consistent with the FK client, if this pull request is approved, the SPECFEM3D (SAC and SGT) GFs have to be saved in a directory named after the earthquake depth (e.g., /User/SpecfemGFs/6/*.sac if the depth of the earthquake is 6km).

The SPECMFEM3D examples data tgz files were modified (SAC and SGT) to include the earthquake depth in the directory name. For instance: SPECFEM3D_SAC/20090407201255351 would be now SPECFEM3D_SAC/20090407201255351/33

The test_greens_SPECFEM3D_SAC.py and test_greens_SPECFEM3D_SGT.py scripts were modified for setting earthquake depths rounded to the nearest integer. This is for making the creation of the corresponding GFs directory easier (e.g., for a depth of 33033.599853515625, the GFs directory had to end in 33.0335... So, for simplicity, the depth was rounded to 33000)

The setup/code_generator.py script remains unmodified since (so far) it does not write test_greens_SPECFEM3D_SAC.py and test_greens_SPECFEM3D_SGT.py.

With these modifications, the implementation of GridSearch.DoubleCouple+Magnitude+Depth.py for SPECFEM3D GFs is straightforward and was already tested.

I modified the SPECFEM3D clients to support grid searches in depth. So far, the GFs path pointed to the SAC files GFs directly. Now, similarly as the FK client, the GFs path has to point to a directory where there are many subdirectory each of them storing the GFs for a given depth: PATH_GF/evdp/SAC_FILES.

I modified the data directory and the tests scripts to work in agreement to the clients modifications.
Add event depth to EXT_FORCE GFs path.
@rmodrak
Copy link
Member

rmodrak commented Nov 9, 2023

Felix,

Very useful, I think this is a big improvement.

I was thinking of trying the following--

  • Allow either km or m for the subdirectory name, to allow shallow searches
  • Possibly try to implement in a way that is more backward compatible
  • Also I think the docs may need to be updated

Is it alright if I make changes to your fork?

thanks,
Ryan

@SeismoFelix
Copy link
Contributor Author

SeismoFelix commented Nov 9, 2023

Sure! Be my guest. Is enough Clicking in the box 'Allow edits by maintainers' to allow you to work my fork? If so, go ahead, and thanks for the help.

I would like to add that to allow shallow searches, the naming of the subdirectories also had to be adjusted in the FK client that is in km so far.

@rmodrak
Copy link
Member

rmodrak commented Nov 9, 2023

Sounds good, I will go ahead.

@rmodrak
Copy link
Member

rmodrak commented Nov 9, 2023

Agreed, shallow searches can be helpful for underground explosions, implosions, etc. I was thinking choosing between m or km via an optional keyword argument. I believe the newly modified tgz files should continue to work fine.

@rmodrak
Copy link
Member

rmodrak commented Nov 9, 2023

I've tried revising SPECFEM3D_SAC.py. Could you glance at it?

@rmodrak
Copy link
Member

rmodrak commented Nov 9, 2023

I don't understand the proposed changes to SPECFEM3D_SGT.py.

Doesn't the existing name convention already include depth? (see line 118)

@SeismoFelix
Copy link
Contributor Author

SeismoFelix commented Nov 9, 2023

I don't understand the propsed changes to SPECFEM3D_SGT.py.

Doesn't the existing name convention already include depth? (see line 118)

You are right Ryan, sorry. The SGT modifications are unnecessary since the name convention already includes the depth. I put the SGT codes (SPECFEM3D_SGT.py, test_greens_SPECFEM3D_SGT.py, and the SGT GFs directory) in their original form.

The modification proposed to SPECFEM3D_SAC client does not apply to SGT since the latter already includes the depth in the GFs names. So, the proposed modifications to the client and test scripts, and the directory with the GFs were undone.
@SeismoFelix SeismoFelix changed the title SPECFEM3D clients support depth gridsearch SPECFEM3D_SAC client support depth gridsearch Nov 9, 2023
@rmodrak rmodrak self-assigned this Nov 9, 2023
@rmodrak rmodrak self-requested a review November 9, 2023 07:19
@rmodrak
Copy link
Member

rmodrak commented Nov 9, 2023

Sounds great, thanks Felix. Please feel free to merge whenever ready.

@SeismoFelix
Copy link
Contributor Author

Great, Ryan, thanks. I already checked the moment tensor estimations with Specfem3D GFs, allowing depth search, and everything looks fine after your commit. However, I do not see the merge option below the message that there are no conflicts with the base branch. It seems I have no permission for merging.

Screenshot 2023-11-09 at 1 44 17 PM

@thurinj thurinj merged commit c759d16 into uafgeotools:master Nov 9, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants