model_catalogs.find_availability#

model_catalogs.find_availability(cat_or_source, model_source=None, override=False, verbose=False)[source]#

Find availability for Catalog or Source.

The code will check for previously-calculated availability. If found, the “freshness” of the information is checked as compared with mc.FRESH parameters specified in __init__.

Start and end datetimes are allowed to be calculated separately to save time.

Note that for unaggregated models with forecasts (currently just model_source “coops-forecast-noagg”), this checks availability for the latest forecast, which goes forward in time from today. It is not possible to use this function to check for the case of a forecast forward in time from a past day.

Parameters:
  • cat_or_source (Intake catalog or source) – Catalog containing model_source sources for which to find availability, or single Source for which to find availability.

  • model_source (str, list of strings, optional) – Specified model_source(s) for which to find the availability for a catalog. If unspecified and cat_or_source is a Catalog, loop over all sources in catalog and find availability for all.

  • override (boolean, optional) – Use override=True to find availability regardless of freshness.

  • verbose (boolean, optional) – If True, start_datetime and end_datetime found for each Source will be printed.

Returns:

If a Catalog was input, a Catalog will be returned; if a Source was input, a Source will be returned. For the single input Source or all Sources in the input Catalog, start_datetime and end_datetime are added to metadata.

Return type:

Intake catalog or source

Examples

Set up source catalog, then find availability for all sources of CIOFS model:

>>> main_cat = mc.setup()
>>> cat = mc.find_availability(main_cat['CIOFS'], model_source=['coops-forecast-agg', 'coops-forecast-noagg'])

Find availability for only model_source “coops-forecast-noagg” of CBOFS model, and print it:

>>> source = mc.find_availability(main_cat['CBOFS']['coops-forecast-noagg'], verbose=True)
coops-forecast-noagg: 2022-08-22 13:00:00 to  2022-09-25 12:00:00