MCPcopy Index your code
hub / github.com/pydata/xarray / _pad_options_dim_to_index

Method _pad_options_dim_to_index

xarray/core/variable.py:1229–1244  ·  view source on GitHub ↗
(
        self,
        pad_option: Mapping[Any, int | float | tuple[int, int] | tuple[float, float]],
        fill_with_shape=False,
    )

Source from the content-addressed store, hash-verified

1227 return result
1228
1229 def _pad_options_dim_to_index(
1230 self,
1231 pad_option: Mapping[Any, int | float | tuple[int, int] | tuple[float, float]],
1232 fill_with_shape=False,
1233 ):
1234 # change number values to a tuple of two of those values
1235 for k, v in pad_option.items():
1236 if isinstance(v, numbers.Number):
1237 pad_option[k] = (v, v)
1238
1239 if fill_with_shape:
1240 return [
1241 pad_option.get(d, (n, n))
1242 for d, n in zip(self.dims, self.shape, strict=True)
1243 ]
1244 return [pad_option.get(d, (0, 0)) for d in self.dims]
1245
1246 def pad(
1247 self,

Callers 1

padMethod · 0.95

Calls 2

itemsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected