Skip to content

Commit

Permalink
Bugfix and minor clean up
Browse files Browse the repository at this point in the history
Signed-off-by: Adam.Dybbroe <[email protected]>
  • Loading branch information
Adam.Dybbroe committed Nov 25, 2024
1 parent 4243e57 commit 2b1e276
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
10 changes: 6 additions & 4 deletions trollsched/helper_functions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2018 Adam.Dybbroe
# Copyright (c) 2018, 2024 Adam.Dybbroe

# Author(s):

Expand All @@ -20,9 +20,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Helper functions for the pytroll-schedule methods. E.g. nightshade method
for Cartopy as available in Basemap.
"""Helper functions for the pytroll-schedule methods.
E.g. nightshade method for Cartopy as available in Basemap.
"""

from datetime import datetime
Expand All @@ -31,7 +31,9 @@


def sun_pos(dt=None):
"""This function computes a rough estimate of the coordinates for
"""Get location on earth where the sun is in zenith at time *dt*.
This function computes a rough estimate of the coordinates for
the point on the surface of the Earth where the Sun is directly
overhead at the time dt. Precision is down to a few degrees. This
means that the equinoxes (when the sign of the latitude changes)
Expand Down
10 changes: 2 additions & 8 deletions trollsched/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,21 +415,15 @@ def get_best_sched(overpasses, area_of_interest, delay, avoid_list=None):
graph = Graph(n_vertices=n_vertices + 2)

def add_arc(graph, p1, p2, hook=None):
logger.debug("Adding arc between " + str(p1) +
" and " + str(p2) + "...")
logger.debug("Adding arc between %s and %s...", str(p1), str(p2))
if p1 in avoid_list or p2 in avoid_list:
w = 0
logger.debug("...0 because in the avoid_list!")
else:
w = combine(p1, p2, area_of_interest)
logger.debug("...with weight " + str(w))

# with open("/tmp/schedule.gv", "a") as fp_:
# fp_.write(' "' + str(p1) + '" -> "' + str(p2) +
# '" [ label = "' + str(w) + '" ];\n')

graph.add_arc(passes.index(p1) + 1,
passes.index(p2) + 1, w)
graph.add_arc(passes.index(p1) + 1, passes.index(p2) + 1, w)
if hook is not None:
hook()

Expand Down
2 changes: 1 addition & 1 deletion trollsched/shapefiles_from_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def shapefiles_from_schedule_xml_requests(filename, satellites, tle_file, output
except KeyError:
continue

Check warning on line 99 in trollsched/shapefiles_from_schedule.py

View check run for this annotation

Codecov / codecov/patch

trollsched/shapefiles_from_schedule.py#L98-L99

Added lines #L98 - L99 were not covered by tests

output_filepath = Path(outpath) / create_shapefile_filename(overpass)
output_filepath = Path(output_dir) / create_shapefile_filename(overpass)
create_shapefile_from_pass(overpass, output_filepath)

Check warning on line 102 in trollsched/shapefiles_from_schedule.py

View check run for this annotation

Codecov / codecov/patch

trollsched/shapefiles_from_schedule.py#L101-L102

Added lines #L101 - L102 were not covered by tests


Expand Down

0 comments on commit 2b1e276

Please sign in to comment.