def openForRead(cls, filename): """ Factory classmethod to open a JavaSeis dataset for reading. Input: filename - path to JavaSeis dataset directory Output: jsdataset object with file opened """ data = jsdataset() data._reader = jsswig.jsFileReader() data._reader.Init(filename) data.hdrs = {} for hdr in data._reader.getHdrEntries(): data.hdrs[hdr.getName()] = hdr data.axes = () labels = jsswig.StringVector() units = jsswig.StringVector() data._reader.getAxisLabels(labels) data._reader.getAxisUnits(units) for idim in range(0, data._reader.getNDim()): logValues = jsswig.LongVector() data._reader.getAxisLogicalValues(idim, logValues) physValues = jsswig.DoubleVector() data._reader.getAxisPhysicalValues(idim, physValues) newAxis = jsaxis( jsswig.vectorToList(labels)[idim], jsswig.vectorToList(units)[idim], data._reader.getAxisLen(idim), jsswig.vectorToList(logValues), jsswig.vectorToList(physValues)) data.axes = data.axes + (newAxis, ) return data
def test_getAxisPhysicalValues_hypers(self): hypers = jsswig.DoubleVector() fr.getAxisPhysicalValues(4, hypers) hypersL = [hypers[i] for i in range(len(hypers))] assert (hypersL == hyperphysicalvalues)
def test_getAxisPhysicalValues_volumes(self): volumes = jsswig.DoubleVector() fr.getAxisPhysicalValues(3, volumes) volumesL = [volumes[i] for i in range(len(volumes))] assert (volumesL == volumephysicalvalues)
def test_getAxisPhysicalValues_frames(self): frames = jsswig.DoubleVector() fr.getAxisPhysicalValues(2, frames) framesL = [frames[i] for i in range(len(frames))] assert (framesL == framephysicalvalues)
def test_getAxisPhysicalValues_traces(self): traces = jsswig.DoubleVector() fr.getAxisPhysicalValues(1, traces) tracesL = [traces[i] for i in range(len(traces))] assert (tracesL == tracephysicalvalues)
def test_getAxisPhysicalValues_samples(self): samps = jsswig.DoubleVector() fr.getAxisPhysicalValues(0, samps) sampsL = [samps[i] for i in range(len(samps))] assert (sampsL == samplephysicalvalues)