Commit 8ae69b0b authored by Knut Behrends's avatar Knut Behrends
Browse files

add 1 shell script for running split-inserter.js

parent 56d62d53
......@@ -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
......
......@@ -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)
......
#!/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
#!/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")
......
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