Skip to content

WaveBank duplicates entries in index if file mtime is updated #268

Description

@shawnboltz

Description
This is a pretty low priority, but it I can see it having some obscure effects on, ex., identifying gaps/availability in a bank.

When a waveform file gets updated (in this specific case, everything about the files were identical, just the modified time changed), a duplicate entry gets put into the WaveBank.

To Reproduce
I admittedly haven't deliberately reproduced this, but I'm fairly certain this is what happened:

  1. A bank got created for a directory of files
import obsplus
bank = obsplus.WaveBank("path/to/bank")
bank.update_index()

df = bank.read_index(station="sta1", channel="ELZ", location="02")
assert df.duplicated().any() == False
  1. A set of files got copied into the bank, some of which were files that already in the bank (and the originals were overwritten)
  2. The index was updated and duplicated entries got created
bank.update_index()

df = bank.read_index(station="sta1", channel="ELZ", location="02")
assert df.duplicated.any() == True

Expected behavior
The duplicate entries shouldn't get created if all else is equal about the files. (This raises a bigger issue about what happens if the file's contents change substantially, but that's a problem for another day.)

I'm not entirely sure if this would work with the structure of update_index, but simply dropping duplicates should resolve the issue.

Versions (please complete the following information):

  • OS: Ubuntu 22.04
  • ObsPlus Version: 0.2.3.dev10+g8e231f4
  • Python Version: 3.8.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwaveformsanything having to do with waveforms

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions