BdsApi  2.2.7
This is the Blacknest BDS API.
BdsLib.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BdsLib.h Data File Access
3  * T.Barnaby, BEAM Ltd, 2008-12-03
4  *******************************************************************************
5  */
9 #ifndef BdsLib_H
10 #define BdsLib_H
11 
12 #include <BdsD.h>
13 #include <BdsC.h>
14 #include <BString.h>
15 
16 namespace Bds {
17 
18 const int NetworkNameLen = 3;
19 const int StationNameLen = 5;
20 const int ChannelTypeLen = 3;
21 const int ChannelAuxLen = 2;
22 const int SourceLen = 16;
23 
25 class ResponseObj : public Response {
26 public:
27  ResponseObj(const Response& response);
28  ~ResponseObj();
29 
31  void setString(BString str);
32 };
33 
35 class DataError {
36 public:
37  DataError();
38  DataError(int errorNumber, BString title, BString filename, BTimeStamp startTime, BTimeStamp endTime, DataInfo& dataInfo, BUInt channel, BString description, BString user = "");
39  DataError& set(int errorNumber, BString title, BString importFilename, BTimeStamp startTime, BTimeStamp endTime, DataInfo& dataInfo, BUInt channel, BString description, BString user = "");
40  void mergeDataInfo(const DataInfo& dataInfo, BUInt channel);
41 
42  int getErrorNumber() const;
43  BString getTitle() const;
44 
47  BString getString() const;
48 
49  int num() const;
50  const char* str() const;
51 
52  operator int() const;
53 
54 public:
66 };
67 
68 // Bds Channel name manipulations
69 void bdsChannelGetTypeAux(BString name, BString& type, BString& aux);
71 
72 // Bds Data Meta data manipulations
74 BError bdsDataInfoFromInfo(BDictString info, DataInfo& dataInfo, Bool append = 0);
75 BError bdsInfoFromDataInfo(const DataInfo& dataInfo, BDictString& info);
77 BError bdsDataInfoMergeFlatten(DataInfo& dataInfo, const DataInfo& dataInfoAdd);
78 
79 
81 BString bdsDataChannelInfo(const DataChannel& dataChannel);
82 BString bdsDataChannelRef(const DataChannel& dataChannel);
83 BString bdsDataChannelRef(const ChannelInfo& channelInfo);
84 BError bdsDataChannelOverallResponse(const ChannelInfo& channelInfo, Response& response);
85 BString bdsSelectionChannelInfo(const Selection& selection, BUInt channel);
86 BString bdsFileNameExpand(BString fileName, ChannelInfo& channelInfo);
87 BString bdsFileNameExpand(BString fileName, ChannelInfos& channelInfos);
88 
89 // BDS Metadata higher level functionality
91 Bool bdsSpecialChannelIgnore(BString network, BString station, BString channel);
92 char seedChannelInstrumentCode(BString dataType);
94 
95 // Calculations
96 double bdsPoleZeroGain(const PoleZero& poleZero, double frequency);
97 void bdsPoleZeroGainPhase(const PoleZero& poleZero, double frequency, double& gain, double& phase);
98 void bdsPoleZeroToFap(const PoleZero& poleZero, BUInt nPoints, double calibrationFrequency, double sampleFrequency, BArray<Fap>& fap);
99 
100 // Bds Debug functions
101 void bdsDumpSelection(Selection sel);
102 void bdsDumpDataInfo(DataInfo dataInfo, int includeInfo = 0);
103 void bdsDumpChannelInfos(const ChannelInfos& channelInfos);
104 void bdsDumpData(const DataBlock& dataBlock, int nSamples = 0);
105 void bdsDumpPoleZeros(PoleZero poleZeros);
106 void bdsDumpLocation(Location location);
107 
108 }
109 #endif
BError
Bds::ResponseObj::ResponseObj
ResponseObj(const Response &response)
Definition: BdsLib.cpp:14
Bds::DataError::osource
BString osource
The data Source.
Definition: BdsLib.h:64
Bds::bdsChannelGetTypeAux
void bdsChannelGetTypeAux(BString name, BString &type, BString &aux)
Get the channel type and aux fields from a generic channel name.
Definition: BdsLib.cpp:180
Bds::DataChannel
This class defines information on a single channels set of data stored in a file.
Definition: BdsD.h:538
Bds::bdsDataChannelInfo
BString bdsDataChannelInfo(const DataChannel &dataChannel)
Returns a string representation of a DataChannel object.
Definition: BdsLib.cpp:692
Bds::bdsDataChannelOverallResponse
BError bdsDataChannelOverallResponse(const ChannelInfo &channelInfo, Response &response)
Returns the overal response from the list of responses in a ChannelInfo.
Definition: BdsLib.cpp:705
Bds::Station
This class defines a seismic station.
Definition: BdsD.h:181
Bds::DataError::ochannel
BString ochannel
The channel name.
Definition: BdsLib.h:63
Bds::DataError::oerrorNumber
BInt32 oerrorNumber
Error number.
Definition: BdsLib.h:55
Bds::DataError::otitle
BString otitle
The title.
Definition: BdsLib.h:56
Bds::bdsDumpSelection
void bdsDumpSelection(Selection sel)
Debug print out a Selection object.
Definition: BdsLib.cpp:564
BUInt
BUInt32 BUInt
BArray
Bds::PoleZero
This class defines a Pole/Zero Response.
Definition: BdsD.h:221
Bds::bdsSelectionChannelInfo
BString bdsSelectionChannelInfo(const Selection &selection, BUInt channel)
Returns a string describing the name and time period of a selection channel.
Definition: BdsLib.cpp:718
Bds::DataError::ouser
BString ouser
The user.
Definition: BdsLib.h:65
Bds::seedChannelInstrumentCode
char seedChannelInstrumentCode(BString dataType)
Returns SEED instrument code from dataType.
Definition: BdsLib.cpp:939
Bds::bdsFileNameExpand
BString bdsFileNameExpand(BString fileName, ChannelInfo &channelInfo)
Default filename from a ChannelInfo.
Definition: BdsLib.cpp:800
Bds::bdsDumpDataInfo
void bdsDumpDataInfo(DataInfo dataInfo, int includeInfo)
Debug print out a DataInfo object.
Definition: BdsLib.cpp:587
Bds::bdsDataInfoMergeFlatten
BError bdsDataInfoMergeFlatten(DataInfo &dataInfo, const DataInfo &dataInfoAdd)
Merges a DataInfo into another flattening the segments to 1 for use in dataOpen() calls.
Definition: BdsLib.cpp:487
Bds::bdsSpecialChannelIgnore
Bool bdsSpecialChannelIgnore(BString network, BString station, BString channel)
Check if channel should be ignored.
Definition: BdsLib.cpp:888
Bds::DataError::ofilename
BString ofilename
The import filename;.
Definition: BdsLib.h:58
Bds::NetworkNameLen
const int NetworkNameLen
Maximum Network name length.
Definition: BdsLib.h:18
Bds::ResponseObj::~ResponseObj
~ResponseObj()
Definition: BdsLib.cpp:17
Bds::DataBlock
This class provides the acual seismic data values contained within a single data block.
Definition: BdsD.h:640
Bds::DataError::getErrorNumber
int getErrorNumber() const
Get The error number.
Definition: BdsLib.cpp:97
Bds::DataError::ostartTime
BTimeStamp ostartTime
The start Time.
Definition: BdsLib.h:59
Bds::Response
This class defines a seismic Response characteristic.
Definition: BdsD.h:269
Bds::DataError::getTitle
BString getTitle() const
Get the title.
Definition: BdsLib.cpp:101
Bds::seedChannelDataType
BString seedChannelDataType(BString channel)
Returns dataType from channel name based on SEED channel name convention.
Definition: BdsLib.cpp:952
Bds::DataError::setString
BError setString(BString str)
Set from string.
Definition: BdsLib.cpp:109
Bds::bdsPoleZeroGainPhase
void bdsPoleZeroGainPhase(const PoleZero &poleZero, double frequency, double &gain, double &phase)
Calculates the overal gain and phase of the given PoleZero transfer function.
Definition: BdsLib.cpp:742
Bds
Definition: BdsC.cc:8
Bds::DataError::DataError
DataError()
Definition: BdsLib.cpp:39
Bds::DataError
This stores a data error. It includes and error number and a string as well as information on what se...
Definition: BdsLib.h:35
Bds::bdsPoleZeroToFap
void bdsPoleZeroToFap(const PoleZero &poleZero, BUInt nPoints, double calibrationFrequency, double sampleFrequency, BArray< Fap > &fap)
Convert PoleZero to FAP.
Definition: BdsLib.cpp:762
BString
Bds::bdsDataInfoFromInfo
BError bdsDataInfoFromInfo(BDictString info, DataInfo &dataInfo, Bool append)
Convert info to DataInfo.
Definition: BdsLib.cpp:217
Bds::ChannelTypeLen
const int ChannelTypeLen
Maximum Channel type name length.
Definition: BdsLib.h:20
Bds::DataError::onetwork
BString onetwork
The network Name.
Definition: BdsLib.h:61
BDict
Bds::ResponseObj::getString
BString getString()
Definition: BdsLib.cpp:20
Bds::DataInfo
This class defines information on a set of data.
Definition: BdsD.h:573
Bds::ResponseObj
Response object adding string conversion.
Definition: BdsLib.h:25
Bds::bdsDumpData
void bdsDumpData(const DataBlock &dataBlock, int nSamples)
Debug print out a DataBlock object.
Definition: BdsLib.cpp:664
Bool
bool Bool
Bds::bdsDumpPoleZeros
void bdsDumpPoleZeros(PoleZero poleZeros)
Debug print out a PoleZeros object.
Definition: BdsLib.cpp:171
Bds::Selection
This class defines a generic metadata or seismic data selection.
Definition: BdsD.h:456
Bds::DataError::mergeDataInfo
void mergeDataInfo(const DataInfo &dataInfo, BUInt channel)
Definition: BdsLib.cpp:65
Bds::Location
This class defines the physical location of a Station.
Definition: BdsD.h:196
BString.h
Bds::bdsChannelGetName
BString bdsChannelGetName(BString type, BString aux)
Create a full channel name from a channels type and aux fields.
Definition: BdsLib.cpp:187
Bds::bdsPoleZeroGain
double bdsPoleZeroGain(const PoleZero &poleZero, double frequency)
Calculates the overal gain of the given PoleZero transfer function.
Definition: BdsLib.cpp:725
Bds::bdsDataInfoSetTimeRange
BError bdsDataInfoSetTimeRange(DataInfo &dataInfo)
Restricts the time tange of all of the DataInfo's channels to match the DataInfo's startTime/endTime ...
Definition: BdsLib.cpp:195
Bds::DataError::setStringUser
BError setStringUser(BString str, BString user)
Set from string given by user on command line.
Definition: BdsLib.cpp:143
BTimeStamp
Bds::DataError::num
int num() const
Get The error number.
Definition: BdsLib.cpp:160
Bds::ChannelAuxLen
const int ChannelAuxLen
Maximum Channel Aux length.
Definition: BdsLib.h:21
Bds::DataError::getString
BString getString() const
Get error message.
Definition: BdsLib.cpp:154
Bds::bdsDumpLocation
void bdsDumpLocation(Location location)
Debug printout location.
Definition: BdsLib.cpp:688
BdsD.h
BOAP data class definitions for: Bds.
Bds::bdsStationAlias
BString bdsStationAlias(Station station)
Returns the station alias if set else its name.
Definition: BdsLib.cpp:557
Bds::bdsDumpChannelInfos
void bdsDumpChannelInfos(const ChannelInfos &channelInfos)
Debug print out a ChannelInfos object.
Definition: BdsLib.cpp:636
Bds::ChannelInfo
This class provides information on a channel.
Definition: BdsD.h:477
Bds::DataError::odescription
BString odescription
The description.
Definition: BdsLib.h:57
Bds::DataError::str
const char * str() const
Return a char* string.
Definition: BdsLib.cpp:164
BdsC.h
Bds::bdsInfoFromDataInfo
BError bdsInfoFromDataInfo(const DataInfo &dataInfo, BDictString &info)
Converts a DataInfo object into a BDictString list of named strings.
Definition: BdsLib.cpp:339
Bds::StationNameLen
const int StationNameLen
Maximum Station name length.
Definition: BdsLib.h:19
Bds::bdsSpecialChannels
BList< SpecialChannel > bdsSpecialChannels()
Return list of special channels.
Definition: BdsLib.cpp:880
Bds::bdsDataChannelRef
BString bdsDataChannelRef(const DataChannel &dataChannel)
Returns the string reference name of a DataChannel object.
Definition: BdsLib.cpp:697
Bds::bdsDataInfoFlatten
BError bdsDataInfoFlatten(DataInfo &dataInfo)
Flattens a DataInfo to 1 segement per channel for use in dataOpen() calls.
Definition: BdsLib.cpp:466
Bds::DataError::ostation
BString ostation
The station/array name.
Definition: BdsLib.h:62
BList
BInt32
int32_t BInt32
Bds::ResponseObj::setString
void setString(BString str)
Definition: BdsLib.cpp:35
Bds::DataError::set
DataError & set(int errorNumber, BString title, BString importFilename, BTimeStamp startTime, BTimeStamp endTime, DataInfo &dataInfo, BUInt channel, BString description, BString user="")
Definition: BdsLib.cpp:47
Bds::SourceLen
const int SourceLen
Maximum Source length.
Definition: BdsLib.h:22
Bds::DataError::oendTime
BTimeStamp oendTime
The end Time.
Definition: BdsLib.h:60
Bds::ChannelInfos
This class provides metadata information on a set of channels.
Definition: BdsD.h:499