Skip to content

Update CSP - #504

Open
awongel wants to merge 7 commits into
PyPSA:masterfrom
awongel:master
Open

Update CSP#504
awongel wants to merge 7 commits into
PyPSA:masterfrom
awongel:master

Conversation

@awongel

@awongel awongel commented Apr 26, 2026

Copy link
Copy Markdown

Changes proposed in this Pull Request

CSP conversion now models the actual collector geometry instead of assuming perfect sun-tracking. Both technologies are computed via SurfaceOrientation with TiltedDirectIrrad = (cosincidence / sin(altitude)) * influx_direct. Solar tower (tracking="dual") yields cosincidence = 1, so its output is unchanged DNI. Parabolic trough now uses tracking="horizontal" (single-axis tracking), so it collects less than DNI when the sun is not aligned with its rotation axis — correcting the previous overestimate. The old atlite/csp.py module (with its hardcoded 3.75° altitude clamp) was removed and folded into convert.py; the public cutout.csp() API is unchanged. Reworked the working-with-csp example to showcase the difference.

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • Newly introduced dependencies are added to environment.yaml, environment_docs.yaml and setup.py (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@fneum fneum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @awongel! Looks great. I have two suggestions / requests:

  1. Could you remove the Saudia Arabia example? The example got quite long and to me it didn't add too many new insights.

  2. Do you have a comparison of the convert_csv() output before and after? That would make it easier to see whether the changes are plausible. Just a graphic + code snippet would be helpful.

Comment thread atlite/gis.py Outdated
dask_gufunc_kwargs=dict(
output_sizes={"yout": dst_shape[0], "xout": dst_shape[1]}
output_sizes={"yout": dst_shape[0], "xout": dst_shape[1]},
allow_rechunk=True,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this change necessary?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fneum!

  1. I had discussed with @euronion what we should add and felt that a second location would be useful to show that it works more generally than in a single location. If you think it's too much, I don't mind removing it again.

  2. Since I replaced the calculation, would you suggest to keep the previous way of calculating it somewhere in the code? I wanted to avoid that. Or save the old result somewhere, but then you can't immediately see how it was calculated.

The change in the gis.py file was needed for the sarah data part of the example, which wouldn't run for me otherwise. Happy to remove if you can confirm this is not needed.

@FabianHofmann

Copy link
Copy Markdown
Contributor

@awongel should I update the code according to @fneum review? I would also argue we should remove the allow_rechunk for now and generalize the exposure of dask kwargs.

# Conflicts:
#	atlite/csp.py
#	atlite/gis.py
#	examples/working-with-csp.ipynb
Drop the second-location (Saudi Arabia) example from the CSP notebook per
review, along with its reference CSV. Revert the allow_rechunk regrid arg.
reproject needs the full spatial plane, so multi-chunk spatial inputs
(e.g. SARAH2) must be merged rather than error.
@FabianHofmann

FabianHofmann commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@awongel took the freedom to merge the latest master and remove the saudi arabia example. we should keep the allow_rechunk in as it is generally needed for sarah cutouts and regrid operations. I have the changes locally but don't want to push on your master unless you say its okay. alternatively I can raise another pr superseding this one

@awongel

awongel commented Jul 18, 2026

Copy link
Copy Markdown
Author

@FabianHofmann, awesome, thanks for picking this up again! Yes, please feel free to push your changes directly to my master.
Absolutely, will follow your judgement on allow_rechunk. (It just felt wrong to push something that wouldn't run for me.)

@FabianHofmann FabianHofmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @awongel for the contribution. I updated the release notes and want to update the pr summary for the record. (would be nice in future to have a summary written by the author)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants