openclimatefix / nowcasting_datamodel

Datamodel for the nowcasting project
6 stars 7 forks source link

filter more in the pass #269

Closed peterdudfield closed 3 months ago

peterdudfield commented 3 months ago

Pull Request

Description

We get a bug in the read function if both start_datetime and created_utc_limit are set

Before we had

query = query.filter(model.target_time >= start_datetime)
query = query.filter(model.created_utc <= created_utc_limit)
query = query.filter(ForecastSQL.created_utc >= start_datetime - timedelta(1day))

This was a problem if the created_utc_limit was more than a day before the start_datetime

we now have

query = query.filter(model.target_time >= start_datetime)
query = query.filter(model.created_utc <= created_utc_limit)
query = query.filter(ForecastSQL.created_utc >= min(start_datetime,created_utc_limit) - timedelta(1day))

Helps with https://github.com/openclimatefix/uk-pv-national-gsp-api/issues/327

How Has This Been Tested?

CI tests

Checklist:

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 66.66667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 94.75%. Comparing base (fc3d90c) to head (53ec51d). Report is 2 commits behind head on main.

:exclamation: Current head 53ec51d differs from pull request most recent head 2111cce. Consider uploading reports for the commit 2111cce to get more accurate results

Files Patch % Lines
nowcasting_datamodel/read/read.py 66.66% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #269 +/- ## ========================================== - Coverage 94.81% 94.75% -0.06% ========================================== Files 24 24 Lines 1523 1525 +2 ========================================== + Hits 1444 1445 +1 - Misses 79 80 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.