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

pvsite-datamodel integration & fake forecasts #1

Merged
merged 18 commits into from
Jan 25, 2024

Conversation

confusedmatrix
Copy link
Contributor

@confusedmatrix confusedmatrix commented Jan 11, 2024

Pull Request

Description

  • Integrates the forecast app with pvsite-datamodel for writing generation data to database
  • Generates fake forecasts (uniform random for wind, noisy sine wave for solar)

N.B This work is dependent on openclimatefix/pv-site-datamodel#97

Still TODO:

  • Write tests for all functions in app.py [in progress]
  • Script to seed a DB for testing the app locally
  • Write forecast values to DB via pvsite_datamodel's insert_forecast_values function

Fixes #

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration

  • Yes

If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@confusedmatrix confusedmatrix changed the title pvsite-datamodel integration pvsite-datamodel integration & fake forecasts Jan 11, 2024
@peterdudfield
Copy link
Contributor

To get the tests running, I think we need a later version of this github reusable workflow - https://github.com/openclimatefix/india-forecast-app/blob/main/.github/workflows/ci.yml#L37

tests/test_app.py Outdated Show resolved Hide resolved
@confusedmatrix
Copy link
Contributor Author

To get the tests running, I think we need a later version of this github reusable workflow - https://github.com/openclimatefix/india-forecast-app/blob/main/.github/workflows/ci.yml#L37

This line refers to the docker-release reusable workflow which I believe is already pinned to the latest version v1.2.0

The github action doesn't currently run as the github action secrets aren't yet set. Would you be able to set the following secrets for me please?

DOCKERHUB_USERNAME
DOCKERHUB_TOKEN
PAT_TOKEN

@peterdudfield
Copy link
Contributor

secrets added, add 1.8.1 is the latest

Copy link

codecov bot commented Jan 17, 2024

Welcome to Codecov 🎉

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered ☂️

@confusedmatrix confusedmatrix marked this pull request as ready for review January 25, 2024 14:39

.PHONY: lint
lint:
poetry run ruff $(SRC)
poetry run black --check $(SRC)
poetry run isort --check $(SRC)
Copy link
Contributor

@peterdudfield peterdudfield Jan 25, 2024

Choose a reason for hiding this comment

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

do you want to keep this in? I have found them quite useful in the past and they then are the same as the CI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was getting a conflict between ruff and black, so just stuck with ruff - as far as I understand, ruff is a drop in replacement for black anyway

Copy link
Contributor

@peterdudfield peterdudfield left a comment

Choose a reason for hiding this comment

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

One small comment from me, but otherwise looks good

Does it work when you run it?

"""

sites = get_sites_by_country(db_session, country="india")

Copy link
Contributor

Choose a reason for hiding this comment

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

could we add loggin statement here, saying found X sites

log.info(f"Running model for site={site_id}")
forecast_values = run_model(model=model, site_id=site_id, timestamp=timestamp)

if forecast_values is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a else, and say forecast values were None, or something like that

@confusedmatrix confusedmatrix merged commit 0e4431a into main Jan 25, 2024
5 checks passed
@confusedmatrix confusedmatrix deleted the chris/datamodel-integration branch January 25, 2024 15:29
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.

2 participants