def __setattr__(self, key, value):
    if (key == 'free_format_input'):
        super().__setattr__(key, value)
    elif (key == 'name'):
        self._set_name(value)
    elif (key == 'model_ws'):
        self.change_model_ws(value)
    elif ((key == 'sr') and (value.__class__.__name__ == 'SpatialReference')):
        warnings.warn('SpatialReference has been deprecated.', category=DeprecationWarning)
        if (self.dis is not None):
            self.dis.sr = value
        else:
            raise Exception('cannot set SpatialReference - ModflowDis not found')
    elif (key == 'tr'):
        assert isinstance(value, discretization.reference.TemporalReference)
        if (self.dis is not None):
            self.dis.tr = value
        else:
            raise Exception('cannot set TemporalReference - ModflowDis not found')
    elif (key == 'start_datetime'):
        if (self.dis is not None):
            self.dis.start_datetime = value
            self.tr.start_datetime = value
        else:
            raise Exception('cannot set start_datetime - ModflowDis not found')
    else:
        super().__setattr__(key, value)
def __setattr__(self, key, value):
    if (key == 'free_format_input'):
        super().__setattr__(key, value)
    elif (key == 'name'):
        self._set_name(value)
    elif (key == 'model_ws'):
        self.change_model_ws(value)
    elif ((key == 'sr') and (value.__class__.__name__ == 'SpatialReference')):
        warnings.warn('SpatialReference has been deprecated.', category=DeprecationWarning)
        if (self.dis is not None):
            self.dis.sr = value
        else:
            raise Exception('cannot set SpatialReference - ModflowDis not found')
    elif (key == 'tr'):
        assert isinstance(value, discretization.reference.TemporalReference)
        if (self.dis is not None):
            self.dis.tr = value
        else:
            raise Exception('cannot set TemporalReference - ModflowDis not found')
    elif (key == 'start_datetime'):
        if (self.dis is not None):
            self.dis.start_datetime = value
            self.tr.start_datetime = value
        else:
            raise Exception('cannot set start_datetime - ModflowDis not found')
    else:
        super().__setattr__(key, value)