Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ Upcoming Release
* Implement glofas dataset which contains daily river discharge. ``cutout.hydro()`` now
returns discharge if ``cutout.module`` contains ``"glofas"``.
(https://github.com/PyPSA/atlite/pull/498)
* Rewrite CSP conversion to model the collector geometry. ``convert_csp`` now uses
``SurfaceOrientation`` with tracking (horizontal for parabolic trough, dual-axis for
solar tower) instead of the former ``atlite.csp`` module, which was removed. The
``working-with-csp`` example was updated accordingly.
(https://github.com/PyPSA/atlite/pull/504)
* ``SurfaceOrientation`` now also accepts a plain orientation dict
(``{"slope": ..., "azimuth": ...}``) in addition to a callable.
(https://github.com/PyPSA/atlite/pull/504)
* Meshgrid ``regrid``/reproject now allows dask to rechunk the spatial input, so that
multi-chunk spatial planes are merged before reprojection.
(https://github.com/PyPSA/atlite/pull/504)

**Bug fixes**

Expand Down
6 changes: 6 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ path = "doc/examples/**.nblink"
precedence = "aggregate"
SPDX-FileCopyrightText = "Contributors to atlite <https://github.com/pypsa/atlite>"
SPDX-License-Identifier = "CC-BY-4.0"

[[annotations]]
path = "examples/profiles_and_efficiencies_from_sam/**.csv"
precedence = "aggregate"
SPDX-FileCopyrightText = "Contributors to atlite <https://github.com/pypsa/atlite>"
SPDX-License-Identifier = "CC-BY-4.0"
24 changes: 20 additions & 4 deletions atlite/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
from numpy import pi
from scipy.sparse import csr_matrix

from atlite import csp as cspm
from atlite import hydro as hydrom
from atlite import wind as windm
from atlite.aggregate import aggregate_matrix
from atlite.gis import spdiag
from atlite.pv.irradiation import TiltedIrradiation
from atlite.pv.irradiation import TiltedDirectIrrad, TiltedIrradiation
from atlite.pv.orientation import SurfaceOrientation, get_orientation
from atlite.pv.solar_panel_model import SolarPanelModel
from atlite.pv.solar_position import SolarPosition
Expand Down Expand Up @@ -1389,12 +1388,29 @@ def convert_csp(ds, installation):
If the CSP technology option is not recognized.
"""
solar_position = SolarPosition(ds)
direct = ds["influx_direct"]

tech = installation["technology"]
if tech == "parabolic trough":
irradiation = ds["influx_direct"]
surface_orientation_trough = SurfaceOrientation(
ds,
solar_position,
orientation={"slope": 0.0, "azimuth": 0.0},
tracking="horizontal",
)
irradiation = TiltedDirectIrrad(
solar_position, surface_orientation_trough, direct
)
elif tech == "solar tower":
irradiation = cspm.calculate_dni(ds, solar_position)
surface_orientation_tower = SurfaceOrientation(
ds,
solar_position,
orientation={"slope": 0.0, "azimuth": 0.0},
tracking="dual",
)
irradiation = TiltedDirectIrrad(
solar_position, surface_orientation_tower, direct
)
else:
raise ValueError(f'Unknown CSP technology option "{tech}".')

Expand Down
73 changes: 0 additions & 73 deletions atlite/csp.py

This file was deleted.

5 changes: 4 additions & 1 deletion atlite/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,10 @@ def _reproject(src: NDArray, **kwargs: Any) -> NDArray:
output_core_dims=[["yout", "xout"]],
output_dtypes=[dtypes.pop()],
dask_gufunc_kwargs={
"output_sizes": {"yout": dst_shape[0], "xout": dst_shape[1]}
"output_sizes": {"yout": dst_shape[0], "xout": dst_shape[1]},
# reproject needs the full spatial plane, so core dims must be a
# single chunk; allow dask to merge multi-chunk spatial inputs.
"allow_rechunk": True,
},
dask="parallelized",
kwargs=kwargs,
Expand Down
5 changes: 4 additions & 1 deletion atlite/pv/orientation.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ def SurfaceOrientation(
solar_position: xr.Dataset,
orientation: Callable[
[xr.DataArray, xr.DataArray, xr.Dataset], dict[str, xr.DataArray]
],
]
| dict[str, Any],
tracking: TrackingType | None = None,
) -> xr.Dataset:
"""
Expand Down Expand Up @@ -254,6 +255,8 @@ def SurfaceOrientation(
"""
lon = radians(ds["lon"])
lat = radians(ds["lat"])
if not callable(orientation):
orientation = get_orientation(orientation)

orientation_dict = orientation(lon, lat, solar_position)
surface_slope = orientation_dict["slope"]
Expand Down
Loading