envlib-ingest-base 0.4.2__tar.gz → 0.5.0__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.
- {envlib_ingest_base-0.4.2 → envlib_ingest_base-0.5.0}/PKG-INFO +9 -9
- {envlib_ingest_base-0.4.2 → envlib_ingest_base-0.5.0}/README.md +5 -5
- {envlib_ingest_base-0.4.2 → envlib_ingest_base-0.5.0}/envlib_ingest_base/__init__.py +1 -1
- {envlib_ingest_base-0.4.2 → envlib_ingest_base-0.5.0}/envlib_ingest_base/tsforecast.py +7 -6
- {envlib_ingest_base-0.4.2 → envlib_ingest_base-0.5.0}/envlib_ingest_base/tsortho.py +12 -12
- {envlib_ingest_base-0.4.2 → envlib_ingest_base-0.5.0}/pyproject.toml +5 -3
- {envlib_ingest_base-0.4.2 → envlib_ingest_base-0.5.0}/.gitignore +0 -0
- {envlib_ingest_base-0.4.2 → envlib_ingest_base-0.5.0}/LICENSE +0 -0
- {envlib_ingest_base-0.4.2 → envlib_ingest_base-0.5.0}/envlib_ingest_base/resample.py +0 -0
- {envlib_ingest_base-0.4.2 → envlib_ingest_base-0.5.0}/envlib_ingest_base/stations.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: envlib-ingest-base
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Shared toolkit for envlib data-ingest repos: source-agnostic time-series resampling and ts_ortho (station) dataset build + idempotent commons update.
|
|
5
5
|
Project-URL: Source, https://github.com/envlib/envlib-ingest-base
|
|
6
6
|
Author-email: mullenkamp <mullenkamp1@gmail.com>
|
|
@@ -9,9 +9,9 @@ License-File: LICENSE
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
10
|
Requires-Python: >=3.10
|
|
11
11
|
Requires-Dist: booklet>=0.12.10
|
|
12
|
-
Requires-Dist: cfdb>=0.
|
|
13
|
-
Requires-Dist: ebooklet>=0.
|
|
14
|
-
Requires-Dist: envlib>=0.1.
|
|
12
|
+
Requires-Dist: cfdb>=0.11.0
|
|
13
|
+
Requires-Dist: ebooklet>=0.11.0
|
|
14
|
+
Requires-Dist: envlib>=0.1.8
|
|
15
15
|
Requires-Dist: numpy
|
|
16
16
|
Requires-Dist: sentry-sdk
|
|
17
17
|
Requires-Dist: shapely>=2.0
|
|
@@ -413,12 +413,12 @@ update_and_publish(cat, 'flow.cfdb', member, rcg, stations, series_recent,
|
|
|
413
413
|
variable='streamflow')
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
-
**Remote storage layout**: by default (`
|
|
416
|
+
**Remote storage layout**: by default (`group_bytes=None`) each chunk is its own S3 object —
|
|
417
417
|
the right choice for continuously-updated ts_ortho datasets (tens of keys; every hourly
|
|
418
|
-
push/pull moves exactly the changed chunk and nothing else). Grouped storage
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
418
|
+
push/pull moves exactly the changed chunk and nothing else). Grouped storage (`group_bytes=<int>`,
|
|
419
|
+
ebooklet ≥ 0.11) packs chunks in write order into group objects of up to that many bytes; it suits
|
|
420
|
+
**large archives**, including ones that grow by appending (an append uploads the new chunks plus at
|
|
421
|
+
most one partly filled group). The choice is fixed once the dataset is first pushed. For how chunk size and shape
|
|
422
422
|
trade off on each layout (request costs, per-station vs multi-station chunks), see cfdb's
|
|
423
423
|
[Chunk sizes for remote datasets](https://mullenkamp.github.io/cfdb/guide/s3-remote/#chunk-sizes-for-remote-datasets).
|
|
424
424
|
|
|
@@ -394,12 +394,12 @@ update_and_publish(cat, 'flow.cfdb', member, rcg, stations, series_recent,
|
|
|
394
394
|
variable='streamflow')
|
|
395
395
|
```
|
|
396
396
|
|
|
397
|
-
**Remote storage layout**: by default (`
|
|
397
|
+
**Remote storage layout**: by default (`group_bytes=None`) each chunk is its own S3 object —
|
|
398
398
|
the right choice for continuously-updated ts_ortho datasets (tens of keys; every hourly
|
|
399
|
-
push/pull moves exactly the changed chunk and nothing else). Grouped storage
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
399
|
+
push/pull moves exactly the changed chunk and nothing else). Grouped storage (`group_bytes=<int>`,
|
|
400
|
+
ebooklet ≥ 0.11) packs chunks in write order into group objects of up to that many bytes; it suits
|
|
401
|
+
**large archives**, including ones that grow by appending (an append uploads the new chunks plus at
|
|
402
|
+
most one partly filled group). The choice is fixed once the dataset is first pushed. For how chunk size and shape
|
|
403
403
|
trade off on each layout (request costs, per-station vs multi-station chunks), see cfdb's
|
|
404
404
|
[Chunk sizes for remote datasets](https://mullenkamp.github.io/cfdb/guide/s3-remote/#chunk-sizes-for-remote-datasets).
|
|
405
405
|
|
|
@@ -11,7 +11,7 @@ from envlib_ingest_base.tsforecast import build_and_push, merge_run, update_and_
|
|
|
11
11
|
from envlib_ingest_base.tsforecast import build_local as build_forecast_local
|
|
12
12
|
from envlib_ingest_base.tsortho import build_and_publish, build_local, merge_dataset, update_and_publish
|
|
13
13
|
|
|
14
|
-
__version__ = '0.
|
|
14
|
+
__version__ = '0.5.0'
|
|
15
15
|
__all__ = [
|
|
16
16
|
'build_and_publish',
|
|
17
17
|
'build_and_push',
|
|
@@ -456,7 +456,7 @@ def merge_run(ds, stations: dict, run: dict, *, variable: str, overwrite: bool =
|
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
|
|
459
|
-
def build_and_push(member_conn, path, meta, stations: dict, run: dict, *,
|
|
459
|
+
def build_and_push(member_conn, path, meta, stations: dict, run: dict, *, group_bytes=None, **build_kwargs):
|
|
460
460
|
"""First run: build the local ``ts_forecast`` and push it to its S3 remote.
|
|
461
461
|
|
|
462
462
|
There is deliberately **no catalogue here**. A forecast archive of a commercial provider's
|
|
@@ -465,17 +465,18 @@ def build_and_push(member_conn, path, meta, stations: dict, run: dict, *, num_gr
|
|
|
465
465
|
``envlib.validate_dataset`` in ``build_local``, so the dataset carries CV-validated identity
|
|
466
466
|
fields and is trivially promotable later if that ever changes.
|
|
467
467
|
|
|
468
|
-
``
|
|
469
|
-
is one small chunk, and every push moves exactly the run that changed
|
|
468
|
+
``group_bytes=None`` (per-key objects) is right for a continuously-appended archive: each run
|
|
469
|
+
is one small chunk, and every push moves exactly the run that changed (a grouped remote would
|
|
470
|
+
re-upload its partly filled last group on every run).
|
|
470
471
|
"""
|
|
471
472
|
build_local(path, meta, stations, run, **build_kwargs)
|
|
472
|
-
with open_edataset(member_conn, str(path), flag='w',
|
|
473
|
+
with open_edataset(member_conn, str(path), flag='w', group_bytes=group_bytes) as eds:
|
|
473
474
|
result = eds.push()
|
|
474
475
|
return {'path': str(path), 'push': result}
|
|
475
476
|
|
|
476
477
|
|
|
477
478
|
def update_and_push(
|
|
478
|
-
member_conn, path, stations: dict, run: dict, *, variable: str, overwrite: bool = False
|
|
479
|
+
member_conn, path, stations: dict, run: dict, *, variable: str, overwrite: bool = False
|
|
479
480
|
):
|
|
480
481
|
"""Incremental run: pull the remote, merge one run, push.
|
|
481
482
|
|
|
@@ -484,7 +485,7 @@ def update_and_push(
|
|
|
484
485
|
on every run and wants a periodic ``ds.prune()``, AFTER the push (pruning is local-only and
|
|
485
486
|
preserves key timestamps, so it cannot inflate the next push).
|
|
486
487
|
"""
|
|
487
|
-
with open_edataset(member_conn, str(path), flag='w'
|
|
488
|
+
with open_edataset(member_conn, str(path), flag='w') as ds: # the existing remote's storage mode
|
|
488
489
|
report = merge_run(ds, stations, run, variable=variable, overwrite=overwrite)
|
|
489
490
|
result = ds.push()
|
|
490
491
|
return {'merge': report, 'push': result}
|
|
@@ -660,15 +660,15 @@ def merge_dataset(ds, stations: dict, series: dict, *, variable: str):
|
|
|
660
660
|
}
|
|
661
661
|
|
|
662
662
|
|
|
663
|
-
def build_and_publish(cat, path, member_conn, rcg_conn, meta, stations, series, *,
|
|
663
|
+
def build_and_publish(cat, path, member_conn, rcg_conn, meta, stations, series, *, group_bytes=None, **build_kwargs):
|
|
664
664
|
"""First publish: build a local ts_ortho cfdb and publish it to the commons (data then RCG entry).
|
|
665
665
|
|
|
666
|
-
``
|
|
666
|
+
``group_bytes=None`` (default) stores each chunk as its own S3 object — the right choice
|
|
667
667
|
for continuously-updated ts_ortho datasets (small key counts, frequent single-chunk
|
|
668
|
-
updates: every push
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
The
|
|
668
|
+
updates: every push moves exactly the changed chunks, with no partly filled group to
|
|
669
|
+
re-upload). Pass an int (bytes per group; ebooklet's default is 32 MiB) for grouped
|
|
670
|
+
storage, which packs chunks in write order and suits large archives that grow by
|
|
671
|
+
appending. The mode is fixed at first publish.
|
|
672
672
|
|
|
673
673
|
``**build_kwargs`` go straight to ``build_local`` — including ``ancillary=`` to declare
|
|
674
674
|
companion ``(point, time)`` planes (e.g. a per-timestep quality grade), whose data rides in
|
|
@@ -676,17 +676,17 @@ def build_and_publish(cat, path, member_conn, rcg_conn, meta, stations, series,
|
|
|
676
676
|
the roster is read back from the stored dataset's ``ancillary_variables`` attr.
|
|
677
677
|
"""
|
|
678
678
|
build_local(path, meta, stations, series, **build_kwargs)
|
|
679
|
-
return cat.publish(str(path), member_conn, rcg_conn,
|
|
679
|
+
return cat.publish(str(path), member_conn, rcg_conn, group_bytes=group_bytes)
|
|
680
680
|
|
|
681
681
|
|
|
682
|
-
def update_and_publish(cat, path, member_conn, rcg_conn, stations, series, *, variable
|
|
682
|
+
def update_and_publish(cat, path, member_conn, rcg_conn, stations, series, *, variable):
|
|
683
683
|
"""Incremental update: pull the remote, merge the recent window, then publish (diff + entry refresh).
|
|
684
684
|
|
|
685
685
|
``path`` is a local working cache linked to ``member_conn``; the merge reads only the coords +
|
|
686
|
-
the affected time block, so no full-remote materialization is required.
|
|
687
|
-
|
|
686
|
+
the affected time block, so no full-remote materialization is required. The storage mode is
|
|
687
|
+
the existing remote's (fixed at first publish), so none is passed here.
|
|
688
688
|
"""
|
|
689
|
-
with open_edataset(member_conn, str(path), flag='w'
|
|
689
|
+
with open_edataset(member_conn, str(path), flag='w') as ds:
|
|
690
690
|
report = merge_dataset(ds, stations, series, variable=variable)
|
|
691
|
-
result = cat.publish(str(path), member_conn, rcg_conn
|
|
691
|
+
result = cat.publish(str(path), member_conn, rcg_conn)
|
|
692
692
|
return {'merge': report, 'publish': result}
|
|
@@ -20,15 +20,17 @@ dependencies = [
|
|
|
20
20
|
# validation entry point, which does not exist before it. Raised in the SAME commit as the code
|
|
21
21
|
# that needs it -- 0.1.5 satisfies the old ">=0.1.5" floor, so an in-place upgrade would keep it
|
|
22
22
|
# and the failure would surface as an AttributeError far from its cause.
|
|
23
|
-
|
|
23
|
+
# >=0.1.8 (with cfdb/ebooklet >=0.11): publish() and open_edataset take group_bytes, which
|
|
24
|
+
# build_and_publish/build_and_push now pass; num_groups is gone.
|
|
25
|
+
"envlib>=0.1.8",
|
|
24
26
|
# >=0.9.4 is a HARD floor: older cfdb fabricates values when its packed encoder meets
|
|
25
27
|
# NaN/out-of-range data (cfdb changelog 0.9.4); tsortho also enforces this at runtime.
|
|
26
28
|
# >=0.10.0: cfdb 0.10 writes byte-shuffled compression (zstd_shuffle) by default, which an older
|
|
27
29
|
# cfdb cannot open. The toolkit also READS existing datasets (update/merge paths pull the remote),
|
|
28
30
|
# so it must be able to open whatever another producer on 0.10 published. Existing datasets keep
|
|
29
31
|
# their recorded compression when updated; only newly built ones are shuffled.
|
|
30
|
-
"cfdb>=0.
|
|
31
|
-
"ebooklet>=0.
|
|
32
|
+
"cfdb>=0.11.0",
|
|
33
|
+
"ebooklet>=0.11.0",
|
|
32
34
|
"numpy",
|
|
33
35
|
"shapely>=2.0",
|
|
34
36
|
"sentry-sdk",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|