-
Notifications
You must be signed in to change notification settings - Fork 4
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
Consider using shapely 2.0's vectorized geometry operations #44
Comments
Iøm imaging the first step would be to vectorize this part: twoaxistracking/twoaxistracking/shading.py Lines 139 to 147 in 3747a4b
However, I still think that you have to loop to process each timestep individually. Edit: hmm maybe some vectorization can be done... I'm not quite sure tbh |
The Shapely 2.0 documentation states:
From the top-level namespace, there is a
I don't think the Currently, the twoaxistracking code uses the
I posted a question to the Shapely Discussion forum asking more about it: shapely/shapely#1718 |
Making sure I understand the problem: A general thought: since the advantage of using in-library vectorization is that all iterating and computations can take place in C-land instead of python-land, any solution involving a lambda function might not be any faster than what we have now. But the proof will be in the benchmarks of course :) |
Right now
shading.shaded_fraction
is limited to scalar solar position inputs.TrackerField
allows array inputs, but uses a python loop to process each element individually. I assume the decision to limitshading.shaded_fraction
to scalar inputs was at least in part because shapely's geometry operations were not vectorized.However, it seems that one of the changes introduced in shapely 2.0 is that geometry operations are now vectorized and allegedly significantly faster than looping like we currently do (see https://shapely.readthedocs.io/en/stable/release/2.x.html#vectorized-element-wise-geometry-operations). @AdamRJensen if you have some time, it may be worth looking into using this new vectorized functionality.
The text was updated successfully, but these errors were encountered: