forcingkit 0.18.0__tar.gz → 0.18.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.
Files changed (145) hide show
  1. {forcingkit-0.18.0 → forcingkit-0.18.1}/PKG-INFO +1 -1
  2. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/conf.py +1 -1
  3. {forcingkit-0.18.0 → forcingkit-0.18.1}/pyproject.toml +1 -1
  4. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/hrdps.py +32 -12
  5. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_hrdps.py +68 -0
  6. {forcingkit-0.18.0 → forcingkit-0.18.1}/uv.lock +1 -1
  7. {forcingkit-0.18.0 → forcingkit-0.18.1}/.agents/forcingkit.md +0 -0
  8. {forcingkit-0.18.0 → forcingkit-0.18.1}/.claude/CLAUDE.md +0 -0
  9. {forcingkit-0.18.0 → forcingkit-0.18.1}/.env.template +0 -0
  10. {forcingkit-0.18.0 → forcingkit-0.18.1}/.github/copilot-instructions.md +0 -0
  11. {forcingkit-0.18.0 → forcingkit-0.18.1}/.github/workflows/docs.yml +0 -0
  12. {forcingkit-0.18.0 → forcingkit-0.18.1}/.github/workflows/publish-client.yml +0 -0
  13. {forcingkit-0.18.0 → forcingkit-0.18.1}/.github/workflows/publish.yml +0 -0
  14. {forcingkit-0.18.0 → forcingkit-0.18.1}/.github/workflows/tests.yml +0 -0
  15. {forcingkit-0.18.0 → forcingkit-0.18.1}/.gitignore +0 -0
  16. {forcingkit-0.18.0 → forcingkit-0.18.1}/.markdownlint.yaml +0 -0
  17. {forcingkit-0.18.0 → forcingkit-0.18.1}/.pre-commit-config.yaml +0 -0
  18. {forcingkit-0.18.0 → forcingkit-0.18.1}/.python-version +0 -0
  19. {forcingkit-0.18.0 → forcingkit-0.18.1}/AGENTS.md +0 -0
  20. {forcingkit-0.18.0 → forcingkit-0.18.1}/CONTRIBUTING.md +0 -0
  21. {forcingkit-0.18.0 → forcingkit-0.18.1}/Dockerfile +0 -0
  22. {forcingkit-0.18.0 → forcingkit-0.18.1}/LICENSE +0 -0
  23. {forcingkit-0.18.0 → forcingkit-0.18.1}/README.md +0 -0
  24. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/LICENSE +0 -0
  25. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/README.md +0 -0
  26. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/pyproject.toml +0 -0
  27. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/src/forcingkit_client/__init__.py +0 -0
  28. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/src/forcingkit_client/client.py +0 -0
  29. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/src/forcingkit_client/schema.py +0 -0
  30. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/src/forcingkit_client/store.py +0 -0
  31. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/src/forcingkit_client/trajectory.py +0 -0
  32. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/tests/conftest.py +0 -0
  33. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/tests/test_client.py +0 -0
  34. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/tests/test_schema.py +0 -0
  35. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/tests/test_trajectory.py +0 -0
  36. {forcingkit-0.18.0 → forcingkit-0.18.1}/client/uv.lock +0 -0
  37. {forcingkit-0.18.0 → forcingkit-0.18.1}/docker-compose.yml +0 -0
  38. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/Makefile +0 -0
  39. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/make.bat +0 -0
  40. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/requirements-docs.txt +0 -0
  41. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/_extra/CNAME +0 -0
  42. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/_static/custom.css +0 -0
  43. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/_static/forcingkit-noreaster-wind.gif +0 -0
  44. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/atmospheric_forcing.rst +0 -0
  45. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/client.rst +0 -0
  46. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/fetchers.rst +0 -0
  47. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/hycom.rst +0 -0
  48. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/index.rst +0 -0
  49. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/layered_mesh.rst +0 -0
  50. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/mesh_frames.rst +0 -0
  51. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/necofs.rst +0 -0
  52. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/nyofs.rst +0 -0
  53. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/rivers.rst +0 -0
  54. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/roadmap.rst +0 -0
  55. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/sources.rst +0 -0
  56. {forcingkit-0.18.0 → forcingkit-0.18.1}/docs/source/waves.rst +0 -0
  57. {forcingkit-0.18.0 → forcingkit-0.18.1}/main.py +0 -0
  58. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/__init__.py +0 -0
  59. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/forcingkit_serve/__init__.py +0 -0
  60. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/forcingkit_serve/jobs.py +0 -0
  61. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/forcingkit_serve/main.py +0 -0
  62. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/forcingkit_serve/routers/bathymetry.py +0 -0
  63. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/forcingkit_serve/routers/plotly_api.py +0 -0
  64. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/forcingkit_serve/routers/removed.py +0 -0
  65. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/forcingkit_serve/routers/stores.py +0 -0
  66. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/forcingkit_serve/routers/viewer.py +0 -0
  67. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/forcingkit_serve/stac.py +0 -0
  68. {forcingkit-0.18.0 → forcingkit-0.18.1}/service/run_server.py +0 -0
  69. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/__init__.py +0 -0
  70. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/data/rivers/northeast_us.json +0 -0
  71. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/dispatcher.py +0 -0
  72. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/coastwatch.py +0 -0
  73. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/dbofs.py +0 -0
  74. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/erddap.py +0 -0
  75. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/hrrr.py +0 -0
  76. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/hrrr_atmosphere.py +0 -0
  77. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/hrrr_levels.py +0 -0
  78. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/hrrr_points.py +0 -0
  79. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/hycom.py +0 -0
  80. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/hydrography.py +0 -0
  81. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/ndbc.py +0 -0
  82. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/necofs.py +0 -0
  83. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/noaa.py +0 -0
  84. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/nwps.py +0 -0
  85. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/nyofs.py +0 -0
  86. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/usgs.py +0 -0
  87. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/fetchers/usgs_rivers.py +0 -0
  88. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/layered_mesh.py +0 -0
  89. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/mesh_frames.py +0 -0
  90. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/ramps/currents_lis.csv +0 -0
  91. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/ramps/currents_lis_dark.csv +0 -0
  92. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/ramps/currents_lis_deep.csv +0 -0
  93. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/ramps/currents_lis_haline.csv +0 -0
  94. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/render.py +0 -0
  95. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/settings.py +0 -0
  96. {forcingkit-0.18.0 → forcingkit-0.18.1}/src/forcingkit/zarr_stream.py +0 -0
  97. {forcingkit-0.18.0 → forcingkit-0.18.1}/static/app.js +0 -0
  98. {forcingkit-0.18.0 → forcingkit-0.18.1}/static/favicon.ico +0 -0
  99. {forcingkit-0.18.0 → forcingkit-0.18.1}/static/favicon.svg +0 -0
  100. {forcingkit-0.18.0 → forcingkit-0.18.1}/static/index.html +0 -0
  101. {forcingkit-0.18.0 → forcingkit-0.18.1}/static/logo.svg +0 -0
  102. {forcingkit-0.18.0 → forcingkit-0.18.1}/static/preview3d.js +0 -0
  103. {forcingkit-0.18.0 → forcingkit-0.18.1}/static/styles.css +0 -0
  104. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/__init__.py +0 -0
  105. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/integration/test_auth.py +0 -0
  106. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/integration/test_erddap_fetch.py +0 -0
  107. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/integration/test_mesh_frames_necofs.py +0 -0
  108. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/integration/test_necofs_volume_live.py +0 -0
  109. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/integration/test_nwps_nomads.py +0 -0
  110. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/integration/test_nyofs_obc_fetch.py +0 -0
  111. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/integration/test_obc_offshore_nj.py +0 -0
  112. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/integration/test_ofs_archive_paths.py +0 -0
  113. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/integration/test_s3_roms_fetchers.py +0 -0
  114. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/scripts/inspect_dem.py +0 -0
  115. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/scripts/inspect_grib.py +0 -0
  116. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/scripts/inspect_zarr.py +0 -0
  117. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_coastwatch.py +0 -0
  118. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_dbofs.py +0 -0
  119. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_dispatcher.py +0 -0
  120. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_erddap.py +0 -0
  121. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_hrrr_atm.py +0 -0
  122. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_hrrr_idx.py +0 -0
  123. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_hrrr_levels.py +0 -0
  124. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_hrrr_points.py +0 -0
  125. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_hycom.py +0 -0
  126. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_jobs.py +0 -0
  127. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_layered_mesh.py +0 -0
  128. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_main.py +0 -0
  129. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_mesh_frames.py +0 -0
  130. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_ndbc.py +0 -0
  131. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_necofs_hindcast.py +0 -0
  132. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_necofs_mesh_cache.py +0 -0
  133. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_necofs_parent.py +0 -0
  134. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_necofs_volume.py +0 -0
  135. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_noaa_currents.py +0 -0
  136. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_noaa_datum.py +0 -0
  137. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_nwps.py +0 -0
  138. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_nyofs.py +0 -0
  139. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_obc_donor_report.py +0 -0
  140. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_obc_pipeline.py +0 -0
  141. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_removed_routes.py +0 -0
  142. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_settings.py +0 -0
  143. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_usgs.py +0 -0
  144. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_usgs_rivers.py +0 -0
  145. {forcingkit-0.18.0 → forcingkit-0.18.1}/tests/unit/test_zarr_stream.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: forcingkit
