def test_coords_ground_shadows(): """Check coords of timeseries ground shadows""" # Create base params params = { 'axis_azimuth': 0, 'n_pvrows': 2, 'pvrow_height': 2.5, 'pvrow_width': 2., 'gcr': 0.4, 'cut': { 0: { 'front': 5 }, 1: { 'back': 3 } } } # Timeseries parameters for testing solar_zenith = np.array([20., 45.]) solar_azimuth = np.array([70., 200.]) surface_tilt = np.array([10., 70.]) surface_azimuth = np.array([90., 270.]) # Plot simple ordered pv array ordered_pvarray = OrderedPVArray(**params) ordered_pvarray.fit(solar_zenith, solar_azimuth, surface_tilt, surface_azimuth) expected_gnd_shadow_coords = [[([-1.89924929, 0.19163641], [0., 0.]), ([0.18914857, 1.51846431], [0., 0.])], [([3.10075071, 5.19163641], [0., 0.]), ([5.18914857, 6.51846431], [0., 0.])]] gnd_shadow_coords = [ shadow.coords.as_array for shadow in ordered_pvarray.ts_ground.shadow_elements ] np.testing.assert_almost_equal(expected_gnd_shadow_coords, gnd_shadow_coords)
def test_coords_cut_points(): """Test timeseries coords of cut points""" # Create base params params = { 'axis_azimuth': 0, 'n_pvrows': 2, 'pvrow_height': 2.5, 'pvrow_width': 2., 'gcr': 0.4, 'cut': { 0: { 'front': 5 }, 1: { 'back': 3 } } } # Timeseries parameters for testing solar_zenith = np.array([20., 45.]) solar_azimuth = np.array([70., 200.]) surface_tilt = np.array([10., 70.]) surface_azimuth = np.array([90., 270.]) # Plot simple ordered pv array ordered_pvarray = OrderedPVArray(**params) ordered_pvarray.fit(solar_zenith, solar_azimuth, surface_tilt, surface_azimuth) expected_cut_point_coords = [[[14.17820455, -0.90992559], [0., 0.]], [[19.17820455, 4.09007441], [0., 0.]]] cut_pt_coords = [ cut_point.as_array for cut_point in ordered_pvarray.ts_ground.cut_point_coords ] np.testing.assert_almost_equal(expected_cut_point_coords, cut_pt_coords)