openclimatefix / open-source-quartz-solar-forecast

Open Source Solar Site Level Forecast
MIT License
69 stars 55 forks source link

Run the model regularly and save the results #135

Closed peterdudfield closed 3 months ago

peterdudfield commented 5 months ago

Detailed Description

It would be great to run the module regularly, say evey1 hour and save the results

Context

Possible Implementation

peterdudfield commented 4 months ago

We could even use github actions to run the model every dat at 9.00 at one particular site. The results could even been saved to csv and committed to the repo. Then once the live data is available we could compare which model is doing the best

mduffin95 commented 4 months ago

@peterdudfield I'd be keen to look into this!

Running this using github actions is a neat idea. I wonder though whether committing it to the repo would cause the repo size to grow quite a lot. Maybe we could instead save the data as a build artifact?

peterdudfield commented 4 months ago

Yea, it would be nice to keep the repo size down. Could we even push it to the results to huggingface? We even thought of hostel the models there, so might be nice idea to have a huggingface repo with these results.

mduffin95 commented 4 months ago

As far as I understand we would like to take forecast readings at a fixed point in time each day because it's difficult to do a backdated forecast. Then when the live data (pvlive?) is available we can check accuracy.

Just for some more context, what's the difference between this and what you see at app.quartz.solar? It looks like there we already have pv live data overlaid with OCF forecast data.

peterdudfield commented 4 months ago

Hi @mduffin95

This is actualy more of a site level forecast, where as pvlive is a national (and regional) level pv estimation. Hopefully this then explains that this is site level, and app.quartz.solar is more regional and national level

peterdudfield commented 4 months ago

We now have a huggingface repo - https://huggingface.co/openclimatefix/open-source-quartz-solar-forecast/tree/main

peterdudfield commented 3 months ago

This is now merged in, need to run this CI, to check it works

peterdudfield commented 3 months ago

The first CI errored, @mduffin95 can you see why?

https://github.com/openclimatefix/Open-Source-Quartz-Solar-Forecast/actions/runs/10316711744/job/28559504271, is the file now here

mduffin95 commented 3 months ago

Yes my mistake I must not have update some paths after making PR changes. I can fix it this evening.

peterdudfield commented 3 months ago

No problem. Thank you very much

mduffin95 commented 3 months ago

@peterdudfield #177 fixes this!

mduffin95 commented 3 months ago

@peterdudfield The runs are still failing:

https://github.com/openclimatefix/Open-Source-Quartz-Solar-Forecast/actions/runs/10338568846/job/28616855215

Based on the following line, I think it might be to do with the value of the HF_REPO secret:

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/api/datasets/***

The secret value should be something like openclimatefix/<dataset-name>

peterdudfield commented 3 months ago

Ive added a print statment and changed it to openclimatefix/open-source-quartz-solar-forecast

peterdudfield commented 3 months ago

The latest error, says log in sucessful, but still an error

Screenshot 2024-08-12 at 08 53 51

peterdudfield commented 3 months ago

This might be becasue the repo is a model repo, not a dataset, but im not sure

peterdudfield commented 3 months ago

We might have to use something like this - https://huggingface.co/docs/huggingface_hub/en/guides/upload

peterdudfield commented 3 months ago
       forecast.to_csv('temp.csv') # TODO use temp file
        api = HfApi(token=hf_token)
        api.upload_file(
            path_or_fileobj="temp.csv",
            path_in_repo=path,
            repo_id=hf_repo,
            repo_type="model",
        )

This seemed to work https://huggingface.co/openclimatefix/open-source-quartz-solar-forecast/tree/main/data/2024/8/12

peterdudfield commented 3 months ago

I can do a PR if you like @mduffin95 , unless you fancy it?

mduffin95 commented 3 months ago

I think instead of switching the API used, we should just be able to change the prefix in hf_upload.py (line 31).

From the docs:

The repo_type_prefix is datasets/ for datasets, spaces/ for spaces, and models don’t need a prefix in the URL.

I was using a dataset for testing, hence the datasets/ prefix.

mduffin95 commented 3 months ago

Feel free to PR either option though. I'm only free this evening to take a look myself.

peterdudfield commented 3 months ago

Thanks @mduffin95 it ran perfectly this morning -https://huggingface.co/openclimatefix/open-source-quartz-solar-forecast/tree/main/data/2024/8/13