You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Open an intake catalog file and set up code to apply processing/transform.
131
+
132
+
Optionally calculate the boundaries of the model represented in cat_log.
131
133
132
134
Parameters
133
135
----------
134
136
cat_loc : str, Catalog
135
-
Can be the name of a subcatalog in `intake.cat` that has been installed or can be the path to a catalog.
136
-
save_catalog : bool, optional
137
-
Defaults to True, and saves to cat_path.
137
+
The catalog to open. cat_loc can be the representation of a path to a catalog file (string or Path) or it can be a Catalog object.
138
138
return_cat : bool, optional
139
-
Return catalog.
139
+
Return catalog from function. Defaults to True.
140
+
save_catalog : bool, optional
141
+
Defaults to False, and saves to mc.CACHE_PATH_COMPILED(model).
140
142
override : boolean, optional
141
-
Use `override=True` to compile the catalog files together regardless of freshness.
143
+
Use `override=True` to calculate boundaries of the model regardless of whether the file already exists.
142
144
boundaries : boolean, optional
143
-
If True, find or calculate domain boundary of model.
145
+
If True, find previously-saved or calculate domain boundary of model.
146
+
save_boundaries : bool, optional
147
+
Defaults to False, and saves to mc.FILE_PATH_BOUNDARIES(model).
144
148
"""
145
149
146
150
ifisinstance(cat_loc, Catalog):
@@ -179,7 +183,7 @@ def open_catalog(cat_loc, return_cat=True, save_catalog=False, override=False, b
179
183
full_cat_metadata=cat_orig.metadata,
180
184
cat_driver=mc.process.DatasetTransform,
181
185
cat_path=mc.CACHE_PATH_COMPILED,
182
-
save_catalog=True,
186
+
save_catalog=save_catalog,
183
187
return_cat=True,
184
188
)
185
189
@@ -189,35 +193,46 @@ def open_catalog(cat_loc, return_cat=True, save_catalog=False, override=False, b
189
193
190
194
defsetup(locs="mc_", override=False):
191
195
"""Setup reference catalogs for models.
192
-
193
-
Loops over hard-wired "orig" catalogs available in ``mc.CAT_PATH_ORIG``, reads in previously-saved model boundary information, saves temporary catalog files for each model, and links those together into the returned master catalog. For some models, reading in the original catalogs applies a "today" and/or "yesterday" date Intake user parameter that supplies two example model files that can be used for examining the model output for the example times. Those are rerun each time this function is rerun, filling the parameters using the proper dates.
196
+
197
+
Loops over catalogs that have been previously installed as data packages to intake that start with the string(s) in locs. The default is to read in the required GOODS model catalogs which are prefixed with "mc_". Alternatively, one or more local catalog files can be input as strings or Paths.
198
+
199
+
This function calls ``open_catalog`` which reads in previously-saved model boundary information (or calculates it if not available) and saves temporary catalog files for each model (called "compiled"), then this function links those together into the returned main catalog. For some models, reading in the original catalogs applies a "today" and/or "yesterday" date Intake user parameter that supplies two example model files that can be used for examining the model output for the example times. Those are rerun each time this function is rerun, filling the parameters using the proper dates.
194
200
195
201
Parameters
196
202
----------
197
-
locs : str, list
198
-
The name of a catalog in the default intake catalog `intake.cat`.
203
+
locs : str, Path, list
204
+
This can be:
205
+
206
+
* a string or Path describing where a Catalog file is located
207
+
* a string of the prefix for selecting catalogs from the default intake catalog, ``intake.cat``. It is expected to be of the form "PREFIX_CATALOGNAME" with an underscore at the end followed by the catalog name, and there could be many catalogs with that "PREFIX_" set up.
208
+
* a list of a combination of the previous options.
209
+
199
210
override : boolean, optional
200
211
Use `override=True` to compile the catalog files together regardless of freshness.
201
212
202
213
Returns
203
214
-------
204
215
Intake catalog
205
-
Nested Intake catalog with a catalog for each model in ``mc.CAT_PATH_ORIG``. Each model in turn has one or more model_source available (e.g., "coops-forecast-agg", "coops-forecast-noagg").
216
+
Nested Intake catalog with a catalog for each input option. Each model in turn has one or more model_source available (e.g., "coops-forecast-agg", "coops-forecast-noagg").
206
217
207
218
Examples
208
219
--------
209
220
210
-
Set up master catalog:
221
+
Set up main catalog:
211
222
212
-
>>> cat = mc.setup()
223
+
>>> main_cat = mc.setup()
213
224
214
225
Examine list of models available in catalog:
215
226
216
-
>>> list(cat)
227
+
>>> list(main_cat)
217
228
218
229
Examine the model_sources for a specific model in the catalog:
219
230
220
-
>>> list(cat['CBOFS'])
231
+
>>> list(main_cat['CBOFS'])
232
+
233
+
Separate from ``model_catalogs`` you can check the default Intake catalog with:
0 commit comments