1212
1313def register_engine (token : str , config_class ):
1414 """Class decorator used to register an AncilEngine in
15- ANCIL_ENGINES and to define the config_class class variable. Use
16- like this::
15+ ANCIL_ENGINES and to define the config_class class variable and to
16+ annotate the config_class docstring with a reference to the class.
17+ Use like this::
1718
1819 @cc.register_engine(cc.MyPreciousDataConfig, 'my-precious')
1920 class MyPreciousData(base.AncilEngine):
@@ -23,6 +24,10 @@ class MyPreciousData(base.AncilEngine):
2324 def _deco (cls ):
2425 cls .engine_id = token
2526 cls .config_class = config_class
27+ m , n = config_class .__module__ , config_class .__name__
28+ d = config_class .__doc__
29+ config_class .__doc__ += \
30+ f"\n \n Config class for :class:`{ m } .{ n } `."
2631 ANCIL_ENGINES [token ] = cls
2732 return cls
2833 return _deco
@@ -40,16 +45,30 @@ class AncilEngineConfig:
4045 #: value).
4146 dataset_name : str = None
4247
43- #: Default prefix (directory) for base data archive storage.
48+ #: Prefix (directory name) for base data archive storage. This
49+ #: is intended to be set externally to some top-level storage
50+ #: location for some set of archives.
4451 data_prefix : str = None
52+
53+ #: Directory where data archive should be stored. This is taken
54+ #: relative to data_prefix, unless an absolute path is specified.
55+ #: Subclasses will usually recommend a value.
4556 data_dir : str = None
4657
4758 #: List of "friend" definitions that the class expects to have
4859 #: registered.
4960 friends : field (default_factory = list ) = None
5061
51- #: Test for obsdb query that finds records needing update
62+ #: Format string to use when turning internal field values into
63+ #: obsdb column names. This must be None or else include
64+ #: ``{field}``; it may also include ``{dataset}``, which will
65+ #: be replaced with the ``dataset_name``.
5266 obsdb_format : str = None
67+
68+ #: Query string to use on the obsdb for identifying records that
69+ #: require an update. Instead of field names, put each internal
70+ #: fieldname as a variable (e.g. ``{mean} is null``) and it will be
71+ #: reprocessed according to ``obsdb_format`` spec.
5372 obsdb_query : str = None
5473
5574
@@ -85,7 +104,7 @@ class HkExtractConfig(AncilEngineConfig):
85104 #: defines what fields are extracted and stored in the archive.
86105 aliases : dict = field (default_factory = dict )
87106
88- #: hkdb config filename to target .
107+ #: Config file for accessing the relevant hkdb .
89108 hkdb_config : str = None
90109
91110 #: Number of seconds in each HDF5 base data file.
@@ -108,7 +127,13 @@ class HkExtractConfig(AncilEngineConfig):
108127 dtypes : dict = field (default_factory = dict )
109128
110129
111- # Specific engine config.
130+ #
131+ # Specific engine config classes.
132+ #
133+ # Note that the register_engine decorator will automatically add a
134+ # simple class docstring that links back to the Engine class.
135+ #
136+
112137
113138@dataclass
114139class ApexPwvConfig (LowResTableConfig ):
@@ -118,21 +143,28 @@ class ApexPwvConfig(LowResTableConfig):
118143 obsdb_query : str = '{mean} is null'
119144
120145
146+ @dataclass
147+ class TocoPwvConfig (LowResTableConfig ):
148+ # Overrides.
149+ dataset_name : str = 'toco_pwv'
150+ obsdb_format : str = '{dataset}_{field}'
151+ obsdb_query : str = '{mean} is null and {start} is null and {end} is null'
152+
153+ #: Config file for accessing the site hkdb.
154+ hkdb_config : str = None
155+
156+
121157@dataclass
122158class PwvComboConfig (AncilEngineConfig ):
123159 # Overrides.
124160 dataset_name : str = 'pwv'
125161 obsdb_format : str = '{dataset}_{field}'
126162 obsdb_query : str = '{mean} is null'
127163
164+ #: Name of the friend dataset from which to retrieve Toco
165+ #: radiometer data.
128166 toco_dataset : str = 'toco-pwv'
129- apex_dataset : str = 'apex-pwv'
130-
131167
132- @dataclass
133- class TocoPwvConfig (LowResTableConfig ):
134- obsdb_query : str = '{mean} is null and {start} is null and {end} is null'
135-
136- dataset_name : str = 'toco_pwv'
137- obsdb_format : str = '{dataset}_{field}'
138- hkdb_config : str = None
168+ #: Name of the friend dataset from which to retrieve APEX
169+ #: radiometer data.
170+ apex_dataset : str = 'apex-pwv'
0 commit comments