mspass-team / mspass

Massive Parallel Analysis System for Seismologists
https://mspass.org
BSD 3-Clause "New" or "Revised" License
30 stars 12 forks source link

Fix bug in handling starttime and endtime #486

Closed wangyinz closed 8 months ago

wangyinz commented 8 months ago

This is fixing #485 #484

wangyinz commented 8 months ago

I am not sure what to do with the error. The test that failed basically set starttime in exclude_keys. With the new changes, exclude_keys do not work on starttime and endtime. While I don't think people would ever do that, it does complicates things as exclude_keys now has exceptions.

wangyinz commented 8 months ago

Maybe those keys should be added in md2doc? What do you think? @pavlis

pavlis commented 8 months ago

Three attributes in wf documents are special and need to be handled with care. They are: starttime, endtime, and npts. The reason they are so special in MsPASS is that all three must be closely linked with three internal attributes that are part of the C++ class (attributes of the class): npts, dt, and t0. The endtime attribute is more of a sanity check as endtime is a method of BasicTimeSeries that is the superclass of both TimeSeries and Seismogram. If we have tests listing any of these attributes int he exclude list the tests need to be changed.

These cannot be handled in md2doc. The reason is that the "md" in md2doc is for Metadata. The starttime attribute in Metadata can become disconnected with the value of the "t0" attribute in a TimeSeries or Seismogram. I think a problem can happen because one can set t0 with a constuct like d.t0=t or d.set_to(t). The later resets the "starttime" Metadata field but the first does not. For that reason save_data must force starttime. endtime is different because it is always derived, but is worse because i could also be stale when any of t0, npts, or dt change.

codecov[bot] commented 8 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (fd629f1) 53.58% compared to head (0393d02) 53.59%.

Files Patch % Lines
python/mspasspy/db/database.py 92.30% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #486 +/- ## ======================================= Coverage 53.58% 53.59% ======================================= Files 144 144 Lines 22361 22365 +4 ======================================= + Hits 11983 11987 +4 Misses 10378 10378 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.