(#541) Fixed a couple of bugs in NRLib/LasWell. Made export possible.

Had to add a default constructor to be able to export to a LAS file from
scratch (not based on an existing LAS file). Also corrected a bug in
LasWell::WriteToFile() and LasWell::ParseInformation(). Reading a LAS
file exported from LasWell was not possible before the bug fixes.
This commit is contained in:
Pål Hagen 2015-10-15 08:18:14 +02:00
parent 10046eed4a
commit 972d8fe5e0
2 changed files with 18 additions and 5 deletions

View File

@ -32,6 +32,16 @@
using namespace NRLib;
LasWell::LasWell() :
version_("Unknown"),
wrap_(false),
comma_delimited_(false),
depth_unit_("Unknown"),
start_depth_(0),
stop_depth_(0),
depth_increment_(0)
{
}
LasWell::LasWell(const std::string & filename) :
version_("Unknown"),
@ -171,11 +181,11 @@ LasWell::ParseInformation(std::vector<std::string> & info,
getline (fin,line);
line = NRLib::Chomp(line);
if (line[0] == '~') {
end_of_section = true;
continue;
if (line.size() == 0 || line[0] == '#') {
continue;
}
else if (line[0] == '#') {
else if (line[0] == '~') {
end_of_section = true;
continue;
}
else {
@ -480,7 +490,7 @@ void LasWell::WriteToFile(const std::string & filename,
//Parameter information. Only what is read from file; may add Set-functions.
file << "~Parameter information\n";
for(size_t i=0;i<version_info_.size();i++)
for(size_t i=0;i<parameter_info_.size();i++)
file << parameter_info_[i] << "\n";
file << "\n";

View File

@ -39,6 +39,9 @@ public:
Time
};
// Default constructor added to be able to export from scratch
LasWell();
/// Constructor with relevant parameters.
LasWell(const std::string & filename);