Skip to content

get_sunlight_coverage never completes at 2023-05-10 02:00 #182

@gerritholl

Description

@gerritholl

Describe the bug

When checking the sunlight coverage for a certain area with a certain area extent, get_sunlight_coverage never completes.

This stopped our operational production at 2023-05-10 02:00 UTC.

To Reproduce

(needs pytroll-schedule or it will fail differently)

import trollflow2.plugins
import datetime
import pyresample
ar = pyresample.create_area_def("test", 4326, area_extent=[-34.91577, 27.5636854, 54.8726391, 72.45789], shape=(1250, 2500))
trollflow2.plugins._get_sunlight_coverage(ar, datetime.datetime(2023, 5, 10, 2, 0))

Expected behavior

I expect _get_sunlight_coverage to complete.

Actual results

No output, but a KeyboardInterrupt reveals:

^CTraceback (most recent call last):
  File "/data/gholl/checkouts/protocode/mwe/trollflow2-area-issue.py", line 7, in <module>
    trollflow2.plugins._get_sunlight_coverage(ar, datetime.datetime(2023, 5, 10, 2, 0))
  File "/data/gholl/mambaforge/envs/py311/lib/python3.11/site-packages/trollflow2/plugins/__init__.py", line 703, in _get_sunlight_coverage
    daylight = cut_area_poly.intersection(poly)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/gholl/checkouts/pyresample/pyresample/spherical.py", line 713, in intersection
    return self._bool_oper(other, -1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/gholl/checkouts/pyresample/pyresample/spherical.py", line 691, in _bool_oper
    inter, edge2 = edge1.get_next_intersection(narcs2, inter)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/gholl/checkouts/pyresample/pyresample/spherical.py", line 496, in get_next_intersection
    inter = self.intersection(arc)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/gholl/checkouts/pyresample/pyresample/spherical.py", line 476, in intersection
    for i in self.intersections(other_arc):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/gholl/checkouts/pyresample/pyresample/spherical.py", line 457, in intersections
    return (SCoordinate(lon, lat),
            ^^^^^^^^^^^^^^^^^^^^^
  File "/data/gholl/checkouts/pyresample/pyresample/spherical.py", line 131, in __init__
    lon, lat = _check_lon_lat(lon, lat)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/gholl/checkouts/pyresample/pyresample/spherical.py", line 119, in _check_lon_lat
    _check_lat_validity(lat)
  File "/data/gholl/checkouts/pyresample/pyresample/spherical.py", line 110, in _check_lat_validity
    if np.any(np.logical_or(lat > np.pi / 2, lat < -np.pi / 2)):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<__array_function__ internals>", line 200, in any
  File "/data/gholl/mambaforge/envs/py311/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 2333, in any
    @array_function_dispatch(_any_dispatcher)

KeyboardInterrupt

Environment Info:

  • OS: openSUSE 15.3
  • Trollflow2 Version: 0.14.0
  • Satpy Version: 0.40.1
  • Pyresample Version: 1.24.0

Additional context

This particular combination of polygons triggers pytroll/pyresample#329, but I don't know why only then.

If I change the datetime to one second later or earlier, the problem does not occur.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions