BDS Public
BdsApi 4.0.1
This is the Blacknest BDS API.
Loading...
Searching...
No Matches
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
16namespace Bds {
17
18const int NetworkNameLen = 3;
19const int StationNameLen = 5;
20const int ChannelTypeLen = 3;
21const int ChannelAuxLen = 2;
22const int SourceLen = 16;
23
25class ResponseObj : public Response {
26public:
27 ResponseObj(const Response& response);
29
31 void setString(BString str);
32};
33
35class DataError {
36public:
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
54public:
66};
67
68
72
73// Bds Channel name manipulations
74void bdsChannelGetTypeAux(BString name, BString& type, BString& aux);
76
77// Bds Data Meta data manipulations
79BError bdsDataInfoFromInfo(BDictString info, DataInfo& dataInfo, Bool append = 0);
80BError bdsInfoFromDataInfo(const DataInfo& dataInfo, BDictString& info);
82BError bdsDataInfoMergeFlatten(DataInfo& dataInfo, const DataInfo& dataInfoAdd);
84BError bdsDataInfoFromChannelInfos(const ChannelInfos& channelInfos, DataInfo& dataInfo);
85
86BError bdsMetadataImportFix(ChannelInfos& channelInfos, BString& changedMessage, Bool stageRenumber);
87BError bdsMetadataExportFix(ChannelInfos& channelInfos, BString& changedMessage, Bool singleResponse, Bool stageRenumber, Bool changeUnits, Bool stageGains, Bool decimation, Bool toDisplacement, Bool toNm);
88
90BString bdsDataChannelInfo(const DataChannel& dataChannel);
91BString bdsDataChannelRef(const DataChannel& dataChannel);
92BString bdsDataChannelRef(const ChannelInfo& channelInfo);
93BError bdsDataChannelOverallResponse(const ChannelInfo& channelInfo, Response& response);
94BString bdsSelectionChannelInfo(const Selection& selection, BUInt channel);
95BString bdsFileNameExpand(BString fileName, ChannelInfo& channelInfo);
96BString bdsFileNameExpand(BString fileName, ChannelInfos& channelInfos);
98
99// BDS Metadata higher level functionality
100void bdsSpecialChannelsSet(const BList<SpecialChannel> specialChannels);
102Bool bdsSpecialChannelIgnore(BString network, BString station, BString channel);
103char seedChannelInstrumentCode(BString dataType);
108
109// Calculations
110double bdsPoleZeroGain(const PoleZero& poleZero, double frequency);
111void bdsPoleZeroGainPhase(const PoleZero& poleZero, double frequency, double& gain, double& phase);
112void bdsPoleZeroToFap(const PoleZero& poleZero, BUInt nPoints, double calibrationFrequency, double sampleFrequency, BArray<Fap>& fap);
113
114// Bds Debug functions
115void bdsDumpSelection(Selection sel);
117void bdsDumpDataInfo(DataInfo dataInfo, int includeInfo = 0);
118void bdsDumpChannelInfos(const ChannelInfos& channelInfos);
119void bdsDumpData(const DataBlock& dataBlock, int nSamples = 0);
120void bdsDumpPoleZeros(PoleZero poleZeros);
121void bdsDumpLocation(Location location);
122
123}
124#endif
BUInt32 BUInt
bool Bool
int32_t BInt32
BOAP data class definitions for: Bds.
This is the AdminAccess Access API interface.
Definition BdsC.h:189
This class provides full Metadata information on a channel.
Definition BdsD.h:544
This class provides Metadata information on a set of channels.
Definition BdsD.h:566
This is the Data Access API interface to the BDS system.
Definition BdsC.h:26
This is the DataAdd Access API interface.
Definition BdsC.h:106
This class provides the actual Sensor data values contained within a single data block.
Definition BdsD.h:710
This class defines information on a single channel's set of data stored in a file.
Definition BdsD.h:607
This stores a data error. It includes and error number and a string as well as information on what se...
Definition BdsLib.h:35
BString osource
The data Source.
Definition BdsLib.h:64
BString getTitle() const
Get the title.
Definition BdsLib.cpp:103
BString odescription
The description.
Definition BdsLib.h:57
int num() const
Get The error number.
Definition BdsLib.cpp:162
BString ofilename
The import filename;.
Definition BdsLib.h:58
BTimeStamp oendTime
The end Time.
Definition BdsLib.h:60
BError setStringUser(BString str, BString user)
Set from string given by user on command line.
Definition BdsLib.cpp:145
DataError()
Definition BdsLib.cpp:41
BString ochannel
The channel name.
Definition BdsLib.h:63
BString getString() const
Get error message.
Definition BdsLib.cpp:156
DataError & set(int errorNumber, BString title, BString importFilename, BTimeStamp startTime, BTimeStamp endTime, DataInfo &dataInfo, BUInt channel, BString description, BString user="")
Definition BdsLib.cpp:49
BError setString(BString str)
Set from string.
Definition BdsLib.cpp:111
BString onetwork
The network Name.
Definition BdsLib.h:61
int getErrorNumber() const
Get The error number.
Definition BdsLib.cpp:99
BString ouser
The user.
Definition BdsLib.h:65
BInt32 oerrorNumber
Error number.
Definition BdsLib.h:55
void mergeDataInfo(const DataInfo &dataInfo, BUInt channel)
Definition BdsLib.cpp:67
BString otitle
The title.
Definition BdsLib.h:56
BString ostation
The station/array name.
Definition BdsLib.h:62
const char * str() const
Return a char* string.
Definition BdsLib.cpp:166
BTimeStamp ostartTime
The start Time.
Definition BdsLib.h:59
This class defines information on a set of data.
Definition BdsD.h:643
This class defines the physical location of a Station.
Definition BdsD.h:207
This class defines a Pole/Zero Response.
Definition BdsD.h:233
Response object adding string conversion.
Definition BdsLib.h:25
BString getString()
Definition BdsLib.cpp:22
~ResponseObj()
Definition BdsLib.cpp:19
void setString(BString str)
Definition BdsLib.cpp:37
This class defines a seismic Response characteristic.
Definition BdsD.h:313
This class defines the set of Metadata or Siesmic sensor data to be selected when getSelectionInfo() ...
Definition BdsD.h:483
This class defines a generic Metadata or Sensor data selection.
Definition BdsD.h:517
This class defines a seismic station.
Definition BdsD.h:189
Definition BdsC.cc:8
BString bdsUnitsConvert(BString units)
Tidy up units name to standard SI units format.
Definition BdsLib.cpp:593
BString bdsDataChannelInfo(const DataChannel &dataChannel)
Returns a string representation of a DataChannel object.
Definition BdsLib.cpp:1133
BString bdsUnitCase(BString unit)
Converts character case of units.
Definition BdsLib.cpp:1508
void bdsPoleZeroGainPhase(const PoleZero &poleZero, double frequency, double &gain, double &phase)
Calculates the overall gain and phase of the given PoleZero transfer function.
Definition BdsLib.cpp:1193
Bool bdsSpecialChannelIgnore(BString network, BString station, BString channel)
Check if channel should be ignored.
Definition BdsLib.cpp:1411
const int ChannelAuxLen
Maximum Channel Aux length.
Definition BdsLib.h:21
BError bdsDataInfoFlatten(DataInfo &dataInfo)
Flattens a DataInfo to 1 segement per channel for use in dataOpen() calls.
Definition BdsLib.cpp:502
BError bdsLibInit(DataAccess &bds)
Initialise the bdsLib with settings from the BdsServer.
Definition BdsLib.cpp:171
const int SourceLen
Maximum Source length.
Definition BdsLib.h:22
BString bdsChannelGetName(BString type, BString aux)
Create a full channel name from a channels type and aux fields.
Definition BdsLib.cpp:217
BString seedChannelDataType(BString channel)
Returns dataType from channel name based on SEED channel name convention.
Definition BdsLib.cpp:1476
const int StationNameLen
Maximum Station name length.
Definition BdsLib.h:19
BStringList bdsUnits()
Returns all known SI units.
Definition BdsLib.cpp:1502
BString bdsDataChannelRef(const DataChannel &dataChannel)
Returns the string reference name of a DataChannel object.
Definition BdsLib.cpp:1138
const int NetworkNameLen
Maximum Network name length.
Definition BdsLib.h:18
BStringList bdsDataTypes()
Returns all known data types.
Definition BdsLib.cpp:1489
BError bdsDataChannelOverallResponse(const ChannelInfo &channelInfo, Response &response)
Returns the overal response from the list of responses in a ChannelInfo.
Definition BdsLib.cpp:1146
BError bdsMetadataImportFix(ChannelInfos &channelInfos, BString &changedMessage, Bool stageRenumber)
Fix up ChannelInfos from import. Mainly making sure response stages and their units are correct.
Definition BdsLib.cpp:658
void bdsSpecialChannelsSet(const BList< SpecialChannel > specialChannels)
Set the special channels list.
Definition BdsLib.cpp:1395
BString bdsSelectionChannelInfo(const Selection &selection, BUInt channel)
Returns a string describing the name and time period of a selection channel.
Definition BdsLib.cpp:1169
void bdsDumpDataInfo(DataInfo dataInfo, int includeInfo)
Debug print out a DataInfo object.
Definition BdsLib.cpp:1021
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:523
BString bdsFileNameExpand(BString fileName, ChannelInfo &channelInfo)
Default filename from a ChannelInfo.
Definition BdsLib.cpp:1251
BString bdsStationAlias(Station station)
Returns the station alias if set else its name.
Definition BdsLib.cpp:949
void bdsDumpLocation(Location location)
Debug printout location.
Definition BdsLib.cpp:1129
void bdsDumpPoleZeros(PoleZero poleZeros)
Debug print out a PoleZeros object.
Definition BdsLib.cpp:201
BError bdsMetadataExportFix(ChannelInfos &channelInfos, BString &changedMessage, Bool singleResponse, Bool stageRenumber, Bool changeUnits, Bool stageGains, Bool decimation, Bool toDisplacement, Bool toNm)
Fix up ChannelInfos for export. Mainly making sure response stages and their units are correct.
Definition BdsLib.cpp:730
void bdsPoleZeroToFap(const PoleZero &poleZero, BUInt nPoints, double calibrationFrequency, double sampleFrequency, BArray< Fap > &fap)
Convert PoleZero to FAP.
Definition BdsLib.cpp:1213
BError bdsDataInfoFromInfo(BDictString info, DataInfo &dataInfo, Bool append)
Convert info to DataInfo.
Definition BdsLib.cpp:247
const int ChannelTypeLen
Maximum Channel type name length.
Definition BdsLib.h:20
void bdsDumpSelectionInfo(SelectionInfo sel)
Debug print out a SelectionInfo object.
Definition BdsLib.cpp:982
void bdsChannelGetTypeAux(BString name, BString &type, BString &aux)
Get the channel type and aux fields from a generic channel name.
Definition BdsLib.cpp:210
BList< SpecialChannel > bdsSpecialChannels()
Return list of special channels.
Definition BdsLib.cpp:1399
void bdsDumpSelection(Selection sel)
Debug print out a Selection object.
Definition BdsLib.cpp:956
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:225
void bdsDumpChannelInfos(const ChannelInfos &channelInfos)
Debug print out a ChannelInfos object.
Definition BdsLib.cpp:1071
BError bdsInfoFromDataInfo(const DataInfo &dataInfo, BDictString &info)
Converts a DataInfo object into a BDictString list of named strings.
Definition BdsLib.cpp:372
BError bdsDataInfoFromChannelInfos(const ChannelInfos &channelInfos, DataInfo &dataInfo)
Sets up a Datainfo object from ChannelInfos.
Definition BdsLib.cpp:614
void bdsDumpData(const DataBlock &dataBlock, int nSamples)
Debug print out a DataBlock object.
Definition BdsLib.cpp:1105
char seedChannelInstrumentCode(BString dataType)
Returns SEED instrument code from dataType.
Definition BdsLib.cpp:1463
double bdsPoleZeroGain(const PoleZero &poleZero, double frequency)
Calculates the overall gain of the given PoleZero transfer function.
Definition BdsLib.cpp:1176