зеркало из https://github.com/softlandia/glasio.git
Merge pull request #16 from dcslagel/text-changes
Add minor text improvements
This commit is contained in:
Коммит
5da5292711
|
@ -6,12 +6,12 @@
|
|||
>install: go install
|
||||
|
||||
The library makes it easy to read or write data in LAS format.
|
||||
The main reason for the development was the need to read and bring in a uniform form a large number of LAS files obtained from various sources
|
||||
The main reason for the development was the need to read and standardize a large number of LAS files obtained from various sources
|
||||
|
||||
Features:
|
||||
|
||||
1. The encoding is determined automatically
|
||||
2. On reading performed validation of the key parameters and is integrity of the structure LAS file
|
||||
2. On reading perform validation of the key parameters and integrity of the structure LAS file
|
||||
3. Messages are generated for all inconsistencies:
|
||||
- zero value of important parameters
|
||||
- depth step change in data section
|
||||
|
@ -24,7 +24,7 @@ Features:
|
|||
6. It is possible to specify a dictionary of standard mnemonics; when reading a file, messages about curves that do not match the specified ones will be generated
|
||||
7. It is possible to specify a dictionary of automatic substitution of mnemonics, respectively, curves with the given names will be renamed
|
||||
|
||||
__WRAP__ las file not support
|
||||
Wrapped (__WRAP__) las files are not supported
|
||||
|
||||
## dependences ##
|
||||
|
||||
|
@ -52,7 +52,7 @@ lasin
|
|||
## tests ##
|
||||
|
||||
coverage 91%
|
||||
folder "data" contain files for testing, no remove/change/add
|
||||
The "data" folder contains files for testing, no remove/change/add
|
||||
|
||||
## technical info ##
|
||||
|
||||
|
@ -78,8 +78,8 @@ 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
|
||||
if las file contains duplication of any parameter, then use the first in curve
|
||||
section used all curves name. The subsequent duplicated parameter is renamed.
|
||||
|
||||
## warnings generated when reading a LAS file ##
|
||||
|
||||
|
@ -90,4 +90,3 @@ extended:
|
|||
> x - section number
|
||||
> y - line number of input file
|
||||
|
||||
short:
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
this example program uses the softlandia / glasio package to read a LAS file
|
||||
|
||||
the program reads the input las file and put warnings to the console
|
||||
the program reads the input las file and puts warnings to the console
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
)
|
||||
|
||||
// Sample
|
||||
// read one file and print to stdout all warnings:
|
||||
// read one file and print all warnings to stdout:
|
||||
// warning number, number of line in las file, message
|
||||
func main() {
|
||||
if len(os.Args) == 1 {
|
||||
|
|
12
las.go
12
las.go
|
@ -24,7 +24,7 @@ import (
|
|||
|
||||
// Las - class to store las file
|
||||
// input code page autodetect
|
||||
// at read file always code page converted to UTF
|
||||
// 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 есть возможность указать кодировку записи, нужна возможность указать явно кодировку чтения
|
||||
|
@ -165,13 +165,13 @@ func (las *Las) ReadRows() int {
|
|||
}
|
||||
|
||||
// Load - load las from reader
|
||||
// you can make reader from string or othe containers and send as input parameters
|
||||
// you can make reader from string or other containers and send as input parameters
|
||||
func (las *Las) Load(reader io.Reader) (int, error) {
|
||||
var err error
|
||||
if reader == nil {
|
||||
return 0, errors.New("Load received nil reader")
|
||||
}
|
||||
//create Reader, this reader decode to UTF-8 from reader
|
||||
//create Reader, this reader decodes to UTF-8 from reader
|
||||
las.Reader, err = cpd.NewReader(reader)
|
||||
if err != nil {
|
||||
return 0, err //FATAL error - file cannot be decoded to UTF-8
|
||||
|
@ -362,7 +362,7 @@ func (las *Las) LoadDataSec(m int) (int, error) {
|
|||
for j := 1; j < n; j++ { // цикл по каротажам
|
||||
s := ""
|
||||
if j >= len(fields) {
|
||||
s = nullAsStr // columns count in current line less then curves count, fill as null value
|
||||
s = nullAsStr // columns count in current line less than curves count, fill as null value
|
||||
las.addWarning(TWarning{directOnRead, lasSecData, las.currentLine, fmt.Sprintf("for column %d data not present, value set to NULL", j+1)})
|
||||
} else {
|
||||
s = fields[j]
|
||||
|
@ -607,7 +607,7 @@ func (las *Las) SaveWarning(fileName string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// SaveWarningToWriter - store all warning to writer, return count lines writed to
|
||||
// SaveWarningToWriter - store all warning to writer, return count lines written to
|
||||
func (las *Las) SaveWarningToWriter(writer *bufio.Writer) int {
|
||||
n := las.Warnings.Count()
|
||||
if n == 0 {
|
||||
|
@ -620,7 +620,7 @@ func (las *Las) SaveWarningToWriter(writer *bufio.Writer) int {
|
|||
return n
|
||||
}
|
||||
|
||||
// SaveWarningToFile - store all warning to file, file not close. return count warning writed
|
||||
// SaveWarningToFile - store all warning to file, file not close. return count warning written
|
||||
func (las *Las) SaveWarningToFile(oFile *os.File) int {
|
||||
if oFile == nil {
|
||||
return 0
|
||||
|
|
10
las_param.go
10
las_param.go
|
@ -65,7 +65,7 @@ func defParse(s string, i int) (HeaderParam, TWarning) {
|
|||
return *p, TWarning{}
|
||||
}
|
||||
|
||||
// NewOthSection - create section ~W
|
||||
// NewOthSection - create section ~O
|
||||
func NewOthSection() HeaderSection {
|
||||
sec := HeaderSection{}
|
||||
sec.name = 'O'
|
||||
|
@ -74,7 +74,7 @@ func NewOthSection() HeaderSection {
|
|||
return sec
|
||||
}
|
||||
|
||||
// NewParSection - create section ~W
|
||||
// NewParSection - create section ~P
|
||||
func NewParSection() HeaderSection {
|
||||
sec := HeaderSection{}
|
||||
sec.name = 'P'
|
||||
|
@ -282,7 +282,7 @@ func NewLasCurve(s string, las *Las) LasCurve {
|
|||
lc.Name = las.Logs.UniqueName(lc.IName)
|
||||
lc.Unit = curveFields[1]
|
||||
lc.Desc = curveFields[2]
|
||||
lc.Index = len(las.Logs) // index of new curve == number of curve already in container
|
||||
lc.Index = len(las.Logs) // index of new curve == number of curves already in container
|
||||
lc.Mnemonic = las.GetMnemonic(lc.IName) // мнемонику определяем по входному имени кривой
|
||||
// вместимость слайсов для хранения данных равна количеству строк в исходном файле
|
||||
lc.D = make([]float64, 0, las.NumPoints())
|
||||
|
@ -317,11 +317,11 @@ func (o *LasCurve) SetLen(n int) {
|
|||
o.V = t
|
||||
}
|
||||
|
||||
// LasCurves - container for store all curves of las file
|
||||
// LasCurves - container to store all curves of las file
|
||||
// .Cmp(curves *LasCurves) bool - compare two curves containers
|
||||
type LasCurves []LasCurve
|
||||
|
||||
// Captions - return string represent all curves name with separators for las file
|
||||
// Captions - return string represents all curve names with separators for las file
|
||||
// use as comment string after section ~A
|
||||
func (curves LasCurves) Captions() string {
|
||||
var sb strings.Builder
|
||||
|
|
|
@ -62,7 +62,7 @@ func TestReachingMaxAmountWarnings(t *testing.T) {
|
|||
las.SaveWarning(fp.Join("data/more_20_warnings.wrn"))
|
||||
assert.Equal(t, 38, las.Warnings.Count(), fmt.Sprintf("<TestReachingMaxAmountWarnings> after las.SaveWarning() number warning changed: %d expected 38\n", las.Warnings.Count()))
|
||||
|
||||
// test for error occure when SaveWarning() fails to write to the file
|
||||
// test for error occur when SaveWarning() fails to write to the file
|
||||
assert.NotNil(t, las.SaveWarning(""))
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/softlandia/cpd"
|
||||
)
|
||||
|
||||
// isIgnoredLine - check string s to empty or LAS format comment
|
||||
// isIgnoredLine - check whether string s is empty or LAS format comment
|
||||
func isIgnoredLine(s string) bool {
|
||||
if (len(s) == 0) || (s[0] == '#') {
|
||||
return true
|
||||
|
|
Загрузка…
Ссылка в новой задаче