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

replacing median with 50th percentile #97

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pygac/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ def correct_times_median(self, year, jday, msec):
msec_lineno = self.lineno2msec(self.scans["scan_line_number"])

jday = np.where(np.logical_or(jday < 1, jday > 366),
np.median(jday), jday)
np.percentile(jday, 50, interpolation='nearest'), jday)
if_wrong_jday = np.ediff1d(jday, to_begin=0)
jday = np.where(if_wrong_jday < 0, max(jday), jday)

Expand All @@ -827,7 +827,7 @@ def correct_times_median(self, year, jday, msec):
if if_wrong_msec[0] != 0:
msec = msec[0] + msec_lineno
else:
msec0 = np.median(msec - msec_lineno)
msec0 = np.percentile(msec - msec_lineno, 50, interpolation='nearest')
msec = msec0 + msec_lineno

if_wrong_msec = np.ediff1d(msec, to_begin=0)
Expand All @@ -846,9 +846,9 @@ def correct_times_median(self, year, jday, msec):
msec = msec[0] + msec_lineno
# Otherwise use median time stamp
else:
year = np.median(year)
jday = np.median(jday)
msec0 = np.median(msec - msec_lineno)
year = np.percentile(year, 50, interpolation='nearest')
jday = np.percentile(jday, 50, interpolation='nearest')
msec0 = np.percentile(msec - msec_lineno, 50, interpolation='nearest')
msec = msec0 + msec_lineno

return year, jday, msec
Expand Down