geocat.comp.gc_util._find_var

Contents

geocat.comp.gc_util._find_var#

geocat.comp.gc_util._find_var(ds, standard_name=None, long_name=None, possible_names=None, description='variable')#

Find a variable using CF-compliant checks.

Searches in priority order: 1. CF standard_name attribute match (if standard_names provided) 2. Name attribute match (if long_names provided) 3. Direct variable name match (if possible_names provided)

Parameters:
  • ds (xr.Dataset or ux.UxDataset) – The dataset to search

  • standard_name (str, optional) – CF standard_name to check in attrs

  • long_name (str, optional) – long_name to check in attrs

  • possible_names (list of str, optional) – List of possible variable names to check first

  • description (str, optional) – String for descriptive Error message

Returns:

str – The name of the found variable

Raises:

KeyError – If no matching variable is found