las_reader 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +45 -7
- data/lib/las_reader.rb +116 -16
- data/lib/las_reader/version.rb +1 -1
- data/spec/fixtures/files/example21.las +12 -12
- metadata +4 -4
data/README.md
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# LasReader
|
2
2
|
|
3
|
-
cwls-las-reader
|
4
3
|
Ruby gem for reading CWLS LAS files
|
5
4
|
|
6
|
-
The Canadian Well Logging Society
|
5
|
+
The Log ASCII Standard was created by the Canadian Well Logging Society in the late 1980’s. LAS was intended to supply basic digital log data to users of personal computers in a format that was quick and easy to use. LAS is an ASCII file with minimal header information, intended for optically presented log curves. The world-wide acceptance of LAS proved the need for such a format. As users embraced the concept and the format, many new applications of the concept were attempted. Right now the latest version of the LAS format is 3.0.
|
7
6
|
|
8
|
-
|
7
|
+
This gem does not read LAS 3.0 format yet because its initial intent is to be used in E&P data management applications. Version 3.0 was released in June 10, 2000 so most of the data I have access right now is either in 1.2 or 2.0 format.
|
9
8
|
|
10
9
|
## Installation
|
11
10
|
|
@@ -21,11 +20,50 @@ Or install it yourself as:
|
|
21
20
|
|
22
21
|
$ gem install las_reader
|
23
22
|
|
24
|
-
## Quick
|
23
|
+
## Quick Usage
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
require 'rubygems'
|
26
|
+
require 'las_reader'
|
27
|
+
my_las = CWLSLas.new('my_well.las')
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
One of the main fucntionalities of the las_reader is to provide a way to access the curves inside the LAS file and other information regarding the well and about the logged data. Bellow an example of how to get the curve "DEEP RESISTIVITY" from the file [example1.las](https://github.com/gpcarmo/cwls-las-reader/blob/master/spec/fixtures/files/example1.las). You can find this example files inside [spec/fixtures/files](https://github.com/gpcarmo/cwls-las-reader/tree/master/spec/fixtures/files) folder.
|
32
|
+
|
33
|
+
### Examples
|
34
|
+
|
35
|
+
To begin the showing the basic examples, lets start a new CWLSLas object with a file name of an example las. Then we can get the well name:
|
36
|
+
|
37
|
+
my_las = CWLSLas.new('example1.las')
|
38
|
+
my_las.well_name
|
39
|
+
|
40
|
+
=> "ANY ET AL OIL WELL #12"
|
41
|
+
|
42
|
+
|
43
|
+
To get the curve mnemonics inside the file:
|
44
|
+
|
45
|
+
my_las.curve_names
|
46
|
+
|
47
|
+
=> ["ILD", "ILM", "DT", "NPHI", "RHOB", "SFLA", "SFLU", "DEPT"]
|
48
|
+
|
49
|
+
and to get a specific curve use:
|
50
|
+
|
51
|
+
ild_curve = my_las.curve('ILD')
|
52
|
+
|
53
|
+
|
54
|
+
From this new curve object you may want to get the description:
|
55
|
+
|
56
|
+
ild_curve.description
|
57
|
+
|
58
|
+
=> "8 DEEP RESISTIVITY"
|
59
|
+
|
60
|
+
Or, the values of the curve:
|
61
|
+
|
62
|
+
ild_curve.log_data
|
63
|
+
|
64
|
+
=> [105.6, 105.6, 105.6]
|
65
|
+
|
66
|
+
|
29
67
|
|
30
68
|
## Contributing
|
31
69
|
|
data/lib/las_reader.rb
CHANGED
@@ -13,9 +13,9 @@ module LasReader
|
|
13
13
|
attr_reader :well_info
|
14
14
|
|
15
15
|
def set_version(info)
|
16
|
-
version = info.match(/(VERS
|
16
|
+
version = info.match(/(VERS\s*\.).+([1-3]\.[0-9]).*:\s*(.*)/)
|
17
17
|
if version.nil?
|
18
|
-
wrap_mode = info.match(/(WRAP
|
18
|
+
wrap_mode = info.match(/(WRAP\s*\.).+(YES|NO).*:\s*(.*)/)
|
19
19
|
if not wrap_mode.nil?
|
20
20
|
@wrap = (wrap_mode[2] == "YES") ? true : false
|
21
21
|
end
|
@@ -26,7 +26,7 @@ module LasReader
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def set_curve_info(info)
|
29
|
-
mnemonic = info.match(/(\w+)\s*\.(\S*)\s+(.*):\s*(.*)
|
29
|
+
mnemonic = info.match(/(\w+)\s*\.(\S*)\s+(.*):\s*(.*)$/)
|
30
30
|
unless mnemonic.nil?
|
31
31
|
@curves["#{mnemonic[1]}"] = Curve.new(mnemonic[1],mnemonic[2],mnemonic[3],mnemonic[4])
|
32
32
|
@acurves << mnemonic[1]
|
@@ -34,14 +34,13 @@ module LasReader
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def set_parameters(info)
|
37
|
-
mnemonic = info.match(/(\w+)\s*\.(\S+)\s+(.*):\s*(.*)
|
37
|
+
mnemonic = info.match(/(\w+)\s*\.(\S+)\s+(.*):\s*(.*)$/)
|
38
38
|
unless mnemonic.nil?
|
39
39
|
@parameters["#{mnemonic[1]}"] = Mnemonic.new(mnemonic[1],mnemonic[2],mnemonic[3],mnemonic[4])
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
def set_well_info(info)
|
44
|
-
|
45
44
|
strt = info.match(/(STRT)\s*\.(\w).+\s([0-9]+\.[0-9]+).*:\s*(.*)/)
|
46
45
|
unless strt.nil?
|
47
46
|
@well_info.start_depth = strt[3].to_f
|
@@ -67,67 +66,67 @@ module LasReader
|
|
67
66
|
return
|
68
67
|
end
|
69
68
|
|
70
|
-
comp = info.match(/(COMP\s*\..+COMPANY:\s*(.*))|(COMP\s*\.\s*(.*)\s
|
69
|
+
comp = info.match(/(COMP\s*\..+COMPANY:\s*(.*))|(COMP\s*\.\s*(.*)\s+:\s*COMPANY)/)
|
71
70
|
unless comp.nil?
|
72
71
|
@well_info.company_name = (comp[2] or comp[4]).strip
|
73
72
|
return
|
74
73
|
end
|
75
74
|
|
76
|
-
well = info.match(/(WELL\s*\..+WELL:\s*(.*))|(WELL\s*\.\s*(.*)\s
|
75
|
+
well = info.match(/(WELL\s*\..+WELL:\s*(.*))|(WELL\s*\.\s*(.*)\s+:\s*WELL)/)
|
77
76
|
unless well.nil?
|
78
77
|
@well_info.well_name = (well[2] or well[4]).strip
|
79
78
|
return
|
80
79
|
end
|
81
80
|
|
82
|
-
fld = info.match(/(FLD\s*\..+FIELD:\s*(.*))|(FLD\s*\.\s*(.*)\s
|
81
|
+
fld = info.match(/(FLD\s*\..+FIELD:\s*(.*))|(FLD\s*\.\s*(.*)\s+:\s*FIELD)/)
|
83
82
|
unless fld.nil?
|
84
83
|
@well_info.field_name = (fld[2] or fld[4]).strip
|
85
84
|
return
|
86
85
|
end
|
87
86
|
|
88
|
-
loc = info.match(/(LOC\s*\..+LOCATION:\s*(.*))|(LOC\s*\.\s*(.*)\s
|
87
|
+
loc = info.match(/(LOC\s*\..+LOCATION:\s*(.*))|(LOC\s*\.\s*(.*)\s+:\s*LOCATION)/)
|
89
88
|
unless loc.nil?
|
90
89
|
@well_info.location = (loc[2] or loc[4]).strip
|
91
90
|
return
|
92
91
|
end
|
93
92
|
|
94
|
-
prov = info.match(/(PROV\s*\..+PROVINCE:\s*(.*))|(PROV\s*\.\s*(.*)\s
|
93
|
+
prov = info.match(/(PROV\s*\..+PROVINCE:\s*(.*))|(PROV\s*\.\s*(.*)\s+:\s*PROVINCE)/)
|
95
94
|
unless prov.nil?
|
96
95
|
@well_info.province = (prov[2] or prov[4]).strip
|
97
96
|
return
|
98
97
|
end
|
99
98
|
|
100
|
-
cnty = info.match(/(CNTY\s*\..+COUNTY:\s*(.*))|(CNTY\s*\.\s*(.*)\s
|
99
|
+
cnty = info.match(/(CNTY\s*\..+COUNTY:\s*(.*))|(CNTY\s*\.\s*(.*)\s+:\s*COUNTY)/)
|
101
100
|
unless cnty.nil?
|
102
101
|
@well_info.county = (cnty[2] or cnty[4]).strip
|
103
102
|
return
|
104
103
|
end
|
105
104
|
|
106
|
-
stat = info.match(/(STAT\s*\..+STATE:\s*(.*))|(STAT\s*\.\s*(.*)\s
|
105
|
+
stat = info.match(/(STAT\s*\..+STATE:\s*(.*))|(STAT\s*\.\s*(.*)\s+:\s*STATE)/)
|
107
106
|
unless stat.nil?
|
108
107
|
@well_info.state = (stat[2] or stat[4]).strip
|
109
108
|
return
|
110
109
|
end
|
111
110
|
|
112
|
-
ctry = info.match(/(CTRY\s*\..+COUNTRY:\s*(.*))|(CTRY\s*\.\s*(.*)\s
|
111
|
+
ctry = info.match(/(CTRY\s*\..+COUNTRY:\s*(.*))|(CTRY\s*\.\s*(.*)\s+:\s*COUNTRY)/)
|
113
112
|
unless ctry.nil?
|
114
113
|
@well_info.country = (ctry[2] or ctry[4]).strip
|
115
114
|
return
|
116
115
|
end
|
117
116
|
|
118
|
-
srvc = info.match(/(SRVC\s*\..+SERVICE COMPANY:\s*(.*))|(SRVC\s*\.\s*(.*)\s
|
117
|
+
srvc = info.match(/(SRVC\s*\..+SERVICE COMPANY:\s*(.*))|(SRVC\s*\.\s*(.*)\s+:\s*SERVICE COMPANY)/)
|
119
118
|
unless srvc.nil?
|
120
119
|
@well_info.service_company = (srvc[2] or srvc[4]).strip
|
121
120
|
return
|
122
121
|
end
|
123
122
|
|
124
|
-
data = info.match(/(DATE\s*\..+LOG DATE:\s*(.*))|(DATE\s*\.\s*(.*)\s
|
123
|
+
data = info.match(/(DATE\s*\..+LOG DATE:\s*(.*))|(DATE\s*\.\s*(.*)\s+:\s*LOG DATE)/)
|
125
124
|
unless data.nil?
|
126
125
|
@well_info.date_logged = (data[2] or data[4]).strip
|
127
126
|
return
|
128
127
|
end
|
129
128
|
|
130
|
-
uwi = info.match(/(UWI\s*\..+UNIQUE WELL ID:\s*(.*))|(UWI\s*\.\s*(.*)\s
|
129
|
+
uwi = info.match(/(UWI\s*\..+UNIQUE WELL ID:\s*(.*))|(UWI\s*\.\s*(.*)\s+:\s*UNIQUE WELL ID)/)
|
131
130
|
unless uwi.nil?
|
132
131
|
@well_info.uwi = (uwi[2] or uwi[4]).strip
|
133
132
|
return
|
@@ -227,46 +226,147 @@ class CWLSLas
|
|
227
226
|
|
228
227
|
include LasReader
|
229
228
|
|
229
|
+
# Initialize CWLSLas object passing las file as argument
|
230
|
+
#
|
231
|
+
# Example:
|
232
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
233
|
+
# => #<CWLSLas>
|
234
|
+
#
|
235
|
+
# Arguments:
|
236
|
+
# las_file_name: (String)
|
237
|
+
|
230
238
|
def initialize(filename=nil)
|
231
239
|
load_file(filename) if not filename.nil?
|
232
240
|
end
|
233
241
|
|
242
|
+
# Return a list of mnemonics representing the curve names
|
243
|
+
#
|
244
|
+
# Example:
|
245
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
246
|
+
# => #<CWLSLas>
|
247
|
+
# >> my_well.curve_names
|
248
|
+
# => ["ILD", "ILM", "DT", "NPHI", "RHOB", "SFLA", "SFLU", "DEPT"]
|
249
|
+
#
|
250
|
+
|
234
251
|
def curve_names
|
235
252
|
self.curves.keys
|
236
253
|
end
|
237
254
|
|
255
|
+
# Returns an object representing the curve selected
|
256
|
+
#
|
257
|
+
# Example:
|
258
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
259
|
+
# => #<CWLSLas>
|
260
|
+
# >> my_well.curve('ILD')
|
261
|
+
# => #<LasReader::Curve:0x7f @description="DEEP RESISTIVITY", @unit="OHMM", @name="ILD", @log_data=[105.6, 105.6, 105.6]>
|
262
|
+
#
|
263
|
+
# Arguments:
|
264
|
+
# curve mnemonic: (String)
|
265
|
+
|
238
266
|
def curve(curve_name)
|
239
267
|
self.curves[curve_name]
|
240
268
|
end
|
241
269
|
|
270
|
+
# Return a list of mnemonics representing the curve names
|
271
|
+
#
|
272
|
+
# Example:
|
273
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
274
|
+
# => #<CWLSLas>
|
275
|
+
# >> my_well.well_name
|
276
|
+
# => "ANY ET AL OIL WELL #12"
|
277
|
+
#
|
278
|
+
|
242
279
|
def well_name
|
243
280
|
self.well_info.well_name
|
244
281
|
end
|
245
282
|
|
283
|
+
# Returns the company name tha owns the well
|
284
|
+
#
|
285
|
+
# Example:
|
286
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
287
|
+
# => #<CWLSLas>
|
288
|
+
# >> my_well.company_name
|
289
|
+
# => "ANY OIL COMPANY LTD."
|
290
|
+
#
|
291
|
+
|
246
292
|
def company_name
|
247
293
|
self.well_info.company_name
|
248
294
|
end
|
249
295
|
|
296
|
+
# Returns the field name described in the file
|
297
|
+
#
|
298
|
+
# Example:
|
299
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
300
|
+
# => #<CWLSLas>
|
301
|
+
# >> my_well.field_name
|
302
|
+
# => "CAMPOS"
|
303
|
+
#
|
304
|
+
|
250
305
|
def field_name
|
251
306
|
self.well_info.field_name
|
252
307
|
end
|
253
308
|
|
309
|
+
# Returns the location described in the file
|
310
|
+
#
|
311
|
+
# Example:
|
312
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
313
|
+
# => #<CWLSLas>
|
314
|
+
# >> my_well.location
|
315
|
+
# => "-43.173871636390686 -22.964858960678484"
|
316
|
+
#
|
317
|
+
|
254
318
|
def location
|
255
319
|
self.well_info.location
|
256
320
|
end
|
257
321
|
|
322
|
+
# Returns the province described in the file
|
323
|
+
#
|
324
|
+
# Example:
|
325
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
326
|
+
# => #<CWLSLas>
|
327
|
+
# >> my_well.province
|
328
|
+
# => "RIO DE JANEIRO"
|
329
|
+
#
|
330
|
+
|
258
331
|
def province
|
259
332
|
self.well_info.province
|
260
333
|
end
|
261
334
|
|
335
|
+
# Returns the service company that performed the log acquisition
|
336
|
+
#
|
337
|
+
# Example:
|
338
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
339
|
+
# => #<CWLSLas>
|
340
|
+
# >> my_well.service_company
|
341
|
+
# => "ANY LOGGING COMPANY LTD."
|
342
|
+
#
|
343
|
+
|
262
344
|
def service_company
|
263
345
|
self.well_info.service_company
|
264
346
|
end
|
265
347
|
|
348
|
+
# Returns a String with the date described in the file.
|
349
|
+
#
|
350
|
+
# Example:
|
351
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
352
|
+
# => #<CWLSLas>
|
353
|
+
# >> my_well.log_date
|
354
|
+
# => "25-DEC-1988"
|
355
|
+
#
|
356
|
+
|
266
357
|
def log_date
|
267
358
|
self.well_info.date_logged
|
268
359
|
end
|
269
360
|
|
361
|
+
# Returns the UWI (UNIQUE WELL ID) described in the file
|
362
|
+
#
|
363
|
+
# Example:
|
364
|
+
# >> my_well = CWLSLas.new('my_well.las')
|
365
|
+
# => #<CWLSLas>
|
366
|
+
# >> my_well.uwi
|
367
|
+
# => "100091604920W300"
|
368
|
+
#
|
369
|
+
|
270
370
|
def uwi
|
271
371
|
self.well_info.uwi
|
272
372
|
end
|
data/lib/las_reader/version.rb
CHANGED
@@ -5,18 +5,18 @@
|
|
5
5
|
~WELL INFORMATION
|
6
6
|
#MNEM.UNIT DATA DESCRIPTION
|
7
7
|
#----- ----- ---------- -------------------------
|
8
|
-
STRT .M 1670.0000 :START DEPTH
|
9
|
-
STOP .M 1660.0000 :STOP DEPTH
|
10
|
-
STEP .M -0.1250 :STEP
|
11
|
-
NULL . -999.25 :NULL VALUE
|
12
|
-
COMP . ANY OIL COMPANY INC. :COMPANY
|
13
|
-
WELL . ANY ET AL 12-34-12-34 :WELL
|
14
|
-
FLD . WILDCAT :FIELD
|
15
|
-
LOC . 12-34-12-34W5M :LOCATION
|
16
|
-
PROV . ALBERTA :PROVINCE
|
17
|
-
SRVC . ANY LOGGING COMPANY INC. :SERVICE COMPANY
|
18
|
-
DATE . 13-DEC-86 :LOG DATE
|
19
|
-
UWI . 100123401234W500 :UNIQUE WELL ID
|
8
|
+
STRT .M 1670.0000 : START DEPTH
|
9
|
+
STOP .M 1660.0000 : STOP DEPTH
|
10
|
+
STEP .M -0.1250 : STEP
|
11
|
+
NULL . -999.25 : NULL VALUE
|
12
|
+
COMP . ANY OIL COMPANY INC. : COMPANY
|
13
|
+
WELL . ANY ET AL 12-34-12-34 : WELL
|
14
|
+
FLD . WILDCAT : FIELD
|
15
|
+
LOC . 12-34-12-34W5M : LOCATION
|
16
|
+
PROV . ALBERTA : PROVINCE
|
17
|
+
SRVC . ANY LOGGING COMPANY INC. : SERVICE COMPANY
|
18
|
+
DATE . 13-DEC-86 : LOG DATE
|
19
|
+
UWI . 100123401234W500 : UNIQUE WELL ID
|
20
20
|
~CURVE INFORMATION
|
21
21
|
#MNEM.UNIT API CODES CURVE DESCRIPTION
|
22
22
|
#------------------ ------------ -------------------------
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: las_reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gilberto P. Carmo Jr.
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-01-
|
18
|
+
date: 2013-01-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|