ETo 2.2.0__tar.gz → 2.2.1__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.5
2
2
  Name: ETo
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: Class and functions to estimate reference ET
5
5
  Project-URL: Homepage, https://github.com/mullenkamp/ETo
6
6
  Project-URL: Documentation, https://mullenkamp.github.io/ETo/
@@ -2,4 +2,4 @@ from eto.core import ETo
2
2
  import eto.datasets
3
3
  import eto.methods
4
4
 
5
- __version__ = '2.2.0'
5
+ __version__ = '2.2.1'
@@ -210,6 +210,12 @@ def param_est(self, data, freq='D', z_msl=None, lat=None, lon=None, TZ_lon=None,
210
210
  # be in any time zone (e.g. UTC), so the solar time can fall on the previous or next day:
211
211
  # the declination and sunset angle use that solar day.
212
212
  t_mid = np.asarray(hour, dtype=np.float64) + (0.5 if time_label == 'start' else -0.5)
213
+ # The midpoint belongs to its own day: a period-ending label at hour 0 is the previous day's last
214
+ # hour, so the equation of time (Eq 32-33, J of the period) uses that day, as the same hour labelled
215
+ # by its start does.
216
+ mid_shift = np.floor(t_mid/24)
217
+ Day = Day + mid_shift
218
+ t_mid = t_mid - 24*mid_shift
213
219
  b = (2*np.pi*(Day - 81))/364
214
220
  S_c = 0.1645*np.sin(2*b) - 0.1255*np.cos(b) - 0.025*np.sin(b)
215
221
  # lon - TZ_lon wrapped to [-180, 180): the same place given as 183.5 or -176.5 is the same offset.
@@ -243,3 +243,21 @@ def test_sunrise_and_sunset_hours_integrate_only_the_sunlit_part():
243
243
  w = np.pi / 12 * (((t + 0.06667 * 171.5 + sc0) % 24) - 12)
244
244
  inst = 0.082 * dr * np.maximum(np.sin(phi) * np.sin(delta) + np.cos(phi) * np.cos(delta) * np.cos(w), 0)
245
245
  assert ra[h] == pytest.approx(inst.mean() * 60, abs=2e-3), h
246
+
247
+
248
+ def test_both_labellings_of_the_same_hours_agree_across_midnight():
249
+ # Two January days at a Canterbury point, labelled by UTC timestamps as a real series is: the hour
250
+ # 23:00-24:00 is 'start' 23 on day 15 and 'end' 0 on day 16. Every quantity must match exactly,
251
+ # including the equation of time, which once came from the end label's day (16) instead of the
252
+ # midpoint's (15).
253
+ n = 48
254
+ data = {'T_mean': np.full(n, 20.0), 'RH_mean': np.full(n, 60.0), 'U_z': np.full(n, 2.0),
255
+ 'R_s': np.full(n, 0.5)}
256
+ start = np.datetime64('2000-01-15T00', 'h') + np.arange(n)
257
+ end = start + np.timedelta64(1, 'h')
258
+ kw = {'z_msl': 300, 'lat': -43.5, 'lon': 171.5, 'TZ_lon': 0.0, 'rs_rso_init': 1.0}
259
+ a = ETo(data, 'h', dates=start, time_label='start', **kw)
260
+ b = ETo(data, 'h', dates=end, time_label='end', **kw)
261
+ np.testing.assert_allclose(b.ts_param['R_a'], a.ts_param['R_a'], rtol=1e-13, atol=0)
262
+ np.testing.assert_allclose(b.eto_fao(min_ETo=None, max_ETo=None, decimals=None),
263
+ a.eto_fao(min_ETo=None, max_ETo=None, decimals=None), rtol=1e-13, atol=0)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes