Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in handling starttime and endtime #486

Merged
merged 8 commits into from
Jan 18, 2024
Merged

Fix bug in handling starttime and endtime #486

merged 8 commits into from
Jan 18, 2024

Conversation

wangyinz
Copy link
Member

This is fixing #485 #484

pavlis and others added 3 commits January 17, 2024 09:40
Previous version was failing to set starttime and endtime on saves.  Also data loaded and cut had incorrect starttime and endtimes saved because they werne't being replaced.
@wangyinz
Copy link
Member Author

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
Copy link
Member Author

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

@pavlis
Copy link
Collaborator

pavlis commented Jan 17, 2024

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.

Copy link

codecov bot commented Jan 18, 2024

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 ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #486   +/-   ##
=======================================
  Coverage   53.58%   53.59%           
=======================================
  Files         144      144           
  Lines       22361    22365    +4     
=======================================
+ Hits        11983    11987    +4     
  Misses      10378    10378           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wangyinz wangyinz merged commit cedfaf0 into master Jan 18, 2024
12 checks passed
@wangyinz wangyinz deleted the add_endtime branch January 18, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants