Class for reading BIT log files.
Typical usage:
BitFileReader reader = new BitFileReader(new FileInfo("path/to/file.BIT"));
IList<BitFile> bitFiles = reader.Read(true);
If the curve data is not needed, it is possible to read only the metadata from the disk file. The curve data may be filled in later:
BitFileReader reader = new BitFileReader(new FileInfo("path/to/file.BIT"));
IList<BitFile> bitFiles = reader.Read(false);
reader.ReadData(bitFiles);
Note that even if only metadata is read, all sub-files and curve information are properly established as this information comes from metadata. Only the curve values will be missing.
- Author
- Petroware AS
static double IsBitFile |
( |
FileInfo | file, |
|
|
byte[] | content ) |
|
static |
Get the probability that the specified file is a BIT file.
The check can be done with or without considering the content of the file. In the latter case, only the file name (typically its extension) is considered. In the former case a portion from the start of the file is used to match for known patterns. By passing the portion as an argument, the client code can read this once and then pass it to different classifiers in order to determine its most likely type.
Getting a portion of a file can be done by:
FileInfo file = ...;
BinaryReader reader = new BinaryReader(file.OpenRead());
byte[] content = new byte[2000]; //say
reader.Read(content, 0, content.Length);
reader.Close();
- Parameters
-
file | File to check. Null to classify on content only. |
content | A number of bytes from the start of the file. Null to classify on file name only. |
- Returns
- Probability that the file is a BIT file. [0.0,1.0].
void ReadData |
( |
IList< BitFile > | bitFiles | ) |
|
Read data from a set of BIT files where the metadata has already been read.
This will preserve the existing BitFile structure in case a BIT file is read in two operations:
// Read metadata
IList<BitFile> bitFiles = reader.Read(false);
// Read the curve data
reader.ReadData(bitFiles);
There is nothing to gain in performance with this approach so in case the result is not cached, the following will be equivalent:
// Read metadata
List<BitFile> bitFiles = reader.Read(false);
// Read the curve data
bitFiles = reader.Read(true);
- Parameters
-
bitFiles | BIT files to populate with curve data. |
- Exceptions
-
ArgumentNullException | If bitFiles is null. |
ArgumentException | If bitFiles is incompatible with the present disk file. |