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

Method set_attribute

xarray/backends/netCDF4_.py:609–616  ·  view source on GitHub ↗
(self, key, value)

Source from the content-addressed store, hash-verified

607 self.ds.createDimension(name, size=dim_length)
608
609 def set_attribute(self, key, value):
610 if self.format != "NETCDF4":
611 value = encode_nc3_attr_value(value)
612 if _is_list_of_strings(value):
613 # encode as NC_STRING if attr is list of strings
614 self.ds.setncattr_string(key, value)
615 else:
616 self.ds.setncattr(key, value)
617
618 def encode_variable(self, variable, name=None):
619 variable = _force_native_endianness(variable)

Callers

nothing calls this directly

Calls 2

encode_nc3_attr_valueFunction · 0.90
_is_list_of_stringsFunction · 0.85

Tested by

no test coverage detected