Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
icdp-osg
mdis-datagen
Commits
8ae69b0b
Commit
8ae69b0b
authored
Jul 25, 2020
by
Knut Behrends
Browse files
add 1 shell script for running split-inserter.js
parent
56d62d53
Changes
4
Hide whitespace changes
Inline
Side-by-side
bin/api-caller-core-section-find.sh
View file @
8ae69b0b
...
...
@@ -29,7 +29,12 @@ do
done
echo
Finding cores and respective section counts
echo
""
node_version
=
$(
node
-v
|
grep
-P
v1[456789]
)
if
[[
-z
"
$node_version
"
]]
;
then
echo
"You must use Node v14+ to run the split-inserter script"
exit
1
fi
section_counts
=
$(
node
$debug
../src/sectioncount-of-cores-of-single-hole.sh
-h
$h
)
;
outfile
=
section_counts.json
...
...
bin/api-caller-core-section-insert.sh
View file @
8ae69b0b
...
...
@@ -30,6 +30,13 @@ fi
export
NVM_DIR
=
"
$HOME
/.nvm"
[
-s
"
$NVM_DIR
/nvm.sh"
]
&&
.
"
$NVM_DIR
/nvm.sh"
# This loads nvm
node_version
=
$(
node
-v
|
grep
-P
v1[456789]
)
if
[[
-z
"
$node_version
"
]]
;
then
echo
"You must use Node v14+ to run the split-inserter script"
exit
1
fi
echo
Inspecting cores and their core sections
>
&2
cores_count
=
$(
jq
'.meta.totalCount'
<
$infile
)
...
...
bin/api-caller-sectionsplit-insert.sh
0 → 100755
View file @
8ae69b0b
#!/usr/bin/env bash
# knb 20200714
# add respective fake sections to mDIS
OPTIND
=
1
declare
core
=
""
declare
debug
=
""
declare
infile
=
section_counts.json
########## options and error handling
while
getopts
':c:d:'
opt
do
case
"
$opt
"
in
c
)
core
=
"
${
OPTARG
}
"
;;
d
)
debug
=
"--inspect --inspect-brk"
;;
*
)
echo
"Usage:
$0
[ -c (core) | -d] ( -d activates Node's chrome debugger)"
&&
exit
0
;;
esac
done
set
-e
export
NVM_DIR
=
"
$HOME
/.nvm"
[
-s
"
$NVM_DIR
/nvm.sh"
]
&&
.
"
$NVM_DIR
/nvm.sh"
# This loads nvm
if
[[
-z
"
$core
"
]]
;
then
echo
"Argument -c (core-id) cannot be empty!"
>
&2
sleep
4
exit
1
fi
node_version
=
$(
node
-v
|
grep
-P
v1[456789]
)
if
[[
-z
"
$node_version
"
]]
;
then
echo
"You must use Node v14+ to run the split-inserter script"
exit
1
fi
########## main script
echo
Core
$c
: Creating split-sections from Whole-round sections
>
&2
if
[[
"
$cores_count
"
-gt
0
]]
;
then
#for i in $(seq 13 100) ; do echo $i; node split-inserter.js -c $i ; done
node
$debug
../split-inserter.js
-c
$i
done
else
echo
"No core or no sections found for core
$i
."
echo
"Core number must be the autoincrement-id of that core."
echo
"Do not use value of combined_id or a different id-column"
fi
src/split-inserter.js
View file @
8ae69b0b
#!/usr/bin/env node
"
use strict
"
// knb July 2020
// use Node v14+
// insert section-splits into mDIS database
// either - for a single core (which contains 1-4 sections)
// TODO
// or read in from infile (created by 'sectioncount-of-cores-of-single-hole.js')
...
...
@@ -9,16 +12,14 @@
"combined_id": "2739_A_A_1",
"core_id": 1,
"section_count": 4,
"recovered_length": 2.73,
"expedition_id": 11,
"site_id": 4,
"hole_id": 11
}, ] } */
// insert section-splits into mDIS database
// call this script with:
// ../api-caller-split-inserter.sh
// or
// node src/split-inserter.js
// node src/split-inserter.js -c 123
// or
// for i in $(seq 101 200) ; do echo $i; node split-inserter.js -c $i ; done
const
config
=
require
(
"
./config.js
"
)
const
axios
=
require
(
"
axios
"
)
const
axutil
=
require
(
"
./axios-util.js
"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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