class_docstr: Attributes
  ----------
  _data : recarray
      Underlying data, as a record array.
  _mask : boolean array
      Mask of the records. A record is masked when all its fields are
      masked.
  _fieldmask : boolean recarray
      Record array of booleans, setting the mask of each individual field
      of each record.
  _fill_value : record
      Filling values for each field.
class_docstr_tok: ["Attributes","--","--","--","--","--","_data",":","recarray","Underlying","data",",","as","a","record","array",".","_mask",":","boolean","array","Mask","of","the","records",".","A","record","is","masked","when","all","its","fields","are","masked",".","_fieldmask",":","boolean","recarray","Record","array","of","booleans",",","setting","the","mask","of","each","individual","field","of","each","record",".","_fill_value",":","record","Filling","values","for","each","field","."]
docstr: Sets the attribute attr to the value val.
docstr_tok: ["Sets","the","attribute","attr","to","the","value","val","."]
code: def __setattr__(self, attr, val):
      """
      Sets the attribute attr to the value val.
  
      """
      # Should we call __setmask__ first ?
      if attr in ["mask", "fieldmask"]:
          self.__setmask__(val)
          return
      # Create a shortcut (so that we don't have to call getattr all the time)
      _localdict = object.__getattribute__(self, "__dict__")
      # Check whether we're creating a new field
      newattr = attr not in _localdict
      try:
          # Is attr a generic attribute ?
          ret = object.__setattr__(self, attr, val)
      except Exception:
          # Not a generic attribute: exit if it's not a valid field
          fielddict = (
              ndarray.__getattribute__(self, "dtype").fields or {}
          )
          optinfo = ndarray.__getattribute__(self, "_optinfo") or {}
          if not (attr in fielddict or attr in optinfo):
              raise
      else:
          # Get the list of names
          fielddict = (
              ndarray.__getattribute__(self, "dtype").fields or {}
          )
          # Check the attribute
          if attr not in fielddict:
              return ret
          if newattr:
              # We just added this one or this setattr worked on an
              # internal attribute.
              try:
                  object.__delattr__(self, attr)
              except Exception:
                  return ret
      # Let's try to set the field
      try:
          res = fielddict[attr][:2]
      except (TypeError, KeyError) as e:
          raise AttributeError(
              f"record array has no attribute {attr}"
          ) from e
  
      if val is masked:
          _fill_value = _localdict["_fill_value"]
          if _fill_value is not None:
              dval = _localdict["_fill_value"][attr]
          else:
              dval = val
          mval = True
      else:
          dval = filled(val)
          mval = getmaskarray(val)
      obj = ndarray.__getattribute__(self, "_data").setfield(dval, *res)
      _localdict["_mask"].__setitem__(attr, mval)
      return obj
  
imports: from numpy.ma import MAError, MaskedArray, masked, nomask, masked_array, getdata, getmaskarray, filled
  import numpy.ma
  import warnings
  import numpy
  from numpy import bool_, dtype, ndarray, recarray, array
  from numpy.core.records import fromarrays, fromrecords
label_desc: Use image node_id 7 for calling the MaskedRecords obj's underlying member method code with example usage: obj.__setattr__(attr, val) and returns: obj, ret, ret