diff --git a/gwsumm/data/spectral.py b/gwsumm/data/spectral.py index 48c9109b..a5323a3b 100644 --- a/gwsumm/data/spectral.py +++ b/gwsumm/data/spectral.py @@ -239,12 +239,13 @@ def _get_spectrogram(channel, segments, config=None, cache=None, def add_spectrogram(specgram, key=None, coalesce=True): """Add a `Spectrogram` to the global memory cache """ - if key is None: - key = specgram.name or str(specgram.channel) - globalv.SPECTROGRAMS.setdefault(key, SpectrogramList()) - globalv.SPECTROGRAMS[key].append(specgram) - if coalesce: - globalv.SPECTROGRAMS[key].coalesce() + if not numpy.any(numpy.isnan(specgram)): + if key is None: + key = specgram.name or str(specgram.channel) + globalv.SPECTROGRAMS.setdefault(key, SpectrogramList()) + globalv.SPECTROGRAMS[key].append(specgram) + if coalesce: + globalv.SPECTROGRAMS[key].coalesce() @use_segmentlist