Documentation ¶
Index ¶
- Variables
- func ParseCurveStr(s string) (f [3]string)
- func ParseParamStr(s string) (f [4]string)
- func PrepareParamStr(s string) string
- type Check
- type CheckRes
- type CheckResults
- type Checker
- type HeaderParam
- type HeaderSection
- type Las
- func (las *Las) Dept() []float64
- func (las *Las) GetMnemonic(logName string) string
- func (las *Las) GetRows() []string
- func (las *Las) GetStepFromData() float64
- func (las *Las) GetStrtFromData() float64
- func (las *Las) IsEmpty() bool
- func (las *Las) IsStepEmpty() bool
- func (las *Las) IsStopEmpty() bool
- func (las *Las) IsStrtEmpty() bool
- func (las *Las) IsWraped() bool
- func (las *Las) Load(reader io.Reader) (int, error)
- func (las *Las) LoadDataSec(m int) (int, error)
- func (las *Las) LoadHeader() (int, error)
- func (las *Las) NULL() float64
- func (las *Las) NumPoints() int
- func (las *Las) Open(fileName string) (int, error)
- func (las *Las) ReadRows() int
- func (las *Las) STEP() float64
- func (las *Las) STOP() float64
- func (las *Las) STRT() float64
- func (las *Las) Save(fileName string, useMnemonic ...bool) error
- func (las *Las) SaveToBuf(useMnemonic bool) ([]byte, error)
- func (las *Las) SaveWarning(fileName string) error
- func (las *Las) SaveWarningToFile(oFile *os.File) int
- func (las *Las) SaveWarningToWriter(writer *bufio.Writer) int
- func (las *Las) SetNull(null float64)
- func (las *Las) VERS() float64
- func (las *Las) WELL() string
- func (las *Las) WRAP() string
- type LasCurve
- type LasCurves
- type Logger
- type ParseHeaderParam
- type TLasWarnings
- type TMnemonic
- type TVocDic
- type TWarning
Constants ¶
This section is empty.
Variables ¶
var ( // ExpPoints - первоначальный размер слайсов для хранения данных Logs.D и Logs.V // ожидаемое количество точек данных, до чтения мы не можем знать сколько точек будет фактически прочитано // данные увеличиваются при необходимости и обрезаются после окончания чтения ExpPoints int = 1000 // StdNull - пустое значение StdNull float64 = -999.25 // MaxWarningCount - слишком много сообщений писать смысла нет MaxWarningCount int = 20 )
var ( RecordSeparator = "\n" FieldSeparator = "," )
separators for output Warnings to string
Functions ¶
func ParseCurveStr ¶
ParseCurveStr - parse input string to 3 separated string " пс повт . мВ : 7 кр сам"
^^^^^^^ ^^ ^^^^^^^^ name unit description
f[2] - description f[1] - unit f[0] - name
func ParseParamStr ¶
ParseParamStr - parse string from las file return slice with 4 string and error if occure before process input string 2 or more space replace on 1 space sample "NULL . -9999.00 : Null value" f[0] - name f[1] - unit f[2] - value f[3] - description
func PrepareParamStr ¶
PrepareParamStr - prepare string to parse, replace many space to one, replace tab to space, replace combination of separator to one
Types ¶
type Check ¶
type Check struct {
// contains filtered or unexported fields
}
Check - конкретная проверка, обязан реализовать функцию doCheck()
type CheckRes ¶
type CheckRes struct {
// contains filtered or unexported fields
}
CheckRes - результаты проверки, получааем из функции doCheck() если проверка не прошла, то res будет false и в warning будет положено предупреждение для логов в критических случаях err != nil и в себе содержит сообщение, при этом warning содержит соответствующее предупреждение для логов если err == nil то это не критичная проверка
type CheckResults ¶
CheckResults - map с результатами всех проверок
type Checker ¶
Checker - ПРОВЕРЩИК, содержит в себе всех отдельных проверщиков, методом check() вызавает последовательно всех своих проверщиков, результаты отправляет в Logger
func NewStdChecker ¶
func NewStdChecker() Checker
NewStdChecker - создание нового ПРОВЕРЩИКА las файла. WRAP = ON section ~Curve is empty STEP == 0 NULL == 0 STRT == STOP WELL is empty
type HeaderParam ¶
type HeaderParam struct { Val string // parameter value Name string // name of parameter: STOP, WELL, SP - curve name also, also matches the key used in storage IName string Unit string // unit of parameter Mnemonic string Desc string // description of parameter // contains filtered or unexported fields }
HeaderParam - class to store parameter from any section universal type for store any header parameters use for store parameters from sections ~V, ~W and other for curves used inherited type LasCurve
func NewCurveHeaderParam ¶
func NewCurveHeaderParam(s string, i int) *HeaderParam
NewCurveHeaderParam - create new object LasParam STRT. m 10.0 : start field[0] field[1] field[2] field[3]
func NewHeaderParam ¶
func NewHeaderParam(s string, i int) *HeaderParam
NewHeaderParam - create new object LasParam STRT. m 10.0 : start field[0] field[1] field[2] field[3]
type HeaderSection ¶
type HeaderSection struct {
// contains filtered or unexported fields
}
HeaderSection - contain parameters of Well section
type Las ¶
type Las struct { FileName string // file name from load File *os.File // the file from which we are reading Reader io.Reader // reader created from File, provides decode from codepage to UTF-8 Logs LasCurves // store all logs LogDic *map[string]string // external dictionary of standart log name - mnemonics VocDic *map[string]string // external vocabulary dictionary of log mnemonic Warnings TLasWarnings // slice of warnings occure on read or write VerSec, WelSec, CurSec, ParSec, OthSec HeaderSection // contains filtered or unexported fields }
Las - class to store las file input code page autodetect at read file the code page is converted to UTF at save file code page converted to specifyed in Las.oCodepage TODO add pointer to cfg TODO при создании объекта las есть возможность указать кодировку записи, нужна возможность указать явно кодировку чтения
func LoadLasHeader ¶
LoadLasHeader - utility function, if need read only header without data read header as is not repaire any parameters: step, stop, etc...
func NewLas ¶
func NewLas(outputCP ...cpd.IDCodePage) *Las
NewLas - make new object Las class autodetect code page at load file code page to save by default is cpd.CP1251
func (*Las) GetMnemonic ¶
GetMnemonic - return Mnemonic from dictionary by Log Name, if Mnemonic not found return "" if Dictionary is nil, then return ""
func (*Las) GetStepFromData ¶
GetStepFromData - return step from data section read 2 line from section ~A and determine step close file return Null if error occure
func (*Las) GetStrtFromData ¶
GetStrtFromData - return strt from data section read 1 line from section ~A and determine strt close file return Null if error occurs
func (*Las) IsStepEmpty ¶
IsStepEmpty - return true if parameter Step not exist in file
func (*Las) IsStopEmpty ¶
IsStopEmpty - return true if parameter Stop not exist in file
func (*Las) IsStrtEmpty ¶
IsStrtEmpty - return true if parameter Strt not exist in file
func (*Las) Load ¶
Load - load las from reader you can make reader from string or other containers and send as input parameters
func (*Las) LoadDataSec ¶
LoadDataSec - read data section from rows
func (*Las) LoadHeader ¶
LoadHeader - read las file and load all section before ~A
returns the row number with which the data section begins, until return nil in any case
1. читаем строку 2. если коммент или пустая в игнор 3. если начало секции, определяем какой 4. если началась секция данных заканчиваем 5. читаем одну строку (это один параметер из известной нам секции)
func (*Las) NULL ¶
NULL - return null value of las file as float64 if parameter NULL in las file not exist, then return StdNull (by default -999.25)
func (*Las) STEP ¶
STEP - return depth step value of las file as float64 if parameter not exist, then return StdNull (by default -999.25)
func (*Las) STOP ¶
STOP - return depth stop value of las file as float64 if parameter STOP in las file not exist, then return StdNull (by default -999.25)
func (*Las) STRT ¶
STRT - return depth start value of las file as float64 if parameter NULL in las file not exist, then return StdNull (by default -999.25)
func (*Las) Save ¶
Save - save to file rewrite if file exist if useMnemonic == true then on save using std mnemonic on ~Curve section TODO las have field filename of readed las file, after save filename must update or not? warning occure on write for what file?
func (*Las) SaveToBuf ¶
SaveToBuf - save to file rewrite if file exist if useMnemonic == true then on save using std mnemonic on ~Curve section ir return err != nil then fatal error, returned slice is not full corrected
func (*Las) SaveWarning ¶
SaveWarning - save to file all warning
func (*Las) SaveWarningToFile ¶
SaveWarningToFile - store all warning to file, file not close. return count warning written
func (*Las) SaveWarningToWriter ¶
SaveWarningToWriter - store all warning to writer, return count lines written to
func (*Las) VERS ¶
VERS - return version of las file as float64 if parameter VERS in las file not exist, then return 2.0
type LasCurve ¶
type LasCurve struct { HeaderParam Index int D []float64 V []float64 }
LasCurve - class to store one log in Las
func NewLasCurve ¶
NewLasCurve - create new object LasCurve s - string from las header las - pointer to container
func (*LasCurve) Cmp ¶
Cmp - compare current curve with another не сравниваются хранящиеся числовые данные (сам каротаж), только описание кривой, также не сравнивается индекс for deep comparison with all data points stored in the container use DeepCmp
type LasCurves ¶
type LasCurves []LasCurve
LasCurves - container to store all curves of las file .Cmp(curves *LasCurves) bool - compare two curves containers
func (LasCurves) Captions ¶
Captions - return string represents all curve names with separators for las file use as comment string after section ~A
func (LasCurves) Cmp ¶
Cmp - compare current curves container with another сравниваются:
количество кривых в контейнере два хеша от строк с именами всех кривых
func (LasCurves) UniqueName ¶
UniqueName - make new unique name of curve if it duplicated
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger - store log info about the one las, fills up info from las.open() and las.check()
func LasCheck ¶
LasCheck - read and check las file, return object with all warnings считывает файл и собирает все сообщения в один объект это базовая проверка las файла, прелесть в том что здесь собираются сообщения от прочтения файла
func LasDeepCheck ¶
LasDeepCheck - read and check las file, curve name checked to mnemonic, return object with all warnings считывает файл и собирает все сообщения в один объект
type ParseHeaderParam ¶
type ParseHeaderParam func(s string, i int) (HeaderParam, TWarning)
ParseHeaderParam - function to parse one line of header return new of added parameter and warning on success TWarning.Empty() == true s - string readed from source file i - number of line in source file
type TLasWarnings ¶
type TLasWarnings []TWarning
TLasWarnings - class to store and manipulate warnings Count() - return warnings count SaveWarning(fileName string) error SaveWarningToWriter(writer *bufio.Writer) int SaveWarningToFile(oFile *os.File) int ToString() string for i, w := range obj {w.ToString()} - перебор всех варнингов
func (*TLasWarnings) SaveWarning ¶
func (w *TLasWarnings) SaveWarning(fileName string) error
SaveWarning - save to file all warning file created and closed
func (*TLasWarnings) SaveWarningToFile ¶
func (w *TLasWarnings) SaveWarningToFile(oFile *os.File) int
SaveWarningToFile - store all warning to file, file not close. return count warning writed
func (*TLasWarnings) SaveWarningToWriter ¶
func (w *TLasWarnings) SaveWarningToWriter(writer *bufio.Writer) int
SaveWarningToWriter - store all warning to writer return count lines writed to
func (*TLasWarnings) ToString ¶
func (w *TLasWarnings) ToString(sep ...string) string
ToString - make one string from all elements sep[0] - record separator разделитель записей sep[1] - field separator разделитель полей default separator between field "," between record "\n" on empty container return ""
type TMnemonic ¶
TMnemonic - dictionary of std log name == mnemonics
func LoadStdMnemonicDic ¶
LoadStdMnemonicDic - return std mnemonic map read ini file, fill dictionary return empty map if occure error on reading ini file with dictionary, may be add after
type TVocDic ¶
TVocDic - dictionary of std log name == mnemonics
func LoadStdVocabularyDictionary ¶
LoadStdVocabularyDictionary - return lookup map read ini file, fill dictionary return empty map if occure error on reading ini file with dictionary, may be add after
type TWarning ¶
type TWarning struct {
// contains filtered or unexported fields
}
TWarning - class to store warning
func (*TWarning) ToCsvString ¶
ToCsvString - return string with warning field TWarning.direct do not write to string