Skip to content

Conversation

@pnuu
Copy link
Member

@pnuu pnuu commented Oct 1, 2025

Fixes #74 with a fallback to downloading TLEs from internet.

@pnuu pnuu self-assigned this Oct 1, 2025
@codecov
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 97.36842% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.78%. Comparing base (0a7ede2) to head (c9e2909).
⚠️ Report is 66 commits behind head on main.

Files with missing lines Patch % Lines
pyorbital/tlefile.py 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
+ Coverage   89.58%   89.78%   +0.19%     
==========================================
  Files          17       17              
  Lines        2784     2809      +25     
==========================================
+ Hits         2494     2522      +28     
+ Misses        290      287       -3     
Flag Coverage Δ
unittests 89.78% <97.36%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines 320 to 335
LOGGER.debug("Fetch TLE from the internet.")
uris = TLE_URLS
open_func = urlopen
LOGGER.warning("TLES environment variable points to no TLE files")
uris, open_func = _get_internet_uris_and_open_method()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this change. What does this do? Reduce the number of lines by 1? Oh it adds a warning along with the debug log message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First the code needed to be refactored so that the "get TLEs from internet" case were a function. Then I added the warning when TLES env variable is given and didn't provide any files and the fallback of getting the data from internet is used.

@djhoese
Copy link
Member

djhoese commented Oct 1, 2025

Thanks for getting this implemented so quickly.

My biggest worry with this, not fully understanding how users use this, is that someone (me) may want to turn this off, or may want to do the download manually, or may want to run this on a system that can't access the internet so this would fail anyway. Oh or they may be upset that a ton of files got downloaded when they were just testing things. Pyspectral does something similar within its configuration file.

@pnuu
Copy link
Member Author

pnuu commented Oct 1, 2025

Thanks for getting this implemented so quickly.

Took only 4.5 years 😅

My biggest worry with this, not fully understanding how users use this, is that someone (me) may want to turn this off, or may want to do the download manually, or may want to run this on a system that can't access the internet so this would fail anyway. Oh or they may be upset that a ton of files got downloaded when they were just testing things. Pyspectral does something similar within its configuration file.

The other option would be to fail immediately if TLES didn't provide any data. I took the fallback route as the fallback method was in the next code branch.

There are only 9 text files that are downloaded. And as far as I can tell, the previously downloaded data are overwritten, so not much are accumulated.

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good enough to me from the little experience I have with it. I assume if someone is customizing the "TLES" environment variable then they know that things might be downloaded. Should this be documented somewhere more public?

Oh one downside to this would be someone having a typo in their TLES glob pattern and then they get multiple copies but maybe that's OK.

@pnuu
Copy link
Member Author

pnuu commented Oct 1, 2025

The idea of TLES env variable is that the user already has the TLE data locally and they want to use them. So maybe the fallback should be removed and a meaningful exception is raised? @gerritholl ?

@coveralls
Copy link

coveralls commented Oct 3, 2025

Coverage Status

coverage: 89.742% (+0.2%) from 89.583%
when pulling c9e2909 on pnuu:fallback_empty_tles_env
into 67edf1c on pytroll:main.

Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one comment.

Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mraspaud mraspaud merged commit 960a124 into pytroll:main Oct 3, 2025
16 checks passed
@pnuu pnuu deleted the fallback_empty_tles_env branch October 3, 2025 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ValueError in case of empty or missing TLE files

5 participants