-
Notifications
You must be signed in to change notification settings - Fork 27
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 clock drift rounding error #82
Closed
carloshorn
wants to merge
2
commits into
pytroll:master
from
carloshorn:fix_clock_drift_rounding_error
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove
min_idx
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because this leads to the index error. The
max
argument compares line numbers and is therefore in the line number domain. the- min_idx
is the transformation to thecomplete_lons
array index domain. In the case of the crashing orbits, we had exactly the situation, where the right side wins the max comparison.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better variable names could help to avoid this confusion. Something like
min_line, max_line
,line_range = max_line - min_line
. Then we can use index oridx
for the indices ofcomplete_lons, complete_lats
which are numbers in0:line_range+1
, where the interesting ones areself.scans["scan_line_number"] - min_line
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From reading again the code, I see, that the right hand side should win the max comparison whenever the clock drift is positive, because the array
line_indices
results frompygac/pygac/pod_reader.py
Lines 438 to 444 in 5c59f2b
where offsets is a floating point number in seconds. The multiplication with
-2
to convert the time offset into a line number offset is not well documented, but we know that the sign of the offset determines who wins the max comparison. I think the reason why it sill worked in most of the cases is the+2
in the following line:pygac/pygac/pod_reader.py
Line 453 in 5c59f2b
the line I tested that crashed had an
int_offset
of-3
, which in combination with the unexplained+2
appeared suspicious to me. Since the max index has already the+1
, the range of valid indices should not require any+2
. My first guess was that the+2
is required for the later interpolation, but slerp is linear and therefore only requires the next neighbours.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, I assume that it also requires this change to cover all possible indexes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And without understanding the transformation, but arguing with symmetry, I would assume that
pygac/pygac/pod_reader.py
Line 440 in 5c59f2b
should be changed to
to cover the right index range, but here I am not yet 100% sure.