polaris.ocean.global_stats_names.select_global_stats
- polaris.ocean.global_stats_names.select_global_stats(ds, fields, stats, model, field_map=None, time_mean_period=None, log=None, source='the global statistics output', hint=None)[source]
Intersect the requested (field, statistic) pairs with what a dataset holds
A simulation writes some subset of the fields and statistics that were asked for, and which subset is not something the person asking controls, so a pair that is absent is reported and dropped rather than raised on. A field with no surviving statistics is dropped entirely. Only a dataset with none of the requested variables raises, since that is not a simulation writing a subset but a step reading the wrong thing.
- Parameters:
ds (xarray.Dataset) – The global statistics, with the names the model gave them
fields – As for
global_stats_var_names()model – As for
global_stats_var_names()field_map – As for
global_stats_var_names()time_mean_period – As for
global_stats_var_names()stats (list of str or None) – The statistics to look for, or
Nonefor every statistic this model computeslog (callable, optional) – Where to report each pair that was dropped, typically
step.logger.info. The default reports nothing.source (str, optional) – A short description of what was read, for the message when nothing was found
hint (str, optional) – What to check when nothing was found, appended to that message
- Returns:
found (dict of str to dict of str to str) – The variable name of each statistic that is present, by field, in the order the fields and the statistics were given
- Raises:
ValueError – If none of the requested variables is in
ds