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
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 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 | |
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, verify_objects=True, **open_kwargs)
¶
Validate, push the cfdb data to its S3 remote, verify it, then register it in the RCG.
The cfdb data is pushed BEFORE the RCG entry so the catalogue never
references incomplete remote data. With verify_objects (default True),
after the push and before the entry is written the remote is fsck'd, and a
silent over-claim (the committed index references objects the store does not
actually hold) raises PublishIntegrityError so a broken dataset is never
advertised. A re-run after a LOUD push failure is safe (idempotent push,
upsert entry); a re-run after a SILENT over-claim does NOT heal it - recover
by retract + full republish (see _verify_remote_objects).
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, verify_objects=True, **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.
Thin wrapper over the module-level :func:validate_dataset, which needs no Catalogue
and no network -- prefer that one when you are not publishing.
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.