NRLib/nrlib/well/well.hpp
Go to the documentation of this file.
1// $Id: well.hpp 883 2011-09-26 09:17:05Z perroe $
2
3// Copyright (c) 2011, Norwegian Computing Center
4// All rights reserved.
5// Redistribution and use in source and binary forms, with or without modification,
6// are permitted provided that the following conditions are met:
7// • Redistributions of source code must retain the above copyright notice, this
8// list of conditions and the following disclaimer.
9// • Redistributions in binary form must reproduce the above copyright notice, this list of
10// conditions and the following disclaimer in the documentation and/or other materials
11// provided with the distribution.
12// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
13// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
15// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
17// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
18// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
20// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21
22#ifndef NRLIB_WELL_HPP
23#define NRLIB_WELL_HPP
24
25#include <vector>
26#include <sstream>
27#include <map>
28
29namespace NRLib {
30 class Well{
31 public:
34
37 double rmissing = -999.0,
38 int imissing = -999);
39
41 Well(const std::string & file_name,
42 bool & read_ok,
43 const std::string & facies_log = "");
44
49 Well(const std::map<std::string, std::vector<double> > & cont_log,
50 const std::map<std::string, std::vector<int> > & disc_log,
51 const std::string & well_name);
52
54 virtual ~Well();
55
56 static Well * ReadWell(const std::string & file_name,
57 int & well_format);
58
60 bool HasDiscLog(const std::string & name) const;
62 bool HasContLog(const std::string& name) const;
63
65 std::vector<double> & GetContLog(const std::string& name);
66 std::vector<double> & GetContLogSeismicResolution(const std::string& name);
67 std::vector<double> & GetContLogBackgroundResolution(const std::string& name);
68
70 const std::vector<double> & GetContLog(const std::string& name) const;
71 const std::vector<double> & GetContLogSeismicResolution(const std::string& name) const;
72 const std::vector<double> & GetContLogBackgroundResolution(const std::string& name) const;
73
75 std::vector<int> & GetDiscLog(const std::string& name);
77 const std::vector<int> & GetDiscLog(const std::string& name) const;
78
81 void AddContLog(const std::string& name, const std::vector<double>& log);
82 void AddContLogSeismicResolution(const std::string& name, const std::vector<double>& log);
83 void AddContLogBackgroundResolution(const std::string& name, const std::vector<double>& log);
89 void AddDiscLog(const std::string& name, const std::vector<int>& log);
96 void SetWellName(const std::string& wellname);
98 const std::string& GetWellName() const { return well_name_; };
100 void SetDate(const std::string& wellname);
102 const std::string& GetDate() const { return date_; };
103
105 bool IsMissing(double x) const;
107 bool IsMissing(int n) const;
109 bool IsDeviated() const { return is_deviated_; }
111 double GetContMissing() const { return(well_rmissing_); }
113 int GetNData(void) const { return n_data_ ;}
115 int GetIntMissing() const { return(well_imissing_); }
117 void SetDeviated(bool b) {is_deviated_ = b ;}
119 void SetMissing(double value) {well_rmissing_ = value; well_imissing_ = static_cast<int>(value);}
122 int GetDiscValue(size_t index, const std::string& logname) const;
125 double GetContValue(size_t index, const std::string& logname) const;
127 void SetDiscValue(int value, size_t index, const std::string& logname);
129 void SetContValue(double value, size_t index, const std::string& logname);
131 size_t GetNlog() const;
133 size_t GetNContLog() const;
135 size_t GetContLogLength(const std::string& logname) const;
137 const std::map<std::string,std::vector<double> > & GetContLog() const { return cont_log_; };
138 const std::map<std::string,std::vector<double> > & GetContLogSeismicResolution() const { return cont_log_seismic_resolution_; };
139 const std::map<std::string,std::vector<double> > & GetContLogBackgroundResolution() const { return cont_log_background_resolution_; };
141 const std::map<std::string,std::vector<int> > & GetDiscLog() const { return disc_log_; };
143 int GetNFacies() const { return static_cast<int>(facies_map_.size()) ;}
145 const std::map<int, std::string> & GetFaciesMap() const { return facies_map_ ;}
146
147 void SetXPos0(double x_pos0) { x_pos0_ = x_pos0 ;}
148 void SetYPos0(double y_pos0) { y_pos0_ = y_pos0 ;}
149
150 double GetXPos0() { return x_pos0_ ;}
151 double GetYPos0() { return y_pos0_ ;}
152
154 void SetNumberOfNonMissingData(int n_data_nonmissing) { n_data_nonmissing_ = n_data_nonmissing ;}
155
157 void SetNumberOfData(int n_data) {n_data_ = n_data ;}
158
160
161 virtual const std::map<int, std::string> GetDiscNames(const std::string& log_name) const;
162
163 unsigned int GetNumberOfNonMissingData() const {return n_data_nonmissing_ ;}
164
165 void SetUseForBackgroundTrend(int use_for_background_trend) { use_for_background_trend_ = use_for_background_trend ;}
166 void SetUseForFiltering(int use_for_filtering) { use_for_filtering_ = use_for_filtering ;}
167 void SetUseForFaciesProbabilities(int use_for_facies_probabilities) { use_for_facies_probabilities_ = use_for_facies_probabilities ;}
168 void SetUseForWaveletEstimation(int use_for_wavelet_estimation) { use_for_wavelet_estimation_ = use_for_wavelet_estimation ;}
169 void SetRealVsLog(int real_vs_log) { real_vs_log_ = real_vs_log ;}
170 void SetUseForRockPhysics(int use_for_rock_physics) { use_for_rock_physics_ = use_for_rock_physics ;}
171
172 int GetUseForBackgroundTrend(void) const { return use_for_background_trend_ ;}
173 int GetUseForFiltering(void) const { return use_for_filtering_ ;}
174 int GetUseForFaciesProbabilities(void) const { return use_for_facies_probabilities_ ;}
175 int GetUseForWaveletEstimation(void) const { return use_for_wavelet_estimation_ ;}
176 int GetRealVsLog(void) const { return real_vs_log_ ;}
177 int GetUseForRockPhysics(void) const { return use_for_rock_physics_ ;}
178
179 bool HasSyntheticVsLog(void) const { return(real_vs_log_)==0 ;}
180
181 enum WELL_FILE_FORMAT {RMS=0, NORSAR = 1, LAS = 2};
182
183 protected:
184 // Number of time data including WELLMISSING values
185 unsigned int n_data_;
186
187 // Number of data excluding WELLMISSING values
188 unsigned int n_data_nonmissing_;
189
190 private:
192 std::map<std::string,std::vector<double> > cont_log_;
194 std::map<std::string,std::vector<int> > disc_log_;
196 std::map<std::string,std::vector<double> > cont_log_seismic_resolution_;
198 std::map<std::string,std::vector<double> > cont_log_background_resolution_;
200 std::string well_name_;
202 std::string date_;
204 double well_rmissing_;
206 int well_imissing_;
208 bool is_deviated_;
210 std::map<int, std::string> facies_map_;
211
212 int use_for_background_trend_; //Uses the indicator enum from Modelsettings
213 int use_for_filtering_; //Uses the indicator enum from Modelsettings
214 int use_for_wavelet_estimation_; //Uses the indicator enum from Modelsettings
215 int use_for_facies_probabilities_; //Uses the indicator enum from Modelsettings
216 int real_vs_log_; //Uses the indicator enum from Modelsettings
217 int use_for_rock_physics_; //Uses the indicator enum from Modelsettings
218
219 double x_pos0_; // x-coordinate from well file header
220 double y_pos0_; // y-coordinate from well file header
221
222 };
223
224}
225
226#endif
const cJSON *const b
Definition: cJSON.h:251
const char *const name
Definition: cJSON.h:258
int index
Definition: cJSON.h:168
const char *const string
Definition: cJSON.h:170
Definition: NRLib/nrlib/well/well.hpp:30
void SetContValue(double value, size_t index, const std::string &logname)
Set value at position index in log with name logname.
void RemoveContLog(const std::string &name)
virtual const std::map< int, std::string > GetDiscNames(const std::string &log_name) const
static Well * ReadWell(const std::string &file_name, int &well_format)
WELL_FILE_FORMAT
Definition: NRLib/nrlib/well/well.hpp:181
@ RMS
Definition: NRLib/nrlib/well/well.hpp:181
@ NORSAR
Definition: NRLib/nrlib/well/well.hpp:181
@ LAS
Definition: NRLib/nrlib/well/well.hpp:181
unsigned int n_data_nonmissing_
Definition: NRLib/nrlib/well/well.hpp:188
size_t GetNContLog() const
Return number of discrete logs.
bool IsMissing(int n) const
Return true if n is missing.
bool HasContLog(const std::string &name) const
Check existence of continuous log.
const std::map< std::string, std::vector< double > > & GetContLogSeismicResolution() const
Definition: NRLib/nrlib/well/well.hpp:138
unsigned int n_data_
Definition: NRLib/nrlib/well/well.hpp:185
void SetNumberOfData(int n_data)
Set number of data.
Definition: NRLib/nrlib/well/well.hpp:157
void SetDiscValue(int value, size_t index, const std::string &logname)
Set value at position index in log with name logname.
void AddContLog(const std::string &name, const std::vector< double > &log)
void SetNumberOfNonMissingData(int n_data_nonmissing)
Set number of non-missing data.
Definition: NRLib/nrlib/well/well.hpp:154
const std::map< std::string, std::vector< double > > & GetContLogBackgroundResolution() const
Definition: NRLib/nrlib/well/well.hpp:139
const std::map< int, std::string > & GetFaciesMap() const
Map integer log to facies name.
Definition: NRLib/nrlib/well/well.hpp:145
const std::map< std::string, std::vector< int > > & GetDiscLog() const
Return all discrete logs.
Definition: NRLib/nrlib/well/well.hpp:141
std::vector< double > & GetContLogSeismicResolution(const std::string &name)
int GetRealVsLog(void) const
Definition: NRLib/nrlib/well/well.hpp:176
int GetUseForFaciesProbabilities(void) const
Definition: NRLib/nrlib/well/well.hpp:174
std::vector< double > & GetContLog(const std::string &name)
Return continuous logs.
std::vector< int > & GetDiscLog(const std::string &name)
Return discrete logs.
Well(const std::string &name, double rmissing=-999.0, int imissing=-999)
Construct well with given name and no logs.
int GetUseForFiltering(void) const
Definition: NRLib/nrlib/well/well.hpp:173
Well(const std::string &file_name, bool &read_ok, const std::string &facies_log="")
Construct well from file.
double GetContMissing() const
Return cont. missing value.
Definition: NRLib/nrlib/well/well.hpp:111
size_t GetNlog() const
Return total number of logs.
Well(const std::map< std::string, std::vector< double > > &cont_log, const std::map< std::string, std::vector< int > > &disc_log, const std::string &well_name)
const std::vector< double > & GetContLogBackgroundResolution(const std::string &name) const
int GetIntMissing() const
Return disc. missing value.
Definition: NRLib/nrlib/well/well.hpp:115
void SetXPos0(double x_pos0)
Definition: NRLib/nrlib/well/well.hpp:147
void SetUseForFiltering(int use_for_filtering)
Definition: NRLib/nrlib/well/well.hpp:166
bool HasDiscLog(const std::string &name) const
Check existence of discrete log.
const std::map< std::string, std::vector< double > > & GetContLog() const
Return all continuous logs.
Definition: NRLib/nrlib/well/well.hpp:137
void SetFaciesMappingFromDiscLog(const std::string &name)
Definition: NRLib/nrlib/well/well.hpp:159
int GetDiscValue(size_t index, const std::string &logname) const
double GetContValue(size_t index, const std::string &logname) const
const std::string & GetDate() const
Definition: NRLib/nrlib/well/well.hpp:102
void SetUseForRockPhysics(int use_for_rock_physics)
Definition: NRLib/nrlib/well/well.hpp:170
const std::vector< int > & GetDiscLog(const std::string &name) const
Return discrete logs.
void SetWellName(const std::string &wellname)
Set name of well.
int GetNData(void) const
Return number of time data.
Definition: NRLib/nrlib/well/well.hpp:113
void SetDate(const std::string &wellname)
Set name of well.
void SetYPos0(double y_pos0)
Definition: NRLib/nrlib/well/well.hpp:148
unsigned int GetNumberOfNonMissingData() const
Definition: NRLib/nrlib/well/well.hpp:163
int GetNFacies() const
Facies.
Definition: NRLib/nrlib/well/well.hpp:143
void AddDiscLog(const std::string &name, const std::vector< int > &log)
void SetUseForFaciesProbabilities(int use_for_facies_probabilities)
Definition: NRLib/nrlib/well/well.hpp:167
virtual ~Well()
Destructor.
double GetYPos0()
Definition: NRLib/nrlib/well/well.hpp:151
double GetXPos0()
Definition: NRLib/nrlib/well/well.hpp:150
void AddContLogSeismicResolution(const std::string &name, const std::vector< double > &log)
int GetUseForRockPhysics(void) const
Definition: NRLib/nrlib/well/well.hpp:177
Well()
Default constructor.
void SetDeviated(bool b)
Set deviated.
Definition: NRLib/nrlib/well/well.hpp:117
int GetUseForBackgroundTrend(void) const
Definition: NRLib/nrlib/well/well.hpp:172
void SetRealVsLog(int real_vs_log)
Definition: NRLib/nrlib/well/well.hpp:169
void SetUseForWaveletEstimation(int use_for_wavelet_estimation)
Definition: NRLib/nrlib/well/well.hpp:168
const std::vector< double > & GetContLogSeismicResolution(const std::string &name) const
void SetUseForBackgroundTrend(int use_for_background_trend)
Definition: NRLib/nrlib/well/well.hpp:165
bool IsMissing(double x) const
Return true if x is missing.
const std::vector< double > & GetContLog(const std::string &name) const
Return continuous logs.
void RemoveDiscLog(const std::string &name)
bool HasSyntheticVsLog(void) const
Definition: NRLib/nrlib/well/well.hpp:179
const std::string & GetWellName() const
Definition: NRLib/nrlib/well/well.hpp:98
bool IsDeviated() const
Check if deviated.
Definition: NRLib/nrlib/well/well.hpp:109
void SetMissing(double value)
Set missing values.
Definition: NRLib/nrlib/well/well.hpp:119
std::vector< double > & GetContLogBackgroundResolution(const std::string &name)
int GetUseForWaveletEstimation(void) const
Definition: NRLib/nrlib/well/well.hpp:175
void AddContLogBackgroundResolution(const std::string &name, const std::vector< double > &log)
void MakeLogsUppercase()
Change case of all logs to uppercase, to remove case sensitivity on log names.
size_t GetContLogLength(const std::string &logname) const
Return length of log with name logname.
Definition: exception.hpp:31
std::vector< typename std::result_of< F(typename C::const_iterator::value_type &) >::type > map(F f, const C &src)
Definition: Functional.hpp:84
T value(details::expression_node< T > *n)
Definition: exprtk.hpp:12955
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)