MCPcopy
hub / github.com/pydata/xarray / cf_decoder

Function cf_decoder

xarray/conventions.py:604–647  ·  view source on GitHub ↗

Decode a set of CF encoded variables and attributes. Parameters ---------- variables : dict A dictionary mapping from variable name to xarray.Variable attributes : dict A dictionary mapping from attribute name to value concat_characters : bool Should

(
    variables: T_Variables,
    attributes: T_Attrs,
    concat_characters: bool = True,
    mask_and_scale: bool = True,
    decode_times: bool | CFDatetimeCoder | Mapping[str, bool | CFDatetimeCoder] = True,
)

Source from the content-addressed store, hash-verified

602
603
604def cf_decoder(
605 variables: T_Variables,
606 attributes: T_Attrs,
607 concat_characters: bool = True,
608 mask_and_scale: bool = True,
609 decode_times: bool | CFDatetimeCoder | Mapping[str, bool | CFDatetimeCoder] = True,
610) -> tuple[T_Variables, T_Attrs]:
611 """
612 Decode a set of CF encoded variables and attributes.
613
614 Parameters
615 ----------
616 variables : dict
617 A dictionary mapping from variable name to xarray.Variable
618 attributes : dict
619 A dictionary mapping from attribute name to value
620 concat_characters : bool
621 Should character arrays be concatenated to strings, for
622 example: ["h", "e", "l", "l", "o"] -> "hello"
623 mask_and_scale : bool
624 Lazily scale (using scale_factor and add_offset) and mask
625 (using _FillValue).
626 decode_times : bool | CFDatetimeCoder | Mapping[str, bool | CFDatetimeCoder]
627 Decode cf times ("hours since 2000-01-01") to np.datetime64.
628
629 Returns
630 -------
631 decoded_variables : dict
632 A dictionary mapping from variable name to xarray.Variable objects.
633 decoded_attributes : dict
634 A dictionary mapping from attribute name to values.
635
636 See Also
637 --------
638 decode_cf_variable
639 """
640 variables, attributes, _ = decode_cf_variables(
641 variables,
642 attributes,
643 concat_characters,
644 mask_and_scale,
645 decode_times,
646 )
647 return variables, attributes
648
649
650def _encode_coordinates(

Callers

nothing calls this directly

Calls 1

decode_cf_variablesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…