PyPSA / PyPSA/atlite

Time misalignment between ERA5 and SARAH?

Open
#355 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: medium status: help wanted type: bug
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

Hi,

I think there may be a time misalignment in the current implementation when working with instantaneous (satellite) data. As correctly written and considered (e.g. here: https://github.com/PyPSA/atlite/blob/master/atlite/datasets/era5.py#L173-L175), ERA5 takes as reference time the accumulated values of the last hour meaning 11:00 refers to 10:00-11:00.

Now, in the Sarah implementation you take the mean of the arrays at 11:00 and 11:30 and assign the time index of the first array (11:00): https://github.com/PyPSA/atlite/blob/master/atlite/datasets/sarah.py#L153-L156 which leads to the 1-hour time misalignment. See e.g. the spatially averaged values (GHI) for a June day :
image

So if I did not overlook anything and this bug is true, the only change required would be:
ds = ds.assign_coords(time=ds.indexes["time"] + pd.Timedelta(60, "m"))
after merging the data with the solar position (https://github.com/PyPSA/atlite/blob/master/atlite/datasets/sarah.py#L237)

I could fix this in the sarah3 compatibility pull request (https://github.com/PyPSA/atlite/pull/352) if required.

Reproducible Example

No response

Expected Behavior

No response

Installed Versions

Replace this line.

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

Review atlite/datasets/sarah.py around lines 153-156 and 237, then compare the time handling described in atlite/datasets/era5.py around lines 173-175. Verify whether the merged SARAH time coordinate needs the proposed 60-minute shift, and confirm the June-day spatially averaged GHI values are aligned afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.