3
- Version: 0.18.0
3
+ Version: 0.18.1
4
4
  Summary: Spatiotemporal forcing for computational Earth-system models: selects, regrids and serves model-ready time series with provenance.
5
5
  Project-URL: Documentation, https://forcingkit.docs.lhzn.io
6
6
  Project-URL: Issues, https://github.com/lhzn-io/forcingkit/issues
@@ -9,7 +9,7 @@ sys.path.insert(0, os.path.abspath("../../src"))
9
9
  project = "forcingkit"
10
10
  copyright = "2026, Long Horizon Observatory"
11
11
  author = "Daniel Fry"
12
- release = "0.18.0"
12
+ release = "0.18.1"
13
13
 
14
14
  extensions = [
15
15
  "sphinx.ext.autodoc",
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "forcingkit"
7
- version = "0.18.0"
7
+ version = "0.18.1"
8
8
  description = "Spatiotemporal forcing for computational Earth-system models: selects, regrids and serves model-ready time series with provenance."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -14,7 +14,9 @@ lead, with no byte-range index, under a directory for the run's date:
14
14
  ``{base}/today/model_hrdps/...`` is an alias for the current date. The Datamart keeps 30 days of dated directories
15
15
  (MSC's stated retention, which held on 2026-11-09: 2026-10-11 to 2026-11-09 were present). The HPFX server
16
16
  (``https://hpfx.collab.science.gc.ca``) mirrors the same layout and retention with no 24/7 support; pass it as
17
- ``base_url`` if the Datamart is slow. No longer public archive of the GRIB2 files was found, so a record of HRDPS
17
+ ``base_url`` if the Datamart is slow or cannot be reached, with ``client=hpfx_client()``: on 2026-11-10 HPFX did not
18
+ answer a TLS 1.3 handshake that offers ALPN, which httpx always does (no reply within 30 s, every attempt), while it
19
+ answered TLS 1.3 without ALPN and TLS 1.2 with it at once, so ``hpfx_client`` caps TLS at 1.2. No longer public archive of the GRIB2 files was found, so a record of HRDPS
18
20
  scores has to be accumulated from the day collection starts. A run's 48 h files were complete about 3 h after the
19
21
  run time (the 2026-11-09 12 UTC run's PT048H files were posted at 15:08 UTC).
20
22
 
@@ -40,8 +42,10 @@ Canada", with a link to the licence where possible. It grants no right to sugges
40
42
  from __future__ import annotations
41
43
 
42
44
  import concurrent.futures
45
+ import contextlib
43
46
  import logging
44
47
  import os
48
+ import ssl
45
49
  import tempfile
46
50
  import time
47
51
  from typing import Callable, Iterable
@@ -100,6 +104,14 @@ def is_cycle(cycle) -> bool:
100
104
  return cycle == cycle.floor("h") and cycle.hour in CYCLE_HOURS
101
105
 
102
106
 
107
+ def hpfx_client(timeout: float = 120.0) -> httpx.Client:
108
+ """An httpx client for the HPFX server: TLS 1.2 at most (see the module notes). Pass it as ``client`` with
109
+ ``base_url=HPFX_URL``; the caller closes it."""
110
+ ctx = httpx.create_ssl_context()
111
+ ctx.maximum_version = ssl.TLSVersion.TLSv1_2
112
+ return httpx.Client(timeout=timeout, follow_redirects=True, verify=ctx)
113
+
114
+
103
115
  def _exists(client: httpx.Client, url: str) -> bool:
104
116
  r = client.head(url)
105
117
  if r.status_code == 404:
@@ -115,16 +127,18 @@ def newest_cycle(
115
127
  lookback: int = 8,
116
128
  base_url: str = BASE_URL,
117
129
  exists: Callable[[str], bool] | None = None,
130
+ client: httpx.Client | None = None,
118
131
  ) -> pd.Timestamp | None:
119
132
  """The newest run at or before `now` whose `lead` file is published for every field, looking back `lookback`
120
133
  runs (two days by default); None if none is. A run's last lead is posted last, so the default asks for a
121
- complete run."""
134
+ complete run. `client`, if given, makes the requests and is left open (``hpfx_client()`` for HPFX)."""
122
135
  now = _utc_naive(pd.Timestamp.now(tz="UTC") if now is None else now)
123
136
  fields = tuple(fields)
124
137
  cycle = now.floor("6h")
125
- client = None
138
+ own = None
126
139
  if exists is None:
127
- client = httpx.Client(timeout=30.0, follow_redirects=True)
140
+ if client is None:
141
+ client = own = httpx.Client(timeout=30.0, follow_redirects=True)
128
142
  exists = lambda url: _exists(client, url) # noqa: E731
129
143
  try:
130
144
  for _ in range(lookback):
@@ -132,8 +146,8 @@ def newest_cycle(
132
146
  return cycle
133
147
  cycle -= pd.Timedelta(hours=6)
134
148
  finally:
135
- if client is not None:
136
- client.close()
149
+ if own is not None:
150
+ own.close()
137
151
  return None
138
152
 
139
153
 
@@ -327,11 +341,13 @@ def fetch_points(
327
341
  max_km: float = 6.0,
328
342
  max_workers: int = 2,
329
343
  base_url: str = BASE_URL,
344
+ client: httpx.Client | None = None,
330
345
  ) -> pd.DataFrame:
331
346
  """HRDPS forecasts at `points` ({name: (lon, lat)}) for every run and lead, as rows of
332
347
  (issue_time, valid_time, lead_h, point, field, value). Times that are not HRDPS runs, and leads outside 0 to 48,
333
348
  are skipped; so is a lead with any field not (yet) published. At most `max_workers` leads are read at once, and
334
- each keeps only the cells its points use, so memory stays near one decoded field per worker."""
349
+ each keeps only the cells its points use, so memory stays near one decoded field per worker. `client`, if given,
350
+ makes the requests and is left open (``hpfx_client()`` for HPFX)."""
335
351
  fields = tuple(fields)
336
352
  unknown = set(fields) - set(FIELDS)
337
353
  if unknown:
@@ -353,11 +369,15 @@ def fetch_points(
353
369
  rows,
354
370
  columns=["issue_time", "valid_time", "lead_h", "point", "field", "value"],
355
371
  )
356
- with (
357
- tempfile.TemporaryDirectory() as workdir,
358
- httpx.Client(timeout=120.0, follow_redirects=True) as client,
359
- concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as ex,
360
- ):
372
+ with contextlib.ExitStack() as stack:
373
+ if client is None: # our own, closed on the way out; a caller's is left open
374
+ client = stack.enter_context(
375
+ httpx.Client(timeout=120.0, follow_redirects=True)
376
+ )
377
+ workdir = stack.enter_context(tempfile.TemporaryDirectory())
378
+ ex = stack.enter_context(
379
+ concurrent.futures.ThreadPoolExecutor(max_workers=max_workers)
380
+ )
361
381
  cells = _cells(
362
382
  _fetch_land(tasks[0][0], workdir, client, base_url), points, k, max_km
363
383
  )
@@ -180,3 +180,71 @@ def test_one_wind_component_alone_and_unknown_fields_are_refused():
180
180
  hd.fetch_points(
181
181
  ["2026-11-09T12:00"], [1], {"b": (-73.4, 40.8)}, fields=("cape",)
182
182
  )
183
+
184
+
185
+ # ---------- A caller's client, and HPFX's ----------
186
+
187
+
188
+ def test_a_callers_client_is_used_for_every_read_and_left_open(fake, monkeypatch):
189
+ import httpx
190
+
191
+ seen = []
192
+
193
+ def read(client, url, path):
194
+ seen.append((client, url.split("/", 3)[2]))
195
+ return _fake_read(client, url, path)
196
+
197
+ monkeypatch.setattr(hd, "_read_url", read)
198
+ client = httpx.Client()
199
+ df = hd.fetch_points(
200
+ ["2026-11-09T12:00"],
201
+ [0, 1],
202
+ {"buoy": (-73.4, 40.8)},
203
+ fields=("gust",),
204
+ base_url=hd.HPFX_URL,
205
+ client=client,
206
+ )
207
+ assert len(df) == 2
208
+ assert {c for c, _ in seen} == {client} and {h for _, h in seen} == {
209
+ "hpfx.collab.science.gc.ca"
210
+ }
211
+ assert not client.is_closed
212
+ client.close()
213
+
214
+
215
+ def test_newest_cycle_asks_through_a_callers_client():
216
+ import httpx
217
+
218
+ asked = []
219
+
220
+ def handler(request):
221
+ asked.append(request.url.host)
222
+ return httpx.Response(200 if "T06Z" in request.url.path else 404)
223
+
224
+ client = httpx.Client(transport=httpx.MockTransport(handler))
225
+ run = hd.newest_cycle(
226
+ "2026-11-09T13:00", ("u10",), base_url=hd.HPFX_URL, client=client, lookback=3
227
+ )
228
+ assert run == pd.Timestamp("2026-11-09T06:00")
229
+ assert set(asked) == {"hpfx.collab.science.gc.ca"} and len(asked) == 2
230
+ assert not client.is_closed
231
+ client.close()
232
+
233
+
234
+ def test_hpfx_client_caps_tls_at_1_2(monkeypatch):
235
+ import ssl
236
+
237
+ import httpx
238
+
239
+ made = {}
240
+ real = httpx.Client
241
+
242
+ def capture(**kw):
243
+ made.update(kw)
244
+ return real(**kw)
245
+
246
+ monkeypatch.setattr(hd.httpx, "Client", capture)
247
+ with hd.hpfx_client(timeout=30.0):
248
+ pass
249
+ assert made["verify"].maximum_version == ssl.TLSVersion.TLSv1_2
250
+ assert made["timeout"] == 30.0 and made["follow_redirects"]
@@ -1000,7 +1000,7 @@ wheels = [
1000
1000
 
1001
1001
  [[package]]
1002
1002
  name = "forcingkit"
1003
- version = "0.18.0"
1003
+ version = "0.18.1"
1004
1004
  source = { editable = "." }
1005
1005
  dependencies = [
1006
1006
  { name = "bottleneck" },
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
File without changes