BdsApi  3.0.5
This is the Blacknest BDS API.
BdsDataFileSeed.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BdsDataFileSeed.h SEED Data File Access
3  * T.Barnaby, BEAM Ltd, 2009-12-18
4  *******************************************************************************
5  */
6 #ifndef BdsDataFileSeed_H
7 #define BdsDataFileSeed_H
8 
9 #include <BdsDataFile.h>
10 #include <BdsSeedTypes.h>
11 #include <BMutex.h>
12 #include <libmseed-beam/libmseed.h>
13 #include <libmseed-beam/unpackdata.h>
14 
15 namespace Bds {
16 
18 class DataFileSeed : public DataFile{
19 public:
20  DataFileSeed();
21  ~DataFileSeed();
22 
23  BError close();
24 
26  int getFeatures();
29 
30  // Read routines
31  BError getInfo(DataInfo& dataInfo, DataFileOptions options, BList<DataError>& errors);
32  BError readData(BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock& data);
33  BError getMetaData(ChannelInfos& channelInfos, BUInt32 options, BList<DataError>& errors);
34 
35  // Write routines
36  BError setInfo(const DataInfo& dataInfo, const ChannelInfos& channelInfos, WriteOptionsList options = WriteOptionSensorData);
37  BError start(BUInt channel, BUInt segment);
39  BError end();
40 
41  void msrFileWrite(void* data, int len);
42 
43  static DataFormats getFormats();
44  static BError omsrErr;
45  static int onoLock;
46 
47 private:
48  BError processControl();
49  BError processBlockette();
50  BError processData(DataBlock& data, int addInfo);
51  BError setBlockSize(BUInt blockSize);
52  BError readBlockData(char* buf, BUInt numBytes);
53  BError readBlock(BUInt64 blockPosition, char& type, char& cont, BUInt& seq);
54  BError writeVolumeHeader(int rl);
55  BError writeTimeSpans();
56  BError writeBlockData(char type, const char* buf, BUInt numBytes);
57  BError writeFlush();
58  BString unitsConvert(BString units);
59  int getChannel(BString name);
60  void sortChannels();
61  DataError getBlockReorderInfo();
62 
63  int addCode(BString str);
64  int addUnitCode(BString str);
65  Response* getResponse(BUInt stage);
66 
67  DataFileOptions oreadOptions;
68  DataInfo odataInfo;
69  BString onetwork;
70  ChannelInfos ochannelInfos;
71  BArray<ChannelInfo> ochannelInfoSegments;
72  ChannelInfo ochannelInfo;
73  double osampleRate;
74  BArray<BArray<DataBlockPos> > oblockPositions;
75 
76  BUInt32 oblockSize;
77  char* oblock;
78  BUInt64 oblockPosition;
79  BUInt opos;
80  BUInt oblockNumberRead;
81  BUInt oblockNumberWrite;
82  BUInt oblocketteNumber;
83  BUInt ologNumber;
84 
85  // SEED information
86  BDictString ocodes;
87  BDictString ounitCodes;
88 
89  // SEED import information
90  BdsSeedType10 otype10;
91  BdsSeedType11 otype11;
92  BdsSeedType30 otype30;
93  BdsSeedType52 otype52;
94  BArray<BdsSeedType30> oseedDataFormats;
95  BArray<BdsSeedStation> oseedStations;
96  BArray<BdsSeedType52> oseedChannels;
97 
98  BArray<BString> odataChannels;
99  BArray<int> odataChannelFormats;
100 
101  // SEED export information
102  BArray<BInt32> odataInt32;
103  BArray<BFloat32> odataFloat32;
104 
105  BUInt odataChannel;
106  BUInt odataSegment;
107  BUInt odataTimeSpanBlock;
108  BDict<int> ostationBlockNumbers;
109  BArray<BArray<BUInt32> > odataStartBlocks;
110  BArray<BArray<BUInt32> > odataEndBlocks;
111 
112  static BMutex olock;
113  MSRecord* omsr;
114 };
115 
116 }
117 #endif
BUInt32 format
BUInt32 BUInt
uint32_t BUInt32
uint64_t BUInt64
char data[8]
This class provides information on a channel.
Definition: BdsD.h:525
This class provides metadata information on a set of channels.
Definition: BdsD.h:547
This class provides the actual seismic data values contained within a single data block.
Definition: BdsD.h:690
This stores a data error. It includes and error number and a string as well as information on what se...
Definition: BdsLib.h:35
This defines a list of BDS data converter options.
Definition: BdsDataFile.h:30
Data file convertor for SEED file formats.
Definition: BdsDataFileSeed.h:18
BError close()
Close the file.
Definition: BdsDataFileSeed.cpp:167
static BError omsrErr
MSR processing error.
Definition: BdsDataFileSeed.h:44
BError writeData(const DataBlock &data)
Write a block of data.
Definition: BdsDataFileSeed.cpp:1264
void msrFileWrite(void *data, int len)
Definition: BdsDataFileSeed.cpp:1162
BError end()
End write segment.
Definition: BdsDataFileSeed.cpp:1237
BError getInfo(DataInfo &dataInfo, DataFileOptions options, BList< DataError > &errors)
Get info on data.
Definition: BdsDataFileSeed.cpp:278
BError setFormat(BString format)
Set the sub-format.
Definition: BdsDataFileSeed.cpp:206
BError setInfo(const DataInfo &dataInfo, const ChannelInfos &channelInfos, WriteOptionsList options=WriteOptionSensorData)
Set information on data for write.
Definition: BdsDataFileSeed.cpp:551
BError start(BUInt channel, BUInt segment)
Start writing next segment of data.
Definition: BdsDataFileSeed.cpp:1178
BError readData(BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock &data)
Read a block.
Definition: BdsDataFileSeed.cpp:440
BError getMetaData(ChannelInfos &channelInfos, BUInt32 options, BList< DataError > &errors)
Return all known MetaData in the file.
Definition: BdsDataFileSeed.cpp:527
DataFileSeed()
Definition: BdsDataFileSeed.cpp:133
static DataFormats getFormats()
Definition: BdsDataFileSeed.cpp:42
BString getFixesInfo()
Get readable list of fixes that can be applied to faulty data files.
Definition: BdsDataFileSeed.cpp:194
~DataFileSeed()
Definition: BdsDataFileSeed.cpp:155
int getFeatures()
Get bitmask of supported features.
Definition: BdsDataFileSeed.cpp:186
static int onoLock
Disable libmseed locking.
Definition: BdsDataFileSeed.h:45
DataOrder getDataOrder()
Get the expected order of writing data, by sample or by channel.
Definition: BdsDataFileSeed.cpp:190
This class defines the interface for generic data file access that all of the BDS data converters sha...
Definition: BdsDataFile.h:41
DataOrder
Definition: BdsDataFile.h:43
WriteOptionsList
Definition: BdsDataFile.h:45
@ WriteOptionSensorData
Definition: BdsDataFile.h:45
This class defines information on a set of data.
Definition: BdsD.h:623
This class defines a seismic Response characteristic.
Definition: BdsD.h:304
Definition: BdsC.cc:8