Skip to content

Update SITCOM-2111 with manual TZ offset#191

Open
b1quint wants to merge 2 commits intodevelopfrom
tickets/SITCOM-2111
Open

Update SITCOM-2111 with manual TZ offset#191
b1quint wants to merge 2 commits intodevelopfrom
tickets/SITCOM-2111

Conversation

@b1quint
Copy link
Member

@b1quint b1quint commented Jul 10, 2025

No description provided.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@b1quint b1quint requested a review from Copilot July 10, 2025 16:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Updates the SITCOM-2111 evaluation notebook to allow specifying a manual timezone offset, refactor forecast unpacking, and parameterize column count.

  • Replace single day_obs with day_obs_start/day_obs_end and remove fixed number_of_days
  • Introduce N_COLS and manual timezone offset clt_tz_offset for plotting
  • Refactor static unpacking logic into a new unpack_hourly_weather_forecast_matching_timestamps function
Comments suppressed due to low confidence (3)

notebooks/tel_and_site/subsys_req_ver/SITCOM-2111_Temperature_Forecast_Evaluation.ipynb:72

  • [nitpick] Consider renaming this constant to CLT_TZ_OFFSET to follow the uppercase naming convention for constants and improve readability.
    "clt_tz_offset = -4  # hours\n",

notebooks/tel_and_site/subsys_req_ver/SITCOM-2111_Temperature_Forecast_Evaluation.ipynb:498

  • [nitpick] The code switches between published_timestamp and published_time; consider standardizing on one name for consistency.
    "for pub_t in df_forecast[\"published_time\"].unique():\n",

notebooks/tel_and_site/subsys_req_ver/SITCOM-2111_Temperature_Forecast_Evaluation.ipynb:263

  • The function unpack_hourly_weather_forecast is not defined in this notebook; ensure it is imported or replaced with the correct unpack function.
    "        sub_df = unpack_hourly_weather_forecast(sub_df.loc[published_time])\n",

" for published_time, row in _df[cols].iterrows():\n",
"\n",
" # Get the beginning of the data corresponding to this time range\n",
" index_start = (row - published_time).abs().argmin()\n",
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

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

Computing index_start this way returns a column label string instead of an integer offset, which will break the subsequent index_end calculation; consider extracting the numeric suffix or using positional indexing.

Suggested change
" index_start = (row - published_time).abs().argmin()\n",
" index_start = int((row - published_time).abs().argmin().lstrip('timestamp'))\n",

Copilot uses AI. Check for mistakes.
"\n",
"# Plot forecast\n",
"ax.plot(df_forecast[\"temperature\"], label=\"Meteoblue Latests Forecast\")\n",
"ax.plot(df_forecast.timestamp - tz_offset , df_forecast.temperature, label=\"Meteoblue Latests Forecast\")\n",
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

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

There's a typo in the label: "Latests" should be "Latest".

Suggested change
"ax.plot(df_forecast.timestamp - tz_offset , df_forecast.temperature, label=\"Meteoblue Latests Forecast\")\n",
"ax.plot(df_forecast.timestamp - tz_offset , df_forecast.temperature, label=\"Meteoblue Latest Forecast\")\n",

Copilot uses AI. Check for mistakes.
Comment on lines +266 to +271
" if new_df is not None:\n",
" new_df = pd.concat([new_df, sub_df])\n",
" else:\n",
" new_df = sub_df\n",
"\n",
" return new_df"
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

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

Repeatedly concatenating DataFrames inside a loop can be inefficient; consider collecting each sub_df in a list and performing one concat after the loop.

Suggested change
" if new_df is not None:\n",
" new_df = pd.concat([new_df, sub_df])\n",
" else:\n",
" new_df = sub_df\n",
"\n",
" return new_df"
" sub_dfs.append(sub_df)\n",
"\n",
" new_df = pd.concat(sub_dfs, ignore_index=True)\n",
" return new_df\n",

Copilot uses AI. Check for mistakes.
Copy link

@couger01 couger01 left a comment

Choose a reason for hiding this comment

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

LGTM.

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