SeisComP3 / seiscomp3

SeisComP is a seismological software for data acquisition, processing, distribution and interactive analysis.
Other
111 stars 88 forks source link

Cache issue in scmag #178

Open Brtle opened 6 years ago

Brtle commented 6 years ago

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 commented 6 years ago

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

gempa-jabe commented 6 years ago

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 commented 6 years ago

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.