Returns a sliced (updated) copy of current data object
        
        :summary: This has the same effect as `obj.copy();obj.update(flag)` but is much less memory consumming.
        
        .. note:: TypeError could arise if some object attributes are setted outside the :func:`__init__` function (eg. for data objects derived from :class:`hydro_data`). If this is the case, initialise these attributes within their respective :func:`__init__`.

def updated_copy(self,flag,deep=True):
        '''
        Returns a sliced (updated) copy of current data object
        
        :summary: This has the same effect as `obj.copy();obj.update(flag)` but is much less memory consumming.
        
        .. note:: TypeError could arise if some object attributes are setted outside the :func:`__init__` function (eg. for data objects derived from :class:`hydro_data`). If this is the case, initialise these attributes within their respective :func:`__init__`.
        
        '''
        
        
        emptyObj=self.__class__([])
        
        if deep : func_copy = copy.deepcopy
        else : func_copy = copy.copy
        
        #Get object attributes from self
        for a in set(self.__dict__.keys()).intersection(emptyObj.__dict__.keys()):
            self.message(4, 'updating attribute %s to returned object' % a)
            emptyObj.__dict__[a] = func_copy(self.__dict__[a])
        
        #Get slices
        for p in set(self.__dict__.keys()).difference(emptyObj.__dict__.keys()):
            self.message(4, 'updating parameter %s to returned object' % p)
            try :
                #Save additionnal attributes
                attrlist=list(set(dir(self.__dict__[p])).difference(dir(np.ma.array(0))))
                attrvalues=[self.__dict__[p].__dict__[l] for l in attrlist]
                attr=attrStr(attrlist,attrvalues)
                emptyObj.__dict__[p] = func_copy(self.__dict__[p][flag])
                for a in attr.keys(): setattr(emptyObj.__dict__[p], a, attr[a])
            except TypeError:
                self.warning(1,'Could not slice %s - check if this attribute is in self.__init__')
            
        #update dimensions
        N=flag.sum()
        emptyObj._dimensions['time']=N
        emptyObj.count=N
        
#         self.message(4, "Checking variables consistency")
#         emptyObj.check_variables()
        
        return emptyObj