Catalogue¶
envlib.catalogue.Catalogue
¶
RCG-backed catalogue of envlib datasets.
Catalogue() connects to the public envlib RCG (read-only). Pass
remotes=[...] (S3Connection | dict | URL str) to use your own RCGs —
this replaces the public default unless include_public=True.
The catalogue snapshots all entries at construction; call :meth:refresh
to re-pull after new registrations. When a remote is unreachable and a
previously pulled local index exists, the catalogue degrades to the cached
copy (with a warning) instead of failing.
Example
cat = Catalogue(remotes=['https://s3.example.com/bucket/catalogue.rcg']) cat.variables ['streamflow', 'temperature'] refs = cat.query(variable='temperature', feature='atmosphere') ds = refs[0].open()
Source code in envlib/catalogue.py
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | |
aggregation_statistics
property
¶
Distinct aggregation_statistic values present in the catalogue (sorted).
dataset_types
property
¶
Distinct dataset_type values present in the catalogue (sorted).
datasets
property
¶
All catalogue entries as DatasetRef objects.
features
property
¶
Distinct feature values present in the catalogue (sorted).
frequency_intervals
property
¶
Distinct frequency_interval codes present in the catalogue (sorted; None excluded).
licenses
property
¶
Distinct license values present in the catalogue (sorted).
methods
property
¶
Distinct method values present in the catalogue (sorted).
owners
property
¶
Distinct owner values present in the catalogue (sorted).
processing_levels
property
¶
Distinct processing_level values present in the catalogue (sorted).
product_codes
property
¶
Distinct product_code values present in the catalogue (sorted; None excluded — see distinct()).
spatial_resolutions
property
¶
Distinct spatial_resolution values present in the catalogue (sorted; None excluded).
utc_offsets
property
¶
Distinct utc_offset values present in the catalogue (sorted).
variables
property
¶
Distinct variable values present in the catalogue (sorted).
versions
property
¶
Distinct version strings present in the catalogue (sorted).
Version spellings are per-dataset conventions, so this global list mixes unrelated series — mostly useful after narrowing with query().
deregister(dataset_version_id, rcg_remote_conn, *, delete_data=False, access_key_id=None, access_key=None)
¶
Remove a dataset's catalogue entry; optionally delete the hosted data.
Plain deregistration only delists — the hosted data stays up for
existing consumers. delete_data=True (retraction) additionally
deletes the remote cfdb via ebooklet, after verifying no OTHER entry
references the same remote target (the shared-target guard); it needs
the data owner's credentials injected.
Source code in envlib/catalogue.py
distinct(field, *, counts=False)
¶
Distinct stored values of a queryable field across the catalogue.
The browse companion to :meth:query: cat.distinct('variable')
tells you what is actually in this catalogue (the vocabularies module
lists what is valid, and can't help at all for the free-form fields
owner/product_code/version).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
field
|
str
|
Any queryable field (identity fields, |
required |
counts
|
bool
|
When False (default), return a sorted list of the distinct
values, excluding None. When True, return a |
False
|
Source code in envlib/catalogue.py
publish(local_cfdb_path, remote_conn, rcg_remote_conn, num_groups=None, **open_kwargs)
¶
Validate, push the cfdb data to its S3 remote, then register it in the RCG.
The cfdb data is pushed BEFORE the RCG entry so the catalogue never references incomplete remote data. Re-running after a partial failure is safe (the push is idempotent; the entry write is an upsert).
Source code in envlib/catalogue.py
query(*, bbox=None, within_radius=None, geometry=None, start_date=None, end_date=None, **fields)
¶
Filter the catalogue; kwargs are AND'd, a list value means any-of.
Spatial filters (mutually exclusive, EPSG:4326): bbox (intersects),
within_radius (((lon, lat), km) great-circle), geometry
(shapely, intersects). Temporal: start_date/end_date overlap
the dataset's time range. Without an explicit version= kwarg the
latest version (greatest created_at) of each matching dataset is
returned.
Source code in envlib/catalogue.py
refresh()
¶
Re-pull the RCG index from all configured remotes.
Source code in envlib/catalogue.py
register(remote_conn, rcg_remote_conn, **open_kwargs)
¶
Register an already-remote cfdb file in the catalogue (no data push).
remote_conn must be writable (credentials): first registration
writes the self-identification attrs (and any auto-populated
standard_name) into the dataset, pushing that metadata-only change.
Source code in envlib/catalogue.py
validate(local_cfdb_path)
¶
Validate a local cfdb file against envlib's requirements (no RCG or S3 changes).
Returns a summary dict ({'metadata', 'dataset_version_id', 'dataset_id', 'state', 'standard_name'}); raises ValidationError on invalid input.
Source code in envlib/catalogue.py
envlib.catalogue.DatasetRef
¶
A catalogue entry: one dataset version's metadata, plus how to open its cfdb file.
Source code in envlib/catalogue.py
entry
property
¶
The raw RCG entry (entry schema v1: remote_conn, remote_meta, user_meta, ...).
metadata
property
¶
The full envlib metadata dict stored in the catalogue entry.
open(file_path=None, access_key_id=None, access_key=None)
¶
Open this dataset version's cfdb file as a read-only EDataset.
Entries never store credentials. Public-HTTPS datasets open via their
data_url with no credentials; for private buckets inject
access_key_id/access_key. Only inject credentials for entries
whose endpoint/bucket you trust — injected keys sign requests against
the entry's stored endpoint.