Commit 9fb6d473 authored by Knut Behrends's avatar Knut Behrends
Browse files

finetune geology inserter

parent e3112808
......@@ -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
......@@ -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 node scripts.
or enter the `src/`subdirectory to execute Node 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-inspect.sh' script now
please use this with the 'section-insert.sh' script now
```
Script 2:
```sh
# looks for file section_coints.json in same directory, and processes it.
# looks for file section_counts.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:
```
#############################################################
......
"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 = [
"Mort",
"Post-Mort",
"Moratorium",
"Post-Moratorium",
"ShipShip",
"ShipShore",
"unknown",
......
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}`,
......
......@@ -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")}, SecId:${
.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
......
//@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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment