def set(self, other): """ Sets this class according to another python instance of itself """ if isinstance(other, Range): lib.setRange(self.__data__, other.start, other.extent, other.stride) else: raise TypeError("Expects Range")
def denetcdf(self, group, dataname="data"): """ Sets this based on a netcdf group Input: Group of data that can be interpreted as this's information """ r = np.array(group[dataname]) lib.setRange(self.__data__, int(r[0]), int(r[1]), int(r[2]))
def __init__(self, start=0, extent=-1, stride=1): if isinstance(start, c.c_void_p): self.__delete__ = False self.__data__ = start else: self.__delete__ = True self.__data__ = c.c_void_p(lib.createRange()) assert start >= 0 lib.setRange(self.__data__, int(start), int(extent), int(stride))
def stride(self, x): lib.setRange(self.__data__, self.start, self.extent, int(x))
def extent(self, x): lib.setRange(self.__data__, self.start, int(x), self.stride)
def start(self, x): assert x >= 0 lib.setRange(self.__data__, int(x), self.extent, self.stride)