зеркало из https://github.com/softlandia/glasio.git
start add section parameters
This commit is contained in:
Родитель
45665b8d37
Коммит
a45992ebed
11
README.md
11
README.md
|
@ -53,3 +53,14 @@ lasin
|
|||
|
||||
coverage 91%
|
||||
folder "data" contain files for testing, no remove/change/add
|
||||
|
||||
## warnings generated when reading a LAS file ##
|
||||
|
||||
### warning format ###
|
||||
|
||||
extended:
|
||||
> x, y, "message text"
|
||||
> x - section number
|
||||
> y - line number of input file
|
||||
|
||||
short:
|
||||
|
|
|
@ -13,23 +13,3 @@ FLD . WILDCAT :FIELD
|
|||
LOC . 12-34-12-34W5 :LOCATION
|
||||
PROV . ALBERTA :PROVINCE
|
||||
SRVC . ANY LOGGING COMPANY INC. :SERVICE COMPANY
|
||||
DATE . 13-DEC-86 :LOG DATE
|
||||
UWI . 100123401234W500 :UNIQUE WELL ID
|
||||
#
|
||||
~c
|
||||
ETIM .S : 1 ELAPSED TIME
|
||||
BFR1 .OHMM : 2 SINGLE PROBE 1 RESISTIVITY
|
||||
BSG1 .PSIG : 3 SINGLE PROBE 1 STRAIN GAUGE PRESSURE
|
||||
#
|
||||
~p
|
||||
MRT .DEGC 67.0 : BOTTOM HOLE TEMPERATURE
|
||||
GDEPT .M 3456.5 : GAUGE DEPTH
|
||||
DFD .KG/M3 1000.0 : MUD WEIGHT
|
||||
#
|
||||
~a
|
||||
0.0000 0.2125 16564.1445
|
||||
0.3000 0.2125 16564.1445
|
||||
0.6000 0.2125 16564.2421
|
||||
0.9000 0.2125 16564.0434
|
||||
1.2000 0.2125 16564.0430
|
||||
1.5000 0.2125 16564.0435
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
~v
|
||||
VERS. 2.0 : CWLS LOG ASCII STANDARD -VERSION 2.0
|
||||
WRAP. NO : ONE LINE PER TIME STEP
|
||||
#
|
||||
~w
|
||||
STRT .S 0.0000 :START TIME
|
||||
STOP .S 39.9000 :STOP TIME
|
||||
STEP .S 0.3000 :STEP
|
||||
NULL . -999.25 :NULL VALUE
|
||||
COMP . ANY OIL COMPANY INC. :COMPANY
|
||||
WELL . Ïðèìåðíàÿ-1 / áèñ(¸) :WELL
|
||||
FLD . WILDCAT :FIELD
|
||||
LOC . 12-34-12-34W5 :LOCATION
|
||||
PROV . ALBERTA :PROVINCE
|
|
@ -0,0 +1,35 @@
|
|||
~v
|
||||
VERS. 2.0 : CWLS LOG ASCII STANDARD -VERSION 2.0
|
||||
WRAP. NO : ONE LINE PER TIME STEP
|
||||
#
|
||||
~w
|
||||
STRT .S :START TIME
|
||||
STOP .S 39.9000 :STOP TIME
|
||||
STEP .S 0.3000 :STEP
|
||||
NULL . -999.25 :NULL VALUE
|
||||
COMP . ANY OIL COMPANY INC. :COMPANY
|
||||
WELL . Ïðèìåðíàÿ-1 / áèñ(¸) :WELL
|
||||
FLD . WILDCAT :FIELD
|
||||
LOC . 12-34-12-34W5 :LOCATION
|
||||
PROV . ALBERTA :PROVINCE
|
||||
SRVC . ANY LOGGING COMPANY INC. :SERVICE COMPANY
|
||||
DATE . 13-DEC-86 :LOG DATE
|
||||
UWI . 100123401234W500 :UNIQUE WELL ID
|
||||
#
|
||||
~c
|
||||
ETIM .S : 1 ELAPSED TIME
|
||||
BFR1 .OHMM : 2 SINGLE PROBE 1 RESISTIVITY
|
||||
BSG1 .PSIG : 3 SINGLE PROBE 1 STRAIN GAUGE PRESSURE
|
||||
#
|
||||
~p
|
||||
MRT .DEGC 67.0 : BOTTOM HOLE TEMPERATURE
|
||||
GDEPT .M 3456.5 : GAUGE DEPTH
|
||||
DFD .KG/M3 1000.0 : MUD WEIGHT
|
||||
#
|
||||
~a
|
||||
1.0000 0.2125 16564.1445
|
||||
0.3000 0.2125 16564.1445
|
||||
0.6000 0.2125 16564.2421
|
||||
0.9000 0.2125 16564.0434
|
||||
1.2000 0.2125 16564.0430
|
||||
1.5000 0.2125 16564.0435
|
|
@ -1,6 +1,6 @@
|
|||
**file: data\more_20_warnings.las**
|
||||
0, line: -1, "__WRN__ STEP parameter equal 0"
|
||||
1, line: -1, "__WRN__ STRT: 0.000 == STOP: 0.000"
|
||||
0, line: 23, "__WRN__ STRT: 0.000 == STOP: 0.000"
|
||||
1, line: 23, "__WRN__ STEP parameter equal 0"
|
||||
2, line: 24, "can't convert string: '6.2.2' to number, set to NULL"
|
||||
3, line: 25, "not all column readed, set log value to NULL"
|
||||
4, line: 25, "not all column readed, set log value to NULL"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
**file: data\more_20_warnings.las**
|
||||
0, line: -1, "__WRN__ STEP parameter equal 0"
|
||||
1, line: -1, "__WRN__ STRT: 0.000 == STOP: 0.000"
|
||||
0, line: 23, "__WRN__ STRT: 0.000 == STOP: 0.000"
|
||||
1, line: 23, "__WRN__ STEP parameter equal 0"
|
||||
2, line: 24, "can't convert string: '6.2.2' to number, set to NULL"
|
||||
3, line: 25, "not all column readed, set log value to NULL"
|
||||
4, line: 25, "not all column readed, set log value to NULL"
|
||||
|
|
68
las.go
68
las.go
|
@ -58,15 +58,19 @@ const (
|
|||
lasSecData = 4
|
||||
)
|
||||
|
||||
// LasWellInfo - contain parameters of Well section
|
||||
type LasWellInfo struct {
|
||||
ver float64
|
||||
wrap string
|
||||
wellName string
|
||||
null float64
|
||||
oCodepage cpd.IDCodePage //TODO проверить нужно ли это поле
|
||||
// HeaderParam - any parameter of LAS
|
||||
type HeaderParam struct {
|
||||
lineNo int // number of line in source file
|
||||
source, // text line from source file contain this parameter
|
||||
name, // name of parameter: STOP, WELL, SP - curve name also
|
||||
Val, // parameter value
|
||||
Unit, // unit of parameter
|
||||
Description string // descrioption of parameter
|
||||
}
|
||||
|
||||
// HeaderSection - contain parameters of Well section
|
||||
type HeaderSection map[string]HeaderParam
|
||||
|
||||
// Las - class to store las file
|
||||
// input code page autodetect
|
||||
// at read file always code page converted to UTF
|
||||
|
@ -97,11 +101,17 @@ type Las struct {
|
|||
currentLine int //index of current line in readed file
|
||||
maxWarningCount int //default maximum warning count
|
||||
stdNull float64 //default null value
|
||||
|
||||
VerSec,
|
||||
WellSec,
|
||||
CurSec,
|
||||
ParSec,
|
||||
OthSec HeaderSection
|
||||
}
|
||||
|
||||
var (
|
||||
// ExpPoints - ожидаемое количество точек данных, до чтения мы не можем знать сколько точек будет фактически прочитано
|
||||
// ExpPoints - первоначальный размер слайсов для хранения данных Logs.D и Logs.V
|
||||
// ожидаемое количество точек данных, до чтения мы не можем знать сколько точек будет фактически прочитано
|
||||
// данные увеличиваются при необходимости и обрезаются после окончания чтения
|
||||
ExpPoints int = 1000
|
||||
// StdNull - пустое значение
|
||||
StdNull float64 = -999.25
|
||||
|
@ -120,6 +130,11 @@ func NewLas(outputCP ...cpd.IDCodePage) *Las {
|
|||
// избавит от необходимости довыделять память при чтении
|
||||
las.ePoints = ExpPoints
|
||||
las.Logs = make(map[string]LasCurve)
|
||||
las.VerSec = make(HeaderSection)
|
||||
las.WellSec = make(HeaderSection)
|
||||
las.CurSec = make(HeaderSection)
|
||||
las.ParSec = make(HeaderSection)
|
||||
las.OthSec = make(HeaderSection)
|
||||
las.maxWarningCount = MaxWarningCount
|
||||
las.stdNull = StdNull
|
||||
las.Strt = StdNull
|
||||
|
@ -276,7 +291,7 @@ func (las *Las) Open(fileName string) (int, error) {
|
|||
if r.stepWrong() {
|
||||
h := las.GetStepFromData() // return las.Null if cannot calculate step from data
|
||||
if h == las.Null {
|
||||
las.addWarning(TWarning{directOnRead, lasSecWellInfo, -1, fmt.Sprint("__WRN__ STEP parameter on data is wrong")})
|
||||
las.addWarning(TWarning{directOnRead, lasSecWellInfo, las.currentLine, fmt.Sprint("__WRN__ STEP parameter on data is wrong")})
|
||||
}
|
||||
las.setStep(h)
|
||||
}
|
||||
|
@ -297,7 +312,7 @@ func (las *Las) storeHeaderWarning(chkResults CheckResults) {
|
|||
3. если начало секции, определяем какой
|
||||
4. если началась секция данных заканчиваем
|
||||
5. читаем одну строку (это один параметер из известной нам секции)
|
||||
Пока ошибку всегда возвращает nil, причин возвращать другое значение пока нет.
|
||||
Пока всегда возвращает nil, причин возвращать другое значение пока нет.
|
||||
*/
|
||||
func (las *Las) LoadHeader() error {
|
||||
s := ""
|
||||
|
@ -312,13 +327,40 @@ func (las *Las) LoadHeader() error {
|
|||
if s[0] == '~' { //start new section
|
||||
secNum = las.selectSection(rune(s[1]))
|
||||
if secNum == lasSecData {
|
||||
break // dAta section read after //exit from for
|
||||
break // reached the dAta section, stop load header
|
||||
}
|
||||
} else {
|
||||
//if not comment, not empty and not new section => parameter, read it
|
||||
err = las.ReadParameter(s, secNum)
|
||||
if err != nil {
|
||||
las.addWarning(TWarning{directOnRead, secNum, -1, fmt.Sprintf("while process parameter: '%s' occure error: %v", s, err)})
|
||||
las.addWarning(TWarning{directOnRead, secNum, las.currentLine, fmt.Sprintf("param: '%s' error: %v", s, err)})
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (las *Las) LoadHeader2() error {
|
||||
s := ""
|
||||
var err error
|
||||
//sec := las.VerSec
|
||||
secNum := 0
|
||||
for i := 0; las.scanner.Scan(); i++ {
|
||||
s = strings.TrimSpace(las.scanner.Text())
|
||||
las.currentLine++
|
||||
if isIgnoredLine(s) {
|
||||
continue
|
||||
}
|
||||
if s[0] == '~' { //start new section
|
||||
secNum = las.selectSection(rune(s[1]))
|
||||
if secNum == lasSecData {
|
||||
break // reached the dAta section, stop load header
|
||||
}
|
||||
} else {
|
||||
//if not comment, not empty and not new section => parameter, read it
|
||||
err = las.ReadParameter(s, secNum)
|
||||
if err != nil {
|
||||
las.addWarning(TWarning{directOnRead, secNum, las.currentLine, fmt.Sprintf("param: '%s' error: %v", s, err)})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,37 +132,37 @@ func NewStdChecker() Checker {
|
|||
// результат проверки возвращаем всегда с готовым варнингом и ошибкой,
|
||||
// уже в дальнейшем, те проверки у которых res == true не вносятся в итоговый отчёт
|
||||
func stepExistCheck(chk Check, las *Las) CheckRes {
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, -1, "__WRN__ parameter STEP not exist"}, nil, !las.IsStepEmpty()}
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, las.currentLine, "__WRN__ parameter STEP not exist"}, nil, !las.IsStepEmpty()}
|
||||
}
|
||||
|
||||
func stopExistCheck(chk Check, las *Las) CheckRes {
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, -1, "__WRN__ parameter STOP not exist"}, nil, !las.IsStopEmpty()}
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, las.currentLine, "__WRN__ parameter STOP not exist"}, nil, !las.IsStopEmpty()}
|
||||
}
|
||||
|
||||
func strtExistCheck(chk Check, las *Las) CheckRes {
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, -1, "__WRN__ parameter STRT not exist"}, nil, !las.IsStrtEmpty()}
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, las.currentLine, "__WRN__ parameter STRT not exist"}, nil, !las.IsStrtEmpty()}
|
||||
}
|
||||
|
||||
func wrapCheck(chk Check, las *Las) CheckRes {
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecVersion, -1, "__ERR__ WRAP = YES, file ignored"}, fmt.Errorf("Wrapped files not support"), !las.IsWraped()}
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecVersion, las.currentLine, "__ERR__ WRAP = YES, file ignored"}, fmt.Errorf("Wrapped files not support"), !las.IsWraped()}
|
||||
}
|
||||
|
||||
func curvesIsEmpty(chk Check, las *Las) CheckRes {
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecCurInfo, -1, "__ERR__ Curve section is empty, file ignored"}, fmt.Errorf("Curve section not exist"), len(las.Logs) > 0}
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecCurInfo, las.currentLine, "__ERR__ Curve section is empty, file ignored"}, fmt.Errorf("Curve section not exist"), len(las.Logs) > 0}
|
||||
}
|
||||
|
||||
func stepCheck(chk Check, las *Las) CheckRes {
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, -1, fmt.Sprint("__WRN__ STEP parameter equal 0")}, nil, las.Step != 0.0}
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, las.currentLine, fmt.Sprint("__WRN__ STEP parameter equal 0")}, nil, las.Step != 0.0}
|
||||
}
|
||||
|
||||
func nullCheck(chk Check, las *Las) CheckRes {
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, -1, fmt.Sprint("__WRN__ NULL parameter equal 0")}, nil, las.Null != 0.0}
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, las.currentLine, fmt.Sprint("__WRN__ NULL parameter equal 0")}, nil, las.Null != 0.0}
|
||||
}
|
||||
|
||||
func strtStop(chk Check, las *Las) CheckRes {
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, -1, fmt.Sprintf("__WRN__ STRT: %4.3f == STOP: %4.3f", las.Strt, las.Stop)}, nil, las.Strt != las.Stop}
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, las.currentLine, fmt.Sprintf("__WRN__ STRT: %4.3f == STOP: %4.3f", las.Strt, las.Stop)}, nil, las.Strt != las.Stop}
|
||||
}
|
||||
|
||||
func wellIsEmpty(chk Check, las *Las) CheckRes {
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, -1, fmt.Sprintf("__WRN__ WELL: '%s' is empty", las.Well)}, nil, len(las.Well) != 0}
|
||||
return CheckRes{chk.name, TWarning{directOnRead, lasSecWellInfo, las.currentLine, fmt.Sprintf("__WRN__ WELL: '%s' is empty", las.Well)}, nil, len(las.Well) != 0}
|
||||
}
|
||||
|
|
43
las_test.go
43
las_test.go
|
@ -40,28 +40,28 @@ func TestGetMnemonic(t *testing.T) {
|
|||
func TestReachingMaxAmountWarnings(t *testing.T) {
|
||||
las := NewLas()
|
||||
las.Open(fp.Join("data/more_20_warnings.las"))
|
||||
// Добавить MaxAmountWarning и остановить подсчет предупреждений
|
||||
// Add a MaxAmountWarning and stop counting warnings.
|
||||
assert.Equal(t, 21, las.Warnings.Count(), fmt.Sprintf("<TestReachingMaxAmountWarnings> on read file data\\more_20_warnings.las warning count: %d\n", las.Warnings.Count()))
|
||||
//by default maximum warning count is 21
|
||||
assert.Equal(t, 21, las.Warnings.Count(), fmt.Sprintf("<TestReachingMaxAmountWarnings> on 'data\\more_20_warnings.las' wrong count warning: %d\n", las.Warnings.Count()))
|
||||
|
||||
// system var glasio.ExpPoints indicates the size of the buffer for the data being read, in order to control the occurrence of the overflow processing
|
||||
// event of this buffer, we reduce this buffer before reading
|
||||
// decrease temporary buffer
|
||||
ExpPoints = 2
|
||||
las = NewLas()
|
||||
las.maxWarningCount = 100
|
||||
las.Open(fp.Join("data/more_20_warnings.las"))
|
||||
assert.Equal(t, 41, las.Warnings.Count(), fmt.Sprintf("<TestReachingMaxAmountWarnings> on read file data\\more_20_warnings.las warning count: %d expected 62\n", las.Warnings.Count()))
|
||||
assert.Equal(t, 41, las.Warnings.Count(), fmt.Sprintf("<TestReachingMaxAmountWarnings> on file 'data\\more_20_warnings.las' wrong warning number: %d expected 41\n", las.Warnings.Count()))
|
||||
|
||||
// SaveWarning () не добавляет к las.Warnings
|
||||
// SaveWarning() does not add to las.Warnings.
|
||||
las.SaveWarning(fp.Join("data/more_20_warnings.wrn"))
|
||||
assert.Equal(t, 41, las.Warnings.Count(), fmt.Sprintf("<TestReachingMaxAmountWarnings> on read file data\\more_20_warnings.las warning count: %d expected 62\n", las.Warnings.Count()))
|
||||
assert.Equal(t, 41, las.Warnings.Count(), fmt.Sprintf("<TestReachingMaxAmountWarnings> after las.SaveWarning() number warning changed: %d expected 41\n", las.Warnings.Count()))
|
||||
|
||||
// Если SaveWarning () не может записать в параметр файла, то это не ноль
|
||||
// If SaveWarning() fails to write to the file parameter, then it is not nil.
|
||||
// test for error occure when SaveWarning() fails to write to the file
|
||||
assert.NotNil(t, las.SaveWarning(""))
|
||||
}
|
||||
|
||||
//тестируем особые случаи открытия
|
||||
//пустые имена файлов, файлы в неправильной кодировке
|
||||
//test special cases
|
||||
//empty file name, file in wrong encoding
|
||||
func TestLasOpenSpeсial(t *testing.T) {
|
||||
las := NewLas()
|
||||
n, err := las.Open("")
|
||||
|
@ -71,15 +71,15 @@ func TestLasOpenSpeсial(t *testing.T) {
|
|||
|
||||
// If the file is not found different operating systems resport a different message
|
||||
// assert.Equal(t, "open : The system cannot find the file specified.", err.Error())
|
||||
err_bool := false
|
||||
err_msg := err.Error()
|
||||
err_msgs := []string{"open : The system cannot find the file specified.", "open : no such file or directory"}
|
||||
for _, msg := range err_msgs {
|
||||
if msg == err_msg {
|
||||
err_bool = true
|
||||
errBool := false
|
||||
errMsg := err.Error()
|
||||
errMsgs := []string{"open : The system cannot find the file specified.", "open : no such file or directory"}
|
||||
for _, msg := range errMsgs {
|
||||
if msg == errMsg {
|
||||
errBool = true
|
||||
}
|
||||
}
|
||||
assert.True(t, err_bool)
|
||||
assert.True(t, errBool)
|
||||
|
||||
n, err = las.Open(fp.Join("data/utf-32be-bom.las"))
|
||||
//this decode not support, return error
|
||||
|
@ -103,12 +103,15 @@ var dLoadHeader = []tLoadHeader{
|
|||
{fp.Join("data/2.0/cp1251_2.0_well_name.las"), 2.0, "NO", 0.0, 39.9, 0.3, -999.25, "Примерная-1 / бис(ё)"},
|
||||
{fp.Join("data/2.0/cp1251_2.0_based.las"), 2.0, "NO", 0.0, 39.9, 0.3, -999.25, "Примерная-1/бис(ё)"},
|
||||
{fp.Join("data/expand_points_01.las"), 1.2, "NO", 1.0, 1.0, 0.1, -9999.00, "12-Сплошная"},
|
||||
{fp.Join("data/more_20_warnings.las"), 1.2, "NO", 0.0, 0.0, 0.0, -32768.0, "6"}, //in las file STEP=0.0 but this incorrect, LoadHeader replace STEP to actual from data
|
||||
{fp.Join("data/expand_points_01.las"), 1.2, "NO", 1.0, 1.0, 0.1, -9999.0, "12-Сплошная"},
|
||||
{fp.Join("data/1.2/sample.las"), 1.2, "NO", 1670.0, 1660.0, -0.1250, -999.2500, "ANY ET AL OIL WELL #12"},
|
||||
{fp.Join("data/2.0/sample_2.0.las"), 2.0, "NO", 1670.0, 1660.0, -0.1250, -999.2500, "AAAAA_2"},
|
||||
{fp.Join("data/duplicate_step.las"), 1.2, "NO", 1670.0, 1660.0, -0.1200, -999.2500, "ANY ET AL OIL WELL #12"}, //duplicate_step.las contains two line with STEP:: STEP.M -0.1250: STEP.M -0.1200: using LAST parameter
|
||||
{fp.Join("data/encodings_utf8.las"), 1.2, "NO", 1670.0, 1660.0, -0.1250, -999.2500, "Скв #12Ω"},
|
||||
{fp.Join("data/broken_parameter.las"), 2.0, "NO", 0.0, 39.9, 0.3, -999.25, "Примерная-1 / бис(ё)"}, // file contain error on STRT
|
||||
{fp.Join("data/broken_header.las"), 2.0, "NO", 0.0, 39.9, 0.3, -999.25, "Примерная-1 / бис(ё)"}, // file contain only part of header
|
||||
{fp.Join("data/more_20_warnings.las"), 1.2, "NO", 0.0, 0.0, 0.0, -32768.0, "6"}, // TODO STEP=0.0 but this incorrect, LoadHeader must replace STEP to actual from data
|
||||
{fp.Join("data/duplicate_step.las"), 1.2, "NO", 1670.0, 1660.0, -0.1200, -999.2500, "ANY ET AL OIL WELL #12"}, // duplicate_step.las contains two line with STEP:: STEP.M -0.1250: STEP.M -0.1200: using LAST parameter
|
||||
{fp.Join("data/encodings_utf8.las"), 1.2, "NO", 1670.0, 1660.0, -0.1250, -999.2500, "Скв #12Ω"}, // well name contain unicode char
|
||||
{fp.Join("test_files/warning-test-files/01-STOP-02.las"), 2.0, "NO", 0.0, -999.2500, 0.1, -999.25, "Скв #12"}, // STOP not exist
|
||||
}
|
||||
|
||||
func TestLoadHeader(t *testing.T) {
|
||||
|
|
|
@ -38,7 +38,7 @@ func (o *TWarning) ToCsvString(sep ...string) string {
|
|||
case 1:
|
||||
fieldSep = sep[0]
|
||||
}
|
||||
return fmt.Sprintf("%d%s%d%s\"%s\"", o.section, fieldSep, o.line, fieldSep, o.desc)
|
||||
return fmt.Sprintf("%d%s %d%s \"%s\"", o.section, fieldSep, o.line, fieldSep, o.desc)
|
||||
}
|
||||
|
||||
//TLasWarnings - class to store and manipulate warnings
|
||||
|
|
|
@ -2,34 +2,29 @@ package glasio
|
|||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestToCsvString(t *testing.T) {
|
||||
w := TWarning{1, 1, 1, "first"}
|
||||
if w.ToCsvString() != "1;1;\"first\"" {
|
||||
t.Errorf("<TWarning.ToString()> return not correct string: %s\n", w.ToCsvString())
|
||||
}
|
||||
assert.Equal(t, "1; 1; \"first\"", w.ToCsvString())
|
||||
|
||||
w = TWarning{2, 2, 2, " второе сообщение "}
|
||||
assert.Equal(t, "2,\t 2,\t \" второе сообщение \"", w.ToCsvString(",\t"))
|
||||
|
||||
w = TWarning{1, 1, 1, "first"}
|
||||
if w.ToCsvString(",\t") != "1,\t1,\t\"first\"" {
|
||||
t.Errorf("<TWarning.ToString()> return not correct string: %s\n", w.ToCsvString())
|
||||
}
|
||||
assert.Equal(t, "1, 1, \"first\"", w.ToCsvString(","))
|
||||
}
|
||||
|
||||
func TestLasWarningsToString(t *testing.T) {
|
||||
warnings := TLasWarnings{}
|
||||
if warnings.ToString("") != "" {
|
||||
t.Errorf("<TLasWarnings.ToString> on empty input return not empty string\n")
|
||||
}
|
||||
assert.Equal(t, "", warnings.ToString(""))
|
||||
|
||||
warnings = TLasWarnings{
|
||||
TWarning{1, 1, 1, "first"},
|
||||
TWarning{2, 2, 2, "second"},
|
||||
}
|
||||
s := warnings.ToString("#")
|
||||
if s != "1,1,\"first\"#2,2,\"second\"#" {
|
||||
t.Errorf("<TLasWarnings.ToString> not correct return: %s\n", s)
|
||||
}
|
||||
s = warnings.ToString("\n")
|
||||
if s != "1,1,\"first\"\n2,2,\"second\"\n" {
|
||||
t.Errorf("<TLasWarnings.ToString> not correct return: %s\n", s)
|
||||
}
|
||||
assert.Equal(t, "1, 1, \"first\"#2, 2, \"second\"#", warnings.ToString("#"))
|
||||
assert.Equal(t, "1, 1, \"first\"\n2, 2, \"second\"\n", warnings.ToString("\n"))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
~Version information
|
||||
VERS. 2.0 : glas (c) softlandia@gmail.com
|
||||
WRAP. NO : ONE LINE PER DEPTH STEP
|
||||
~Well information
|
||||
STRT.M 0.0 :START DEPTH
|
||||
STOP.M -999.25 :STOP DEPTH
|
||||
STEP.M 0.100 :STEP
|
||||
NULL. -999.250 :NULL VALUE
|
||||
WELL. <20>ਬ¥à ï-101 /"¡¨á" :WELL
|
||||
~Curve Information Section
|
||||
DEPT.M :
|
||||
LL3.ohmm :
|
||||
~ASCII Log Data
|
||||
# DEPT | LL3 |
|
||||
0.000 1.100
|
||||
0.100 2.000
|
||||
0.200 3.000
|
||||
0.300 4.000
|
||||
0.400 5.200
|
|
@ -0,0 +1,18 @@
|
|||
~Version information
|
||||
VERS. 2.0 : glas (c) softlandia@gmail.com
|
||||
WRAP. NO : ONE LINE PER DEPTH STEP
|
||||
~Well information
|
||||
STRT.M 0.0 :START DEPTH
|
||||
STEP.M 0.100 :STEP
|
||||
NULL. -999.250 :NULL VALUE
|
||||
WELL. ‘ª¢ #12 :WELL
|
||||
~Curve Information Section
|
||||
DEPT.M :
|
||||
LL3.ohmm :
|
||||
~ASCII Log Data
|
||||
# DEPT | LL3 |
|
||||
0.000 1.100
|
||||
0.100 2.000
|
||||
0.200 3.000
|
||||
0.300 4.000
|
||||
0.400 5.200
|
|
@ -0,0 +1,19 @@
|
|||
~Version information
|
||||
VERS. 2.0 : glas (c) softlandia@gmail.com
|
||||
WRAP. NO : ONE LINE PER DEPTH STEP
|
||||
~Well information
|
||||
STRT.M 0.1 :START DEPTH
|
||||
STOP.M
|
||||
STEP.M 0.1 :STEP
|
||||
NULL. -999.250 :NULL VALUE
|
||||
WELL. <20>ਬ¥à ï-101 /"¡¨á" :WELL
|
||||
~Curve Information Section
|
||||
DEPT.M :
|
||||
LL3.ohmm :
|
||||
~ASCII Log Data
|
||||
# DEPT | LL3 |
|
||||
0.100 1.100
|
||||
0.200 2.000
|
||||
0.300 3.000
|
||||
0.400 4.000
|
||||
0.500 5.200
|
|
@ -0,0 +1,20 @@
|
|||
# STRT == STOP
|
||||
~Version information
|
||||
VERS. 2.0 : glas (c) softlandia@gmail.com
|
||||
WRAP. NO : ONE LINE PER DEPTH STEP
|
||||
~Well information
|
||||
STRT.M 0.0 :START DEPTH
|
||||
STOP.M 0.0 :STOP DEPTH
|
||||
STEP.M 0.100 :STEP
|
||||
NULL. -999.250 :NULL VALUE
|
||||
WELL. <20>ਬ¥à ï-101 /"¡¨á" :WELL
|
||||
~Curve Information Section
|
||||
DEPT.M :
|
||||
LL3.ohmm :
|
||||
~ASCII Log Data
|
||||
# DEPT | LL3 |
|
||||
0.000 1.100
|
||||
0.100 2.000
|
||||
0.200 3.000
|
||||
0.300 4.000
|
||||
0.400 5.200
|
|
@ -0,0 +1,19 @@
|
|||
# STRT not exist
|
||||
~Version information
|
||||
VERS. 2.0 : glas (c) softlandia@gmail.com
|
||||
WRAP. NO : ONE LINE PER DEPTH STEP
|
||||
~Well information
|
||||
STOP.M 0.400 :STOP DEPTH
|
||||
STEP.M 0.100 :STEP
|
||||
NULL. -999.250 :NULL VALUE
|
||||
WELL. <20>ਬ¥à ï-101 /"¡¨á" :WELL
|
||||
~Curve Information Section
|
||||
DEPT.M :
|
||||
LL3.ohmm :
|
||||
~ASCII Log Data
|
||||
# DEPT | LL3 |
|
||||
0.000 1.100
|
||||
0.100 2.000
|
||||
0.200 3.000
|
||||
0.300 4.000
|
||||
0.400 5.200
|
|
@ -0,0 +1,20 @@
|
|||
# STRT == NULL
|
||||
~Version information
|
||||
VERS. 2.0 : glas (c) softlandia@gmail.com
|
||||
WRAP. NO : ONE LINE PER DEPTH STEP
|
||||
~Well information
|
||||
STRT.M -999.25 :START DEPTH
|
||||
STOP.M 0.400 :STOP DEPTH
|
||||
STEP.M 0.100 :STEP
|
||||
NULL. -999.250 :NULL VALUE
|
||||
WELL. <20>ਬ¥à ï-101 /"¡¨á" :WELL
|
||||
~Curve Information Section
|
||||
DEPT.M :
|
||||
LL3.ohmm :
|
||||
~ASCII Log Data
|
||||
# DEPT | LL3 |
|
||||
0.000 1.100
|
||||
0.100 2.000
|
||||
0.200 3.000
|
||||
0.300 4.000
|
||||
0.400 5.200
|
|
@ -0,0 +1,20 @@
|
|||
# STRT == not number
|
||||
~Version information
|
||||
VERS. 2.0 : glas (c) softlandia@gmail.com
|
||||
WRAP. NO : ONE LINE PER DEPTH STEP
|
||||
~Well information
|
||||
STRT.M . :START DEPTH
|
||||
STOP.M 0.400 :STOP DEPTH
|
||||
STEP.M 0.100 :STEP
|
||||
NULL. -999.250 :NULL VALUE
|
||||
WELL. <20>ਬ¥à ï-101 /"¡¨á" :WELL
|
||||
~Curve Information Section
|
||||
DEPT.M :
|
||||
LL3.ohmm :
|
||||
~ASCII Log Data
|
||||
# DEPT | LL3 |
|
||||
0.000 1.100
|
||||
0.100 2.000
|
||||
0.200 3.000
|
||||
0.300 4.000
|
||||
0.400 5.200
|
|
@ -0,0 +1,19 @@
|
|||
~Version information
|
||||
VERS. 2.0 : glas (c) softlandia@gmail.com
|
||||
WRAP. NO : ONE LINE PER DEPTH STEP
|
||||
~Well information
|
||||
STRT.M 0.0 :START DEPTH
|
||||
STOP.M 0.400 :STOP DEPTH
|
||||
STEP.M 0.100 :STEP
|
||||
NULL. -999.250 :NULL VALUE
|
||||
WELL. <20>ਬ¥à ï-101 /"¡¨á" :WELL
|
||||
~Curve Information Section
|
||||
DEPT.M :
|
||||
LL3.ohmm :
|
||||
~ASCII Log Data
|
||||
# DEPT | LL3 |
|
||||
0.000 1.100
|
||||
0.100 2.000
|
||||
0.200 3.000
|
||||
0.300 4.000
|
||||
0.400 5.200
|
Загрузка…
Ссылка в новой задаче