hefty 0.3.0__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hefty
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Some (relatively) lightweight short-term energy forecasting tools for solar, wind, and load.
5
5
  Author: Will Hobbs
6
6
  License-Expression: BSD-3-Clause
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Operating System :: OS Independent
12
12
  Classifier: Intended Audience :: Science/Research
13
13
  Classifier: Topic :: Scientific/Engineering
14
- Requires-Python: <3.14,>=3.11
14
+ Requires-Python: >=3.11
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
17
  Requires-Dist: herbie-data[scikit-learn]>=2026.9.2
@@ -223,7 +223,7 @@ Those outputs could then be directly passed as inputs to `hefty.solar.get_solar_
223
223
 
224
224
  Model delays are more than just a fixed time: they can vary by lead time and by cycle time. And some cycles have different total run lengths and interval size for some models. `adjust_forecast_datetimes` adjusts for all of this for you.
225
225
 
226
- Delays calculated in `adjust_forecast_datetimes` are based on experiments in this gist https://gist.github.com/williamhobbs/9585ff5d1248ab5de4d9e8665d7c8ea6 (which will hopefully one day be cleaned up and added to this repo somehow), documentation published by ECMWF, and this cool dashboard by dynamical.org https://dynamical.org/status/.
226
+ Delays calculated in `adjust_forecast_datetimes` are based on experiments in this notebook [docs/forecast_model_delays.ipynb](docs/forecast_model_delays.ipynb) (or see this markdown version, [docs/forecast_model_delays.md](docs/forecast_model_delays.md)), documentation published by ECMWF, and this cool dashboard by dynamical.org https://dynamical.org/status/.
227
227
 
228
228
  ## Local disk space
229
229
  The current version of hefty keeps copies of downloaded grib files on your local storage. This can result in a large amount of disk space being used up. Future versions of hefty may change this (see [issue #70](https://github.com/williamhobbs/hefty/issues/70)), but for now, users may need to monitor storage space and manually delete files if needed.
@@ -201,7 +201,7 @@ Those outputs could then be directly passed as inputs to `hefty.solar.get_solar_
201
201
 
202
202
  Model delays are more than just a fixed time: they can vary by lead time and by cycle time. And some cycles have different total run lengths and interval size for some models. `adjust_forecast_datetimes` adjusts for all of this for you.
203
203
 
204
- Delays calculated in `adjust_forecast_datetimes` are based on experiments in this gist https://gist.github.com/williamhobbs/9585ff5d1248ab5de4d9e8665d7c8ea6 (which will hopefully one day be cleaned up and added to this repo somehow), documentation published by ECMWF, and this cool dashboard by dynamical.org https://dynamical.org/status/.
204
+ Delays calculated in `adjust_forecast_datetimes` are based on experiments in this notebook [docs/forecast_model_delays.ipynb](docs/forecast_model_delays.ipynb) (or see this markdown version, [docs/forecast_model_delays.md](docs/forecast_model_delays.md)), documentation published by ECMWF, and this cool dashboard by dynamical.org https://dynamical.org/status/.
205
205
 
206
206
  ## Local disk space
207
207
  The current version of hefty keeps copies of downloaded grib files on your local storage. This can result in a large amount of disk space being used up. Future versions of hefty may change this (see [issue #70](https://github.com/williamhobbs/hefty/issues/70)), but for now, users may need to monitor storage space and manually delete files if needed.
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hefty"
7
- version = "0.3.0"
7
+ version = "0.3.2"
8
8
  description = "Some (relatively) lightweight short-term energy forecasting tools for solar, wind, and load."
9
9
  readme = "README.md"
10
- requires-python = ">=3.11,<3.14"
10
+ requires-python = ">=3.11"
11
11
  authors = [
12
12
  { name="Will Hobbs" },
13
13
  ]
@@ -346,7 +346,8 @@ def get_solar_forecast(latitude, longitude, init_date, run_length,
346
346
  unmixed = ((mixed['hour_of_mixed_period'] * mixed['sdswrf']
347
347
  - (mixed['hour_of_mixed_period'] - mixed['int_len'])
348
348
  * mixed['sdswrf_prev']) / mixed['int_len'])
349
- df['ghi'] = unmixed
349
+ # clip to avoid occasional small negative ghi in GEFS, see GH #35
350
+ df['ghi'] = unmixed.clip(lower=0)
350
351
 
351
352
  elif model in {'ifs', 'ifs_ens', 'aifs', 'aifs_ens', 'cams'}:
352
353
  # for ifs ghi: cumulative J/m^s to average W/m^2 over the interval
@@ -407,7 +408,7 @@ def get_solar_forecast(latitude, longitude, init_date, run_length,
407
408
  df['ghi_csi'] = df['ghi'] / df['ghi_clear']
408
409
 
409
410
  # avoid divide by zero issues
410
- df.loc[df['ghi'] == 0, 'ghi_csi'] = 0
411
+ df.loc[df['ghi_clear'] == 0, 'ghi_csi'] = 0
411
412
 
412
413
  # 60min version of data, centered at bottom of the hour
413
414
  new_index = pd.date_range(df.index.min(),
@@ -828,7 +829,8 @@ def get_solar_forecast_fast(latitude, longitude, init_date, run_length,
828
829
  unmixed = ((mixed['hour_of_mixed_period'] * mixed['sdswrf']
829
830
  - (mixed['hour_of_mixed_period'] - mixed['int_len'])
830
831
  * mixed['sdswrf_prev']) / mixed['int_len'])
831
- df['ghi'] = unmixed
832
+ # clip to avoid occasional small negative ghi in GEFS, see GH #35
833
+ df['ghi'] = unmixed.clip(lower=0)
832
834
 
833
835
  elif model in ['ifs', 'ifs_ens', 'aifs', 'aifs_ens']:
834
836
  # for ifs ghi: cumulative J/m^s to average W/m^2 over the interval
@@ -879,7 +881,7 @@ def get_solar_forecast_fast(latitude, longitude, init_date, run_length,
879
881
  df['ghi_csi'] = df['ghi'] / df['ghi_clear']
880
882
 
881
883
  # avoid divide by zero issues
882
- df.loc[df['ghi'] == 0, 'ghi_csi'] = 0
884
+ df.loc[df['ghi_clear'] == 0, 'ghi_csi'] = 0
883
885
 
884
886
  # 60min version of data, centered at bottom of the hour
885
887
  new_index = pd.date_range(df.index.min(),
@@ -1268,7 +1270,7 @@ def get_solar_forecast_ensemble_subset(
1268
1270
  df['ghi_csi'] = df['ghi'] / df['ghi_clear']
1269
1271
 
1270
1272
  # avoid divide by zero issues
1271
- df.loc[df['ghi'] == 0, 'ghi_csi'] = 0
1273
+ df.loc[df['ghi_clear'] == 0, 'ghi_csi'] = 0
1272
1274
 
1273
1275
  # make a dummy column
1274
1276
  df['dummy'] = 0
@@ -1729,7 +1731,7 @@ def get_solar_forecast_ensemble(latitude, longitude, init_date, run_length,
1729
1731
  df['ghi_csi'] = df['ghi'] / df['ghi_clear']
1730
1732
 
1731
1733
  # avoid divide by zero issues
1732
- df.loc[df['ghi'] == 0, 'ghi_csi'] = 0
1734
+ df.loc[df['ghi_clear'] == 0, 'ghi_csi'] = 0
1733
1735
 
1734
1736
  # 60min version of data, centered at bottom of the hour
1735
1737
  new_index = pd.date_range(df.index.min(),
@@ -1869,7 +1871,8 @@ def get_solar_forecast_ensemble(latitude, longitude, init_date, run_length,
1869
1871
  unmixed = ((mixed['hour_of_mixed_period'] * mixed['sdswrf']
1870
1872
  - (mixed['hour_of_mixed_period'] - mixed['int_len'])
1871
1873
  * mixed['sdswrf_prev']) / mixed['int_len'])
1872
- df['ghi'] = unmixed
1874
+ # clip to avoid occasional small negative ghi in GEFS, see GH #35
1875
+ df['ghi'] = unmixed.clip(lower=0)
1873
1876
 
1874
1877
  # make 1min interval clear sky data covering our time range
1875
1878
  times = pd.date_range(
@@ -1905,7 +1908,7 @@ def get_solar_forecast_ensemble(latitude, longitude, init_date, run_length,
1905
1908
  df['ghi_csi'] = df['ghi'] / df['ghi_clear']
1906
1909
 
1907
1910
  # avoid divide by zero issues
1908
- df.loc[df['ghi'] == 0, 'ghi_csi'] = 0
1911
+ df.loc[df['ghi_clear'] == 0, 'ghi_csi'] = 0
1909
1912
 
1910
1913
  # 60min version of data, centered at bottom of the hour
1911
1914
  new_index = pd.date_range(df.index.min(),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hefty
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Some (relatively) lightweight short-term energy forecasting tools for solar, wind, and load.
5
5
  Author: Will Hobbs
6
6
  License-Expression: BSD-3-Clause
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Operating System :: OS Independent
12
12
  Classifier: Intended Audience :: Science/Research
13
13
  Classifier: Topic :: Scientific/Engineering
14
- Requires-Python: <3.14,>=3.11
14
+ Requires-Python: >=3.11
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
17
  Requires-Dist: herbie-data[scikit-learn]>=2026.9.2
@@ -223,7 +223,7 @@ Those outputs could then be directly passed as inputs to `hefty.solar.get_solar_
223
223
 
224
224
  Model delays are more than just a fixed time: they can vary by lead time and by cycle time. And some cycles have different total run lengths and interval size for some models. `adjust_forecast_datetimes` adjusts for all of this for you.
225
225
 
226
- Delays calculated in `adjust_forecast_datetimes` are based on experiments in this gist https://gist.github.com/williamhobbs/9585ff5d1248ab5de4d9e8665d7c8ea6 (which will hopefully one day be cleaned up and added to this repo somehow), documentation published by ECMWF, and this cool dashboard by dynamical.org https://dynamical.org/status/.
226
+ Delays calculated in `adjust_forecast_datetimes` are based on experiments in this notebook [docs/forecast_model_delays.ipynb](docs/forecast_model_delays.ipynb) (or see this markdown version, [docs/forecast_model_delays.md](docs/forecast_model_delays.md)), documentation published by ECMWF, and this cool dashboard by dynamical.org https://dynamical.org/status/.
227
227
 
228
228
  ## Local disk space
229
229
  The current version of hefty keeps copies of downloaded grib files on your local storage. This can result in a large amount of disk space being used up. Future versions of hefty may change this (see [issue #70](https://github.com/williamhobbs/hefty/issues/70)), but for now, users may need to monitor storage space and manually delete files if needed.
@@ -20,7 +20,7 @@ def test_tz_warning():
20
20
 
21
21
 
22
22
  def test_hrrr_too_far():
23
- available_date = '2026-09-24 02:00'
23
+ available_date = '2026-09-24 02:00+00:00'
24
24
  run_length_needed = 43
25
25
  lead_time_to_start_needed = 1
26
26
  model = 'hrrr'
@@ -32,7 +32,7 @@ def test_hrrr_too_far():
32
32
 
33
33
 
34
34
  def test_gfs_way_too_far():
35
- available_date = '2026-09-24 00:00'
35
+ available_date = '2026-09-24 00:00+00:00'
36
36
  run_length_needed = 385
37
37
  lead_time_to_start_needed = 0
38
38
  model = 'gfs'
@@ -7,8 +7,10 @@ from hefty.solar import get_solar_forecast
7
7
 
8
8
  # ignore xarray FutureWarnings (see https://github.com/blaylockbk/Herbie/issues/525).
9
9
  # ignore grib file removal warnings
10
- @pytest.mark.filterwarnings('ignore:.*Will not remove GRIB.*')
11
- @pytest.mark.filterwarnings('ignore:.*In a future version.*')
10
+ pytestmark = [
11
+ pytest.mark.filterwarnings('ignore:.*Will not remove GRIB.*'),
12
+ pytest.mark.filterwarnings('ignore:.*In a future version.*')
13
+ ]
12
14
 
13
15
 
14
16
  def test_hrrr():
@@ -7,8 +7,10 @@ from hefty.solar import get_solar_forecast_ensemble
7
7
 
8
8
  # ignore xarray FutureWarnings (see https://github.com/blaylockbk/Herbie/issues/525).
9
9
  # ignore grib file removal warnings
10
- @pytest.mark.filterwarnings('ignore:.*Will not remove GRIB.*')
11
- @pytest.mark.filterwarnings('ignore:.*In a future version.*')
10
+ pytestmark = [
11
+ pytest.mark.filterwarnings('ignore:.*Will not remove GRIB.*'),
12
+ pytest.mark.filterwarnings('ignore:.*In a future version.*')
13
+ ]
12
14
 
13
15
 
14
16
  def test_gefs_dynamical():
@@ -7,8 +7,10 @@ from hefty.solar import get_solar_forecast_fast
7
7
 
8
8
  # ignore xarray FutureWarnings (see https://github.com/blaylockbk/Herbie/issues/525).
9
9
  # ignore grib file removal warnings
10
- @pytest.mark.filterwarnings('ignore:.*Will not remove GRIB.*')
11
- @pytest.mark.filterwarnings('ignore:.*In a future version.*')
10
+ pytestmark = [
11
+ pytest.mark.filterwarnings('ignore:.*Will not remove GRIB.*'),
12
+ pytest.mark.filterwarnings('ignore:.*In a future version.*')
13
+ ]
12
14
 
13
15
 
14
16
  def test_hrrr():
@@ -7,8 +7,10 @@ from hefty.wind import get_wind_forecast
7
7
 
8
8
  # ignore xarray FutureWarnings (see https://github.com/blaylockbk/Herbie/issues/525).
9
9
  # ignore grib file removal warnings
10
- @pytest.mark.filterwarnings('ignore:.*Will not remove GRIB.*')
11
- @pytest.mark.filterwarnings('ignore:.*In a future version.*')
10
+ pytestmark = [
11
+ pytest.mark.filterwarnings('ignore:.*Will not remove GRIB.*'),
12
+ pytest.mark.filterwarnings('ignore:.*In a future version.*')
13
+ ]
12
14
 
13
15
 
14
16
  def test_hrrr():
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes