Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Cache issue in scmag #178

Open
Brtle opened this issue Jun 8, 2018 · 3 comments
Open

Cache issue in scmag #178

Brtle opened this issue Jun 8, 2018 · 3 comments

Comments

@Brtle
Copy link
Contributor

Brtle commented Jun 8, 2018

Some times ago, the removeObject method have been implemented in scamp to allow the removal of amplitude in its cache. Could you implement it for the scmag module as well?

I have the same issue that the scamp module. I have a custom Python script which remove Magnitude, StationMagnitude and StationMagnitudeContribution but I think the cache keep them in memory. It would be great if the magnitudes could be removed!

@gempa-jabe
Copy link
Member

Refers to #152. Yes, that should be done.

@gempa-jabe
Copy link
Member

Hold on a second ... where do you send the messages to? scmag does not listen for MAGNITUDE group and would not get the messages anyway. What do you expect from scmag once it receives the information about removed magnitudes? To recompute them?

@Brtle
Copy link
Contributor Author

Brtle commented Jun 8, 2018

I indeed want to recompute the magnitudes. My script looks like:

ep = DataModel.EventParameters()

DataModel.Notifier.Enable()

if self.remove_magnitudes is not None:
    self._remove_magnitudes(origin)

if self.remove_amplitudes is not None:
    self._remove_amplitudes(ep, origin)

DataModel.Notifier.Create(ep, DataModel.OP_UPDATE, origin)

DataModel.Notifier.Disable()

message = DataModel.Notifier.GetMessage(True)
self.connection().send(message)

The idea is to remove amplitudes and magnitudes and let scamp and scmag recompute the new objects. The message is sent to the LOCATION group.

However, if scamp isn't enable or doesn't calculate a new amplitude, the old cached magnitude will still exist in scmag. I think magnitudes should be removed from the cache in the removeObject method so that the old magnitudes are not reused without amplitudes.

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

No branches or pull requests

2 participants