Coder Social home page Coder Social logo

uk-pv-forecast-blend's Introduction

UK PV Forecast Blend

This app is for blending forecast together

The main application (forecast_blend/app.py)

  1. Loads different forecasts
  2. Blends them together using weights
  3. Saves them ready to be used by the api
  4. This is done for all GSPs

This was previously done in the API

We always update the ForecastValueLatest table, but we only update the ForecastValue table every 30 minutes

Details

  • Note we only blend forecasts if they are made within 2 hours. If all forecasts are older than this, then all forecasts are used.
  • The probabilistic forecasts are now blended using the same method as the expected value
  graph TD;
      subgraph App
      S(Start) --> LF
      LF(Load All Forecasts);
      LF --> Filter(Filter Forecasts);
      Filter -->  Blend[Blend \n Expected values];
      Blend --> N4(Blend Probabilistic \n- only for National);
      N4 --> S(Save Forecast)
      S --> F(Finish)
      end
      
      subgraph Blending
    A(All Forecasts);
    W2(Weights);
    A --> SUT(Split unique 'target times' \n and not);
    SUT --> |Unique Target times| B
    SUT --> |Duplicated Target times| C(Loop over each \n target time)
    C --> BW
    W2 --> BW
    BW(Blend using weights) --> SumCheck
    SumCheck{At least one \n forecast available} --> |yes| B
    SumCheck --> |no| Blend2(Blend forecast with \n next set of weights)
    Blend2 --> SumCheck2
    SumCheck2{At least one \n forecast available} --> |yes| B
    SumCheck2 --> |no| BB(Break)
    B(Blended \n Forecast)
    end

Tests

Tests are in the tests folder and can be run using pytest

Might need to

export PYTHONPATH=${PYTHONPATH}:./forecast_blend

uk-pv-forecast-blend's People

Contributors

peterdudfield avatar

Watchers

 avatar  avatar  avatar

uk-pv-forecast-blend's Issues

Save blended metadata

Detailed Description

Would be great to save what models and weights are used for each forecast

Context

  • good to know where the values come from

Possible Implementation

  1. add to 'plevel' column in nowcasting_datamodel
  2. Get forecasts to save to both plevel and properties.
  3. Update blend service to use plevel column, but save to both
  4. Get forecasts to only save to plevel
  5. Update api to read plevel column
  6. Update blend service to save the weights used for each model in the properties column

Odd loading of weights

Looks like it struggles to load pure PVnet_v2 weights, so then loads a mixture of pvnet_v2 and national_xg

Screenshot 2023-09-05 at 12 53 13

This related to #8

bug: null values in propertoes

Detailed Description

Work out and try to fix why the properties blend ended up being
Screenshot 2023-10-24 at 17 14 02
Screenshot 2023-10-24 at 17 13 48

Context

  • airflow was out of memory so the forecast may have not run
  • target_time='2023-10-24 23:30:00+00'
  • This error actually happened in the API, but was made by the blend service

Possible Implementation

if Null, make properties an empty dict

Extract Blend into seperate component

Currently the API blends the 3 forecasts together.

It would be great if we have a separate component that doesnt this blending and saves the results.
The API can then just load this results.

This is good as it increase API speed, and also creates a history of the forecasts presented to clients

00.55 failure

Describe the bug

This bug seems to happen every day a 00.55

Screenshot 2023-11-23 at 08 23 18

Expected behavior

not to happen

Additional context

Just set up ariflow-slack integration to make it clear when something fails

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.