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

Create instrument swath outlines as shapefiles #93

Open
wants to merge 39 commits into
base: main
Choose a base branch
from

Conversation

adybbroe
Copy link
Contributor

@adybbroe adybbroe commented Nov 19, 2024

This PR adds a script to create Satellite instrument swath outlines in shapefile format, e.g. for use in an WMS/WFS service.

Also some re-factoring has been done in this PR.

@adybbroe adybbroe self-assigned this Nov 19, 2024
@adybbroe
Copy link
Contributor Author

Here an example of how the script can be run:
create_shapefiles_from_schedule -s NOAA-21 NOAA-20 -t ./tle-202409060015.txt -x ./2024-09-06-00-45-08-acquisition-schedule-confirmation-nrk.xml -o /data/pass_outlines

@TAlonglong
Copy link
Collaborator

Could you add something like that example you gave to the docs?

Adam.Dybbroe added 3 commits November 20, 2024 16:25
Signed-off-by: Adam.Dybbroe <[email protected]>
Signed-off-by: Adam.Dybbroe <[email protected]>
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 81.38528% with 43 lines in your changes missing coverage. Please review.

Project coverage is 60.49%. Comparing base (fccd0a5) to head (086d579).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
trollsched/combine.py 11.11% 16 Missing ⚠️
trollsched/drawing.py 0.00% 13 Missing ⚠️
trollsched/shapefiles_from_schedule.py 89.39% 7 Missing ⚠️
trollsched/logger.py 77.77% 4 Missing ⚠️
trollsched/utils.py 81.81% 2 Missing ⚠️
trollsched/helper_functions.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #93      +/-   ##
==========================================
+ Coverage   55.71%   60.49%   +4.77%     
==========================================
  Files          14       18       +4     
  Lines        2107     2278     +171     
==========================================
+ Hits         1174     1378     +204     
+ Misses        933      900      -33     

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

Adam.Dybbroe added 2 commits November 22, 2024 13:46
Signed-off-by: Adam.Dybbroe <[email protected]>
@adybbroe
Copy link
Contributor Author

Could you add something like that example you gave to the docs?

Good point, absolutely. I have added a bare minimum at least.

@adybbroe
Copy link
Contributor Author

Here just showing an example of a QGIS display of one shapefile produced by the script above:

Screenshot from 2024-11-22 12-55-39

@adybbroe adybbroe marked this pull request as ready for review November 22, 2024 15:46
Signed-off-by: Adam.Dybbroe <[email protected]>
@adybbroe adybbroe closed this Nov 25, 2024
@adybbroe
Copy link
Contributor Author

Test closing, then opening, to trigger RTD pages build on PRs

@adybbroe adybbroe reopened this Nov 25, 2024
@adybbroe
Copy link
Contributor Author

@TAlonglong @pnuu @mraspaud
Any opinion or can I merge it?

Copy link
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

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

Some suggestions and requests inline.

trollsched/pass_scheduling_utils.py Outdated Show resolved Hide resolved
trollsched/pass_scheduling_utils.py Outdated Show resolved Hide resolved
trollsched/satpass.py Outdated Show resolved Hide resolved
trollsched/shapefiles_from_schedule.py Outdated Show resolved Hide resolved
trollsched/shapefiles_from_schedule.py Show resolved Hide resolved
trollsched/shapefiles_from_schedule.py Outdated Show resolved Hide resolved
trollsched/shapefiles_from_schedule.py Outdated Show resolved Hide resolved
adybbroe and others added 5 commits December 2, 2024 20:45
Co-authored-by: Panu Lahtinen <[email protected]>
Signed-off-by: Adam.Dybbroe <[email protected]>
Signed-off-by: Adam.Dybbroe <[email protected]>
Signed-off-by: Adam.Dybbroe <[email protected]>
@adybbroe adybbroe requested a review from pnuu December 3, 2024 08:40
trollsched/pass_scheduling_utils.py Outdated Show resolved Hide resolved
trollsched/shapefiles_from_schedule.py Outdated Show resolved Hide resolved
@adybbroe
Copy link
Contributor Author

adybbroe commented Dec 3, 2024

I think I should have actually removed the main block in shapefiles_from_schedule.py do you agree @pnuu ?

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.

Wow, thanks a lot for the huge work in cleaning this package up! Looks good in general, but I have a few comments and suggestions/requests inline

.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.stickler.yml Outdated Show resolved Hide resolved
docs/usage.rst Outdated Show resolved Hide resolved
.bumpversion.cfg Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
trollsched/graph.py Outdated Show resolved Hide resolved
trollsched/logger.py Outdated Show resolved Hide resolved
trollsched/schedule.py Outdated Show resolved Hide resolved
Comment on lines 89 to 101
continue

if platform_name not in satellites:
continue
try:
overpass = create_pass(platform_name, instrument,
datetime.strptime(child.attrib["start-time"],
"%Y-%m-%d-%H:%M:%S"),
datetime.strptime(child.attrib["end-time"],
"%Y-%m-%d-%H:%M:%S"),
tle_filename=tle_file)
except KeyError:
continue
Copy link
Member

Choose a reason for hiding this comment

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

imo these continues should be replaced by log messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not all of them!? Not "replaced"? I don't want to try create a pass if the instrument is None or the platform-name not requested...
How do you mean?

Copy link
Member

Choose a reason for hiding this comment

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

I mean that if one of these continues is reached, something is not going as planned, right? so shouldn’t we log about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this is fixed now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we need to figure out if the the KeyError part can be tested and when/why that actually might happen?

trollsched/tests/test_pass_outlines.py Outdated Show resolved Hide resolved
@adybbroe adybbroe requested review from pnuu and mraspaud December 4, 2024 21:50
- sphinx_rtd_theme
- sphinxcontrib-apidoc
- trollsift
- xarray
Copy link
Member

Choose a reason for hiding this comment

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

do we need xarray here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Should be possible to store swath outlines as shapefiles
4 participants