Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
icdp-osg
dis-datagen
Commits
9fb6d473
Commit
9fb6d473
authored
Oct 14, 2020
by
Knut Behrends
Browse files
finetune geology inserter
parent
e3112808
Changes
6
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
9fb6d473
...
...
@@ -19,3 +19,4 @@ scientists-hole-10-samp.json
scientists-hole-21-enty.json
scientists-hole-8-samp.json
scientists-hole-9-samp.json
.vscode
USAGE.md
View file @
9fb6d473
...
...
@@ -10,7 +10,7 @@ You must use node v14 because the JS code internaly uses the `?.` 'optional chai
### Inserting fake data
First, cd into the
`bin/`
subdirectory to execute Shell scripts,
or enter the
`src/`
subdirectory to execute
n
ode scripts.
or enter the
`src/`
subdirectory to execute
N
ode scripts.
#### Inserting a Fake Program
...
...
@@ -36,9 +36,9 @@ The first writes a JSON file with fake data. The second script reads that file a
```
sh
cd
bin
.
./api-caller-core-section-find.sh
./api-caller-core-section-find.sh
.
./api-caller-core-section-insert.sh
./api-caller-core-section-insert.sh
```
Script 1:
...
...
@@ -49,13 +49,13 @@ Finding cores and respective section counts
22 cores found
JSON data file
'section_counts.json'
overwritten as requested,
please use this with the
'section-ins
pec
t.sh'
script now
please use this with the
'section-ins
er
t.sh'
script now
```
Script 2:
```
sh
# looks for file section_co
i
nts.json in same directory, and processes it.
# looks for file section_co
u
nts.json in same directory, and processes it.
./api-caller-core-section-insert.sh
# use -i to process a different infile.
...
...
@@ -64,7 +64,7 @@ Script 2:
Output:
```
```
js
Inspecting
cores
and
their
core
sections
2
cores
found
in
infile
'
section_counts.json
'
...
...
@@ -80,16 +80,16 @@ core 1: 4 sections
site_id
:
8
,
hole_id
:
21
}
#
sends
//
sends
{
"
core_id
"
:
228
,
"
section
"
:
1
,
"
top_depth
"
:
0.57
,
"
section_length
"
:
1.58
,
"
bottom_depth
"
:
2.7
,
"
analyst
"
:
"
CK
"
,
"
section_state
"
:
"
discontinuous
"
,
"
curated_length
"
:
1.45
,
"
comment
"
:
"
c.1 s.1/4, cL: 2.29m (0.57 - 3.04m)
"
}
#
receives
//
receives
{
'
1
'
:
'
{"core_id":228,"section":1,"top_depth":0.57,"section_length":1.58,"bottom_depth":2.7,"analyst":"CK","section_state":"discontinuous","curated_length":1.45,"comment":"c.1 s.1/4, cL: 2.29m (0.57 - 3.04m)"}
'
}
{
'2': {
},
'3': {},
'4': {}
'
2
'
:
{
...},
// omitted
'
3
'
:
{
...
},
'
4
'
:
{
...
}
}
```
...
...
@@ -100,13 +100,14 @@ Command:
```
sh
./api-caller-sectionsplit-insert.sh
-c
226
# core 226
#node src/split-inserter.js -c 118 # -c stands for core, (core 118)
# alternative
# node src/split-inserter.js -c 118 # -c stands for core, (core 118)
```
Expected outputs:
_
Core was not split before
_
:
Core was
_
not
_
split before:
```
#############################################################
...
...
src/classes/fake-core-defaults.js
View file @
9fb6d473
"
use strict
"
lodash
=
require
(
"
lodash
"
)
class
CoreDefaults
{}
CoreDefaults
.
core_types
=
[
...
...
@@ -63,8 +64,8 @@ CoreDefaults.core_loss_reason = ["unknown", "fallback", "-", "-", "-", "-"]
CoreDefaults
.
temperature
=
12
CoreDefaults
.
request_type
=
[
"
Mor
t
"
,
"
Post-Mor
t
"
,
"
Mor
atorium
"
,
"
Post-Mor
atorium
"
,
"
ShipShip
"
,
"
ShipShore
"
,
"
unknown
"
,
...
...
src/config.js
View file @
9fb6d473
let
token
=
process
.
env
.
token
||
"
7wYyV6JWD4uri3eAPRdjOwJuaHcwXO8z
"
let
token
=
process
.
env
.
token
||
"
EJbfFgVKFjHrxXbaruJmsq069Aqa6Wdf
"
let
config
=
{
token
:
token
,
endpoint
:
{
baseURL
:
"
https://internal.rundis.com/
"
,
// baseURL: "https://internal.rundis.com/",
baseURL
:
"
http://172.17.0.1:8888/
"
,
timeout
:
3000
,
headers
:
{
"
Authorization
"
:
`Bearer
${
token
}
`
,
...
...
src/geology-inserter.js
View file @
9fb6d473
...
...
@@ -262,13 +262,16 @@ Promise.all(queries_map.values())
0
),
composition
:
rock_name
,
description
:
`
${
color
}
(
${
color_hex
}
) Spl
${
sp
.
id
description
:
`
U
${
(
s
+
1
)
.
toString
()
.
padStart
(
4
,
"
0
"
)}
,
U
${
s
.
padStart
(
4
,
"
0
"
)}
,
Spl
${
sp
.
id
.
toString
()
.
padStart
(
4
,
"
0
"
)}
, Sec
Id
:
${
.
padStart
(
4
,
"
0
"
)}
, Sec
#
:
${
sp
.
section_id
}
, secLen
${
util
.
round
(
sp
.
section_length
,
1
)}
m`
,
}
, secLen
${
util
.
round
(
sp
.
section_length
,
1
)}
m color
${
color
}
(
${
color_hex
}
)`
,
}),
sp
,
// current
sp
// previous - not used
...
...
src/hole-inserter.js
View file @
9fb6d473
//@ts-check
"
use strict
"
// for synchronous operation
// call this as:
...
...
@@ -46,8 +47,8 @@ for (let i = 0; i < num_holes_to_insert; i++) {
.
then
((
s
)
=>
{
console
.
dir
(
querystring
.
unescape
(
site_url
))
site_info
=
s
//console.dir(site_info, { depth: 2 })
})
//console.dir(site_info, { depth: 2 })
})
.
catch
((
error
)
=>
console
.
dir
(
error
,
{
depth
:
2
}))
.
then
((
_
)
=>
finder
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment