PyPSA / PyPSA/atlite

CSP has capacity factors > 1 when passing shapes

Open
#362 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted priority: medium type: bug type: info
Dominant language
Python
Stars
402
Forks
134
PR merge metrics
No merged PRs in 30d

Description

Version Checks (indicate both or one)
  • I have confirmed this bug exists on the lastest release of Atlite.

  • I have confirmed this bug exists on the current master branch of Atlite.

Issue Description

Depending on how you call csp capacity factors might be wrong

per_unit = True works as intended

image

capacity_factor=True has issues.

image

Reproducible Example
import geopandas as gpd
import atlite
import cartopy.io.shapereader as shpreader
import pandas as pd

shp = shpreader.Reader(
    shpreader.natural_earth(
        resolution="10m", category="cultural", name="admin_1_states_provinces"
    )
)
prt_records = list(
    filter(lambda r: r.attributes["iso_3166_2"].startswith("PT"), shp.records())
)
portugal_1 = (
    gpd.GeoDataFrame([{**r.attributes, "geometry": r.geometry} for r in prt_records])
    .rename(columns={"iso_3166_2": "state"})
    .set_index("state")
    .set_crs(4236)
)
portugal_1 = portugal_1.cx[portugal.bounds.minx:,:]
portugal_1.plot()

cutout = atlite.Cutout(
    path="csp-cf-series/test/cutout_csp.nc",  # previous file I had, from the Portugal example
)

csp = cutout.csp(  # I work!
    installation="SAM_solar_tower",
    per_unit=True,
    shapes=portugal_1
)
mean = csp.mean("time").to_series()
portugal_1.plot(column=mean, legend=True)

csp = cutout.csp(  # I don't :(
    installation="SAM_solar_tower",
    capacity_factor=True,
    shapes=portugal_1
)
mean = csp.mean("time").to_series()
portugal_1.plot(column=mean, legend=True)
Expected Behavior

CFs should be correct regardless of how you call for them (although... why are there two calls for the same thing? That's how this type of issue happens...)

Installed Versions

atlite = 0.2.13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Cutout.csp entry point and reproduce the Portugal example with installation="SAM_solar_tower", first using per_unit=True and then capacity_factor=True with the provided shapes. Trace why the capacity-factor result differs, and consider the issue resolved when both calls produce correct, consistent capacity factors without values above 1.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.