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

Method _construct_direct

xarray/core/dataset.py:850–875  ·  view source on GitHub ↗

Shortcut around __init__ for internal use when we want to skip costly validation

(
        cls,
        variables: dict[Any, Variable],
        coord_names: set[Hashable],
        dims: dict[Any, int] | None = None,
        attrs: dict | None = None,
        indexes: dict[Any, Index] | None = None,
        encoding: dict | None = None,
        close: Callable[[], None] | None = None,
    )

Source from the content-addressed store, hash-verified

848
849 @classmethod
850 def _construct_direct(
851 cls,
852 variables: dict[Any, Variable],
853 coord_names: set[Hashable],
854 dims: dict[Any, int] | None = None,
855 attrs: dict | None = None,
856 indexes: dict[Any, Index] | None = None,
857 encoding: dict | None = None,
858 close: Callable[[], None] | None = None,
859 ) -> Self:
860 """Shortcut around __init__ for internal use when we want to skip
861 costly validation
862 """
863 if dims is None:
864 dims = calculate_dimensions(variables)
865 if indexes is None:
866 indexes = {}
867 obj = object.__new__(cls)
868 obj._variables = variables
869 obj._coord_names = coord_names
870 obj._dims = dims
871 obj._indexes = indexes
872 obj._attrs = attrs
873 obj._close = close
874 obj._encoding = encoding
875 return obj
876
877 def _replace(
878 self,

Callers 11

_replaceMethod · 0.95
iselMethod · 0.95
_dask_postcomputeMethod · 0.45
_dask_postpersistMethod · 0.45
mapMethod · 0.45
to_dataarrayMethod · 0.45
from_dataframeMethod · 0.45
_flox_reduceMethod · 0.45
merge_treesFunction · 0.45
mergeFunction · 0.45
_fast_datasetFunction · 0.45

Calls 2

calculate_dimensionsFunction · 0.90
__new__Method · 0.45

Tested by

no test coverage detected