Skip to content
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

Calculate solar position already during cutout creation + add time-shift for ERA5 #199

Merged
merged 11 commits into from
Nov 24, 2021

Conversation

euronion
Copy link
Collaborator

@euronion euronion commented Nov 23, 2021

Closes #158 .

Change proposed in this Pull Request

  • Solar position will be calculated during cutout creation
  • atlite.pv.solar_position.SolarPosition results become part of the "influx" feature
  • Solar position for ERA5 is calculated with an time-shift of "-30min" to take into account the fact that ERA5 variables are aggregated (right interval border, see [JOSS] Solar position calculation introduces time shift error for ERA5 #158 )
  • atlite.pv.solar_position.SolarPosition(...) is backwards compatible (for now) and acts as a pure getter if the variables are present in the cutout, else it calculates them.

Description

Motivation and Context

How Has This Been Tested?

Tested locally on two cutouts (one ERA5, one SARAH)

image

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I tested my contribution locally and it seems to work fine.
  • I locally ran pytest inside the repository and no unexpected problems came up.
  • I have adjusted the docstrings in the code appropriately.
  • I have documented the effects of my code changes in the documentation doc/.
  • I have added newly introduced dependencies to environment.yaml file.
  • I have added a note to release notes doc/release_notes.rst.
  • I have used pre-commit run --all to lint/format/check my contribution

TODOs

  • Release notes
  • Suppress deprecation warning during cutout creation

@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2021

Codecov Report

Merging #199 (4d30966) into master (83e101b) will increase coverage by 0.21%.
The diff coverage is 78.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #199      +/-   ##
==========================================
+ Coverage   75.31%   75.52%   +0.21%     
==========================================
  Files          18       18              
  Lines        1450     1479      +29     
  Branches      189      192       +3     
==========================================
+ Hits         1092     1117      +25     
- Misses        294      299       +5     
+ Partials       64       63       -1     
Impacted Files Coverage Δ
atlite/datasets/sarah.py 25.53% <30.00%> (-0.05%) ⬇️
atlite/pv/solar_position.py 91.11% <91.66%> (+0.78%) ⬆️
atlite/datasets/era5.py 89.65% <100.00%> (+2.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83e101b...4d30966. Read the comment docs.

Copy link
Contributor

@FabianHofmann FabianHofmann left a comment

Choose a reason for hiding this comment

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

Great @euronion ! I think that is a good solution. We should open an issue to address the deprecation for the release after the next one.

@euronion
Copy link
Collaborator Author

I've created the issues and tagged it with v0.4 (which should be the next-next major version, right?).

Also I noticed a small bug I introduced: The previous implementation assumed hourly time-steps for ERA5, it now supports arbitrary time-steps for the time_shift with ERA5 cutouts.

I'll merge as soon as CI clears the PR.

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.

[JOSS] Solar position calculation introduces time shift error for ERA5
3 participants