def test_loadtxt(): from flopy.utils.flopy_io import loadtxt pthfile = os.path.join(path, 'EXAMPLE-3.pathline') pthld = PathlineFile(pthfile) ra = loadtxt(pthfile, delimiter=' ', skiprows=3, dtype=pthld.dtype) ra2 = loadtxt(pthfile, delimiter=' ', skiprows=3, dtype=pthld.dtype, use_pandas=False) assert np.array_equal(ra, ra2)
def __init__(self, filename, verbose=False): """ Class constructor. """ self.fname = filename self.dtype, self.outdtype = self._get_dtypes() self._build_index() self._data = loadtxt(self.file, dtype=self.dtype, skiprows=self.skiprows) # set number of particle ids self.nid = self._data['particleid'].max() # convert layer, row, and column indices; particle id and group; and # line segment indices to zero-based for n in self.kijnames: self._data[n] -= 1 # close the input file self.file.close() return