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

Method info

xarray/core/dataset.py:2438–2472  ·  view source on GitHub ↗

Concise summary of a Dataset variables and attributes. Parameters ---------- buf : file-like, default: sys.stdout writable buffer See Also -------- pandas.DataFrame.assign ncdump : netCDF's ncdump

(self, buf: IO | None = None)

Source from the content-addressed store, hash-verified

2436 return formatting_html.dataset_repr(self)
2437
2438 def info(self, buf: IO | None = None) -> None:
2439 """
2440 Concise summary of a Dataset variables and attributes.
2441
2442 Parameters
2443 ----------
2444 buf : file-like, default: sys.stdout
2445 writable buffer
2446
2447 See Also
2448 --------
2449 pandas.DataFrame.assign
2450 ncdump : netCDF's ncdump
2451 """
2452 if buf is None: # pragma: no cover
2453 buf = sys.stdout
2454
2455 lines = [
2456 "xarray.Dataset {",
2457 "dimensions:",
2458 ]
2459 for name, size in self.sizes.items():
2460 lines.append(f"\t{name} = {size} ;")
2461 lines.append("\nvariables:")
2462 for name, da in self.variables.items():
2463 dims = ", ".join(map(str, da.dims))
2464 lines.append(f"\t{da.dtype} {name}({dims}) ;")
2465 for k, v in da.attrs.items():
2466 lines.append(f"\t\t{name}:{k} = {v} ;")
2467 lines.append("\n// global attributes:")
2468 for k, v in self.attrs.items():
2469 lines.append(f"\t:{k} = {v} ;")
2470 lines.append("}")
2471
2472 buf.write("\n".join(lines))
2473
2474 @property
2475 def chunks(self) -> Mapping[Hashable, tuple[int, ...]]:

Callers 5

walk_moduleFunction · 0.80
mainFunction · 0.80
update_galleryFunction · 0.80
update_videosFunction · 0.80
test_infoMethod · 0.80

Calls 2

itemsMethod · 0.80
joinMethod · 0.45

Tested by 1

test_infoMethod · 0.64