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

Issue 395 - Adds support for reading the sources as a yaml-node #403

Open
wants to merge 4 commits into
base: issue-394-src-rcv-python
Choose a base branch
from

Conversation

lsawade
Copy link
Collaborator

@lsawade lsawade commented Jan 15, 2025

Description

The current framework of defining the source-file makes it difficult to read the specfem_config.yaml. This dislodges the current setup of reading databases and sources together. By creating a setup.sources entity and setup.get_sources which returns a YAML::Node.

If the source-file is defined setup.sources will be populated with a YAML::Node that is loaded from source-file. If source-dict is defined setup.sources is populated directly with the source-dict YAML::Node.

This allows for defining the sources in Python as part of the runtime_config dictionary.

See here for a very barebone implementation of a simulation in Python with bathymetry: Example

For now I'm not adding documentation because I do not think we want the CPP user to use the code like this.

Also, a general overhaul of the setup structure may be necessary. To not break anything setup.get_databases() still returns a tuple, but source_database is an empty string of the database_configuration was instantiated with using source-dict.

Issue Number

Closes #395

Checklist

Please make sure to check developer documentation on specfem docs.

  • I ran the code through pre-commit to check style
  • My code passes all the integration tests
  • I have added sufficient unittests to test my changes
  • I have added/updated documentation for the changes I am proposing
  • I have updated CMakeLists to ensure my code builds
  • My code builds across all platforms

@lsawade lsawade changed the base branch from main to issue-394-src-rcv-python January 15, 2025 21:35
@lsawade lsawade requested a review from icui January 15, 2025 21:35
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.

overload read_sources() to read yaml node if it is yaml node and file if it is a file
2 participants