Skip to content

Re-added CPS_metadata handling with cleaner implementation.#347

Open
thurinj wants to merge 2 commits into
masterfrom
Restore_CPS_ProcessData
Open

Re-added CPS_metadata handling with cleaner implementation.#347
thurinj wants to merge 2 commits into
masterfrom
Restore_CPS_ProcessData

Conversation

@thurinj

@thurinj thurinj commented May 20, 2026

Copy link
Copy Markdown
Member

This commit re-integrates the CPS-based ProcessData handling of Green's functions. It mimic the FK implementation, and try to handle gracefully possible confusion with database and model paths.

I have adopted conventions for CPS metadata based on HiBasin examples (P and S arrival in sac.a and sac.t0 fields). As stated in issue #336, not sure if this is universally accepted, but it is working with @Jinyin-Hu HiBasin examples.

I decided to also have the CPS_model argument (as in FK), just in case people might have several models in the same Database folder. Could remove if not likely given default CPS outputs style.

Also fix a misleading docstrings in CPS.py

Should address some of the issues encountered in #336

Warning

as of May 20th 2026, the CPS GF Databases in the HiBasin repo are currently in displacement unit (m) and NOT in m/s, as expected by the default MTUQ readers.
Will remove when @Jinyin-Hu updates HiBasin

This commit re-integrates the CPS-based ProcessData handling of Green's functions.
It mimic the FK implementation, and try to handle gracefully possible confusion with database and model paths.

I have adopted conventions for CPS metadata based on HiBasin examples (P and S arrival in sac.a and sac.t0 fields). As stated in issue #336, not sure if this is universally accepted, but it is working with @Jinyin-Hu HiBasin examples.

I decided to also have the CPS_model argument (as in FK), just in case people might have several models in the same Database folder. Could remove if not likely given default CPS outputs style.

Also fix a misleading docstrings in `CPS.py`
@thurinj thurinj requested a review from rmodrak May 20, 2026 02:53
Forgot to remove the NotImplemented error.
@rmodrak

rmodrak commented May 20, 2026

Copy link
Copy Markdown
Member

Agreed it is good to follow FK implementation.

In fact, would it be possible to follow the FK implementation even more closely? Perhaps importing and using the following two utility functions might help clean things up?

depth_km = _closest_depth(self.path, np.ceil(origin.depth_in_m/1000.))

offset_km = _closest_offset(self.path, depth_km, distance_in_m/1000.)

@Jinyin-Hu Jinyin-Hu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think the changes make sense to me.

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