vividfog / nordpool-predict-fi

A Python app and a Random Forest ML model that predicts spot prices for the Nordpool FI market.
MIT License
60 stars 8 forks source link

FMI version fail to run locally #6

Closed Teme-V closed 4 months ago

Teme-V commented 4 months ago

Following error appear when running python nordpool_predict_fi.py --predict --commit

https://sahkotin.fi/prices?vat&start=2024-02-23T13:00:00.000Z&end=2024-03-06T13:00:00.000Z Days of data coverage (should be 7 back, 5 forward for now): 12 Traceback (most recent call last): File "/home/teme/nordpool-predict-fi/nordpool_predict_fi.py", line 242, in <module> price_df = rf_model.predict(df[['day_of_week', 'hour', 'month', 'NuclearPowerMW'] + fmisid_ws + fmisid_t]) ~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/teme/nordpool-predict-fi/venv/lib/python3.12/site-packages/pandas/core/frame.py", line 4096, in __getitem__ indexer = self.columns._get_indexer_strict(key, "columns")[1] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/teme/nordpool-predict-fi/venv/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 6199, in _get_indexer_strict self._raise_if_missing(keyarr, indexer, axis_name) File "/home/teme/nordpool-predict-fi/venv/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 6251, in _raise_if_missing raise KeyError(f"{not_found} not in index") KeyError: "['FMISID_WS not set in environment', 'FMISID_T not set in environment'] not in index"

vividfog commented 4 months ago

"FMISID_WS not set in environment"

Check the template env file provided in the repo and double check that the variable is indeed set in your .env.local copy of it. Fingrid key too. The env file changed a little when plan B was executed yesterday.

These are wind speed and temperature FMI station IDs used as data sources. Check the comments around this part of the code and the template env sample.

vividfog commented 4 months ago

TODO: the code could use more try/except blocks for managing errors and edge cases.

Teme-V commented 4 months ago

"FMISID_WS not set in environment"

Check the template env file provided in the repo and double check that the variable is indeed set in your .env.local copy of it. Fingrid key too. The env file changed a little when plan B was executed yesterday.

These are wind speed and temperature FMI station IDs used as data sources. Check the comments around this part of the code and the template env sample.

This was the issue. I forgot to update .env.local from previous foreca version