v0.2.4 use containers to store all parameters

This commit is contained in:
softlandia 2020-06-30 01:14:03 +04:00
Родитель 769b1052a0
Коммит 404896836c
4 изменённых файлов: 66 добавлений и 33 удалений

Просмотреть файл

@ -56,6 +56,28 @@ folder "data" contain files for testing, no remove/change/add
## technical info ##
### how type Las store data ###
access to main parameters:
las.VERS()
las.WRAP()
las.STEP()
las.STRT()
las.STOP()
las.NULL()
las.WELL()
number of points and curves:
las.NumPoints() - number of points
len(las.Logs) - number of curves
access to curves and data:
las.Logs[0].D[0] - first depth
las.Logs[1].V[100] - value of first curve on 101 depth step
las.Logs[2].Name - name of second curve
las.Logs[2].Unit - unit of second curve
las.Logs[2].Mnemonic - mnemonic of second curve, the value is determined if the dictionary was applied
if las file contane duplicated of any parameter, then used first
on curve section used all curves name, duplicated renamed

Просмотреть файл

@ -1,6 +1,6 @@
**file: data\more_20_warnings.las**
0, line: 24, "__WRN__ STEP parameter equal 0"
1, line: 24, "__WRN__ STRT: 0.000 == STOP: 0.000"
0, line: 24, "__WRN__ STRT: 0.000 == STOP: 0.000"
1, line: 24, "__WRN__ STEP parameter equal 0"
2, line: 24, "error convert string: '6.2.24' to number, set to NULL"
3, line: 25, "line contains 5 columns, expected: 6"
4, line: 25, "error convert string: '528.07202215.58' to number, set to NULL"

Просмотреть файл

@ -1,5 +1,5 @@
line: 24, "__WRN__ STRT: 0.000 == STOP: 0.000"
line: 24, "__WRN__ STEP parameter equal 0"
line: 24, "__WRN__ STRT: 0.000 == STOP: 0.000"
line: 24, "error convert string: '6.2.24' to number, set to NULL"
line: 25, "line contains 5 columns, expected: 6"
line: 25, "error convert string: '528.07202215.58' to number, set to NULL"

Просмотреть файл

@ -23,41 +23,45 @@ type tSummaryCheck struct {
curv int //количество кривых в файле
nums int //количество точек в файле
werr bool //не используется
d1, //значение первой точки по глубине
dn, //значение последней точки по глубине (если есть)
v1, //значение первой кривой на первой глубине
vn float64 //значение первой кривой на последней глубине (если есть)
}
var dSummaryCheck = []tSummaryCheck{
{fp.Join("data/barebones.las"), 2.0, "NO", 200, -999.25, 1.1, -999.25, "", 1, 2, true},
{fp.Join("data/6038187_v1.2.las"), 2.0, "NO", 0.05, 136.6, 0.05, -99999, "Scorpio E1", 9, 2732, false},
{fp.Join("data/6038187_v1.2_short.las"), 2.0, "NO", 0.05, 136.6, 0.05, -99999, "Scorpio E1", 9, 121, false},
{fp.Join("data/1001178549.las"), 2.0, "YES", 1783.5, 1784.5, 0.25, -999.25, "1-28", 27, 0, true},
{fp.Join("data/alog.las"), 1.20, "NO", 0, 0, 0.05, -999.25, "", 9, 24, false},
{fp.Join("data/autodepthindex_F.las"), 1.20, "NO", 0, 100, 1, -999.25, "ANY ET AL OIL WELL #12", 2, 101, false},
{fp.Join("data/barebones2.las"), 2.0, "NO", -999.25, -999.25, -999.25, -999.25, "", 0, 0, true}, // step и null не правятся, отсутствует секция Curve, ошибка заголовка
{fp.Join("data/blank_line.las"), 2.0, "NO", -999.25, -999.25, 0.0833333333333333, -999.25, "", 1, 0, true},
{fp.Join("data/data_characters.las"), 2.0, "NO", 0, 0, 10, -999.25, "", 4, 0, true},
{fp.Join("data/duplicate_step.las"), 1.2, "NO", 1670, 1660, -0.125, -999.2111, "ANY ET AL OIL WELL #12", 8, 3, false},
{fp.Join("data/encodings_utf8.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false},
{fp.Join("data/encodings_utf8_20.las"), 2.0, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false},
{fp.Join("data/encodings_utf8wbom.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скважина #12Ω", 8, 3, false},
{fp.Join("data/encodings_utf8wbom_20.las"), 2.0, "NO", 1670, 1660, -0.125, -999.25, "Скважина #12Ω", 8, 3, false},
{fp.Join("data/encodings_utf16be.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false},
{fp.Join("data/encodings_utf16bebom.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false},
{fp.Join("data/encodings_utf16le.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false},
{fp.Join("data/encodings_utf16lebom.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false},
{fp.Join("data/expand_points_01.las"), 1.2, "NO", 1, 1, 0.1, -9999.00, "12-Сплошная", 4, 7, false},
{fp.Join("data/logging_levels.las"), 2.0, "NO", 0, 7273.5, 0.25, -999.25, "TOTEM # 9", 18, 29095, false},
{fp.Join("data/missing_null.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "ANY ET AL OIL WELL #12", 8, 3, false},
{fp.Join("data/missing_vers.las"), 2.0, "NO", 1670, 1660, -0.125, -999.25, "WELL", 8, 3, false},
{fp.Join("data/missing_wrap.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "ANY ET AL OIL WELL #12", 8, 3, false},
{fp.Join("data/more_20_warnings.las"), 1.2, "NO", 0.0, 0.0, 1.0, -32768.0, "6", 6, 22, true}, //in file STEP=0.0 but this incorrect, LoadHeader replace STEP to actual from data
{fp.Join("data/no-data-section.las"), 1.2, "NO", 0.0, 0.0, -32768.0, -32768.0, "6", 31, 0, true}, //in file STEP=0.0 but this incorrect, data section contain incorrect step too, result step equal NULL
{fp.Join("data/sample_bracketed_units.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "ANY ET AL OIL WELL #12", 8, 3, true},
{fp.Join("data/test-curve-sec-empty-mnemonic.las"), 1.2, "NO", 1670, 1669.75, -0.125, -999.25, "ANY ET AL OIL WELL #12", 9, 3, true},
{fp.Join("data/UWI_API_leading_zero.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "ANY ET AL OIL WELL #12", 8, 3, true},
{fp.Join("data/barebones.las"), 2.0, "NO", 200, -999.25, 1.1, -999.25, "", 1, 2, true, 200.0, 201.1, 0, 0},
{fp.Join("data/6038187_v1.2.las"), 2.0, "NO", 0.05, 136.6, 0.05, -99999, "Scorpio E1", 9, 2732, false, 0.05, 136.6, 49.7650, -56.2750},
{fp.Join("data/6038187_v1.2_short.las"), 2.0, "NO", 0.05, 136.6, 0.05, -99999, "Scorpio E1", 9, 121, false, 12.0, 18.0, 101.78, 101.259},
{fp.Join("data/1001178549.las"), 2.0, "YES", 1783.5, 1784.5, 0.25, -999.25, "1-28", 27, 0, true, 0, 0, 0, 0},
{fp.Join("data/alog.las"), 1.20, "NO", 0, 0, 0.05, -999.25, "", 9, 24, false, 0.00, 0.00, 0.00, 0.00},
{fp.Join("data/autodepthindex_F.las"), 1.20, "NO", 0, 100, 1, -999.25, "ANY ET AL OIL WELL #12", 2, 101, false, 0, 100, 0.730568506467, 0.959183036405},
{fp.Join("data/barebones2.las"), 2.0, "NO", -999.25, -999.25, -999.25, -999.25, "", 0, 0, true, 0, 0, 0, 0}, // step и null не правятся, отсутствует секция Curve, ошибка заголовка
{fp.Join("data/blank_line.las"), 2.0, "NO", -999.25, -999.25, 0.0833333333333333, -999.25, "", 1, 0, true, 0, 0, 0, 0},
{fp.Join("data/data_characters.las"), 2.0, "NO", 0, 0, 10, -999.25, "", 4, 0, true, -999.25, -999.25, -999.25, -999.25},
{fp.Join("data/duplicate_step.las"), 1.2, "NO", 1670, 1660, -0.125, -999.2111, "ANY ET AL OIL WELL #12", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/encodings_utf8.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/encodings_utf8_20.las"), 2.0, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/encodings_utf8wbom.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скважина #12Ω", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/encodings_utf8wbom_20.las"), 2.0, "NO", 1670, 1660, -0.125, -999.25, "Скважина #12Ω", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/encodings_utf16be.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/encodings_utf16bebom.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/encodings_utf16le.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/encodings_utf16lebom.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "Скв #12Ω", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/expand_points_01.las"), 1.2, "NO", 1, 1, 0.1, -9999.00, "12-Сплошная", 4, 7, false, 1.0, 1.6, -9999.0, 0},
{fp.Join("data/logging_levels.las"), 2.0, "NO", 0, 7273.5, 0.25, -999.25, "TOTEM # 9", 18, 29095, false, 0.00, 7273.5, 1604.8491, -999.25},
{fp.Join("data/missing_null.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "ANY ET AL OIL WELL #12", 8, 3, false, 1670.0, 1669.75, -999.25, 123.45},
{fp.Join("data/missing_vers.las"), 2.0, "NO", 1670, 1660, -0.125, -999.25, "WELL", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/missing_wrap.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "ANY ET AL OIL WELL #12", 8, 3, false, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/more_20_warnings.las"), 1.2, "NO", 0.0, 0.0, 1.0, -32768.0, "6", 6, 22, true, 1, 2.2e11, -32768.0, 186}, //in file STEP=0.0 but this incorrect, LoadHeader replace STEP to actual from data
{fp.Join("data/no-data-section.las"), 1.2, "NO", 0.0, 0.0, -32768.0, -32768.0, "6", 31, 0, true, 0, 0, 0, 0}, //in file STEP=0.0 but this incorrect, data section contain incorrect step too, result step equal NULL
{fp.Join("data/sample_bracketed_units.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "ANY ET AL OIL WELL #12", 8, 3, true, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/test-curve-sec-empty-mnemonic.las"), 1.2, "NO", 1670, 1669.75, -0.125, -999.25, "ANY ET AL OIL WELL #12", 9, 3, true, 1670.0, 1669.75, 123.45, 123.45},
{fp.Join("data/UWI_API_leading_zero.las"), 1.2, "NO", 1670, 1660, -0.125, -999.25, "ANY ET AL OIL WELL #12", 8, 3, true, 1670.0, 1669.75, 123.45, 123.45},
}
// Основной тест по массиву готовых las файлов
// пока проверки только по параметра в заголовке, нужно сделать пару проверок на данные
// проверяются основные параметры заголовка, количество считанных точек, количество считанных кривых и 4 точки данных (две точки глубины и две точки данных)
func TestSummaryRead(t *testing.T) {
for _, tmp := range dSummaryCheck {
las := NewLas()
@ -75,7 +79,14 @@ func TestSummaryRead(t *testing.T) {
assert.Equal(t, tmp.curv, len(las.Logs), fmt.Sprintf("<TestSummaryRead> curves fail on file: '%s'\n", tmp.fn))
assert.Equal(t, tmp.curv, len(las.CurSec.params), fmt.Sprintf("<TestSummaryRead> curves fail on file: '%s'\n", tmp.fn))
//проверки по данным
//if tmp.nums
if tmp.nums > 0 {
assert.Equal(t, tmp.d1, las.Logs[0].D[0], fmt.Sprintf("<TestSummaryRead> curves fail on file: '%s'\n", tmp.fn))
assert.Equal(t, tmp.dn, las.Logs[0].D[n-1], fmt.Sprintf("<TestSummaryRead> curves fail on file: '%s'\n", tmp.fn))
if tmp.curv > 1 {
assert.Equal(t, tmp.v1, las.Logs[1].V[0], fmt.Sprintf("<TestSummaryRead> curves fail on file: '%s'\n", tmp.fn))
assert.Equal(t, tmp.vn, las.Logs[1].V[n-1], fmt.Sprintf("<TestSummaryRead> curves fail on file: '%s'\n", tmp.fn))
}
}
}
}