Skip to content

Solar position issues with pandas 3.0 #2667

@kandersolar

Description

@kandersolar

Looks like some of our solar position test code is not compatible with pandas 3.0. The latest test runs are failing with errors like this:

 [0]: 1546300.8 (ACTUAL), 1546300800.0 (DESIRED)

and

Attribute "dtype" are different
[left]:  datetime64[us, UTC]
[right]: datetime64[ns, UTC]

See https://github.com/pvlib/pvlib-python/actions/runs/21360074013/job/61476823375#step:9:622

Full errors:

FAILED tests/test_solarposition.py::test_sun_rise_set_transit_spa[65.0] - AssertionError: Attributes of DataFrame.iloc[:, 0] (column name="sunrise") are different

Attribute "dtype" are different
[left]:  datetime64[us, UTC]
[right]: datetime64[ns, UTC]
FAILED tests/test_solarposition.py::test_sun_rise_set_transit_spa[None] - AssertionError: Attributes of DataFrame.iloc[:, 0] (column name="sunrise") are different

Attribute "dtype" are different
[left]:  datetime64[us, UTC]
[right]: datetime64[ns, UTC]
FAILED tests/test_solarposition.py::test_sun_rise_set_transit_spa[delta_t2] - AssertionError: Attributes of DataFrame.iloc[:, 0] (column name="sunrise") are different

Attribute "dtype" are different
[left]:  datetime64[us, UTC]
[right]: datetime64[ns, UTC]
FAILED tests/test_solarposition.py::test_hour_angle_with_tricky_timezones - ValueError: 2014-09-07 00:00:00 is a nonexistent time due to daylight savings time. Try using the 'nonexistent' argument.
FAILED tests/test_solarposition.py::test__datetime_to_unixtime[None] - AssertionError: 
Arrays are not equal

Mismatched elements: 3 / 3 (100%)
Mismatch at indices:
 [0]: 1546300.8 (ACTUAL), 1546300800.0 (DESIRED)
 [1]: 1546304.4 (ACTUAL), 1546304400.0 (DESIRED)
 [2]: 1546308.0 (ACTUAL), 1546308000.0 (DESIRED)
Max absolute difference among violations: 1.54476169e+09
Max relative difference among violations: 0.999
 ACTUAL: array([1546300.8, 1546304.4, 1546308. ])
 DESIRED: array([1.546301e+09, 1.546304e+09, 1.546308e+09])
FAILED tests/test_solarposition.py::test__datetime_to_unixtime[utc] - AssertionError: 
Arrays are not equal

Mismatched elements: 3 / 3 (100%)
Mismatch at indices:
 [0]: 1546300.8 (ACTUAL), 1546300800.0 (DESIRED)
 [1]: 1546304.4 (ACTUAL), 1546304400.0 (DESIRED)
 [2]: 1546308.0 (ACTUAL), 1546308000.0 (DESIRED)
Max absolute difference among violations: 1.54476169e+09
Max relative difference among violations: 0.999
 ACTUAL: array([1546300.8, 1546304.4, 1546308. ])
 DESIRED: array([1.546301e+09, 1.546304e+09, 1.546308e+09])
FAILED tests/test_solarposition.py::test__datetime_to_unixtime[US/Eastern] - AssertionError: 
Arrays are not equal

Mismatched elements: 3 / 3 (100%)
Mismatch at indices:
 [0]: 1546318.8 (ACTUAL), 1546318800.0 (DESIRED)
 [1]: 1546322.4 (ACTUAL), 1546322400.0 (DESIRED)
 [2]: 1546326.0 (ACTUAL), 1546326000.0 (DESIRED)
Max absolute difference among violations: 1.54477967e+09
Max relative difference among violations: 0.999
 ACTUAL: array([1546318.8, 1546322.4, 1546326. ])
 DESIRED: array([1.546319e+09, 1.546322e+09, 1.546326e+09])
FAILED tests/test_spa.py::NumpySpaTest::test_earthsun_distance - AssertionError: 
Arrays are not almost equal to 6 decimals

Mismatched elements: 1 / 1 (100%)
Mismatch at index:
 [0]: 0.9965422974 (ACTUAL), 0.9835734969386114 (DESIRED)
Max absolute difference among violations: 0.0129688
Max relative difference among violations: 0.01318539
 ACTUAL: array(0.996542)
 DESIRED: array([0.983573])
FAILED tests/test_spa.py::NumpySpaTest::test_julian_day - AssertionError: 
Arrays are not almost equal to 6 decimals
 ACTUAL: 2452930.312847
 DESIRED: np.float64(2440599.8428128473)
FAILED tests/test_spa.py::NumpySpaTest::test_solar_position - AssertionError: 
Arrays are not almost equal to 5 decimals

Mismatched elements: 5 / 5 (100%)
Mismatch at indices:
 [0, 0]: 50.11162 (ACTUAL), 157.20807888003478 (DESIRED)
 [1, 0]: 50.127954 (ACTUAL), 157.20807888003478 (DESIRED)
 [2, 0]: 39.888378 (ACTUAL), -67.20807888003478 (DESIRED)
 [3, 0]: 39.872046 (ACTUAL), -67.20807888003478 (DESIRED)
 [4, 0]: 194.340241 (ACTUAL), 41.685007228628365 (DESIRED)
Max absolute difference among violations: 152.65523377
Max relative difference among violations: 3.66211365
 ACTUAL: array([[ 50.11162],
       [ 50.12795],
       [ 39.88838],...
 DESIRED: array([[157.20808],
       [157.20808],
       [-67.20808],...
FAILED tests/test_spa.py::NumpySpaTest::test_transit_sunrise_sunset - ValueError: Input dates must be at 00:00 UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions