Commit 893c5309 authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Merge branch 'release/1.16.0'

parents f45b1a5e a2d95069
Pipeline #8299 passed with stages
in 3 minutes and 30 seconds
......@@ -2,6 +2,11 @@
ew2openapi Release History
#########################
* Release 1.16.0 (2022/01/11)
- Add script ew2openapi_logplayer.sh. Issue #51 (2021/11/05)
- CAST TYPE_PICK_SCNL.pickWeight to integer (not a string). Issue #52 (2021/11/05)
- Set originId n TYPE_HYP2000ARC and TYPE_MAGNITUDE json messages using quakeId and version. Issue #53, caravel/dante8#67 (2021/11/19)
* Release 1.15.0 (2021/10/11)
- Change route API from quakdb/status to /status. Issue #50, #43 (2021/10/11)
......
1.15.0 (2021-10-11)
\ No newline at end of file
1.16.0 (2022-01-11)
\ No newline at end of file
......@@ -169,6 +169,9 @@ test: $(B)/$(APP)
$(B)/$(APP) TYPE_MAGNITUDE ./test/localmag/lm_75662.localmag ./test/json/output_test.json
jq '.' ./test/json/output_test.json > j1.json
jq '.' ./test/json/lm_75662.localmag.json > j2.json
grep -w -v "hostname" j1.json > jj1.json
grep -w -v "hostname" j2.json > jj2.json
diff jj1.json jj2.json
# Test ew2openapi standalone with TYPE_STRONGMOTIONII input file
$(B)/$(APP) TYPE_STRONGMOTIONII ./test/gmew/APRC.HHE.IV.--.001.gmew ./test/json/output_test.json
jq '.' ./test/json/output_test.json > j1.json
......
\n
\n
time_namelookup: %{time_namelookup}s\n
time_connect: %{time_connect}s\n
time_appconnect: %{time_appconnect}s\n
time_pretransfer: %{time_pretransfer}s\n
time_redirect: %{time_redirect}s\n
time_starttransfer: %{time_starttransfer}s\n
----------\n
time_total: %{time_total}s\n
#!/bin/bash
# DANTEURLBASE=http://caravel.int.ingv.it
# DANTEURLBASE=http://caravel.int.ingv.it:8585
DANTEURLBASE=$1
INPUTFILE=$2
DIRNAME="`dirname $0`"
CURLFORMATFILE="${DIRNAME}/curl-format.txt"
SYNTAX="
Syntax: `basename $0` <dantebaseurl> [ <ew2openapi_log_file> ]
Examples:
`basename $0` http://caravel.int.ingv.it ew2openapi1_20211029.log
grep TYPE_HYP2000ARC ew2openapi1_20211029.log | `basename $0` http://caravel.int.ingv.it
cat ew2openapi?_202111*.log | `basename $0` http://caravel.int.ingv.it
"
DANTEURLPREFIX=api/quakedb/ew/v1
if [ -z "${DANTEURLBASE}" ]; then
echo "${SYNTAX}"
echo "ERROR: <dantebaseurl> is required. Exit."
exit
fi
if [ -z "${INPUTFILE}" ]; then
echo "WARNING: <ew2openapi_log_file> is not defined. Script expects input from stdin."
INPUTFILE="-"
else
if [ ! -f "${INPUTFILE}" ]; then
echo "${SYNTAX}"
echo "ERROR: file ${INPUTFILE} not found. Exit."
exit
fi
fi
cat ${INPUTFILE} | \
grep "JSON:" | \
sed -e "s/^.*:\([0-9]\{8\}_UTC_\)/\1/" | \
sort | \
sed -e "s/^.*JSON: //" | \
sed -e 's/"instance":"/"instance":"test_logplayer_/g' | \
while read JSONDATA; do
echo ""
echo "========================="
EWTYPEMSG=`echo "${JSONDATA}" | sed -e 's/^{"ewLogo":{"type":"\([^"][^"]*\)".*$/\1/'`
case ${EWTYPEMSG} in
TYPE_QUAKE2K)
DANTEURLAPI=quake2k
;;
TYPE_HYP2000ARC)
DANTEURLAPI=hyp2000arc
;;
TYPE_MAGNITUDE)
DANTEURLAPI=magnitude
;;
TYPE_PICK_SCNL)
DANTEURLAPI=pick-scnl
;;
TYPE_STRONGMOTIONII)
DANTEURLAPI=strongmotionii
;;
*)
echo "ERROR: message type ${EWTYPEMSG} not handled. Skip."
DANTEURLAPI=""
;;
esac
if [ ! -z "${DANTEURLAPI}" ]; then
DANTEURLCOMPLETE=${DANTEURLBASE}/${DANTEURLPREFIX}/${DANTEURLAPI}
# echo "${EWTYPEMSG} --> ${DANTEURLAPI}"
# echo ${JSONDATA}
echo curl -i -w "@${CURLFORMATFILE}" -d "{\"data\": ${JSONDATA} }" -H "Content-Type: application/json" -X POST ${DANTEURLCOMPLETE}
echo ""
curl -i -w "@${CURLFORMATFILE}" -d "{\"data\": ${JSONDATA} }" -H "Content-Type: application/json" -X POST ${DANTEURLCOMPLETE}
# sleep 3
echo ""
fi
done
......@@ -190,6 +190,9 @@ char *get_json_string_from_arc_ew_struct(struct Hsum *arcSum, struct Hpck *arcPc
json_object_object_add(jobj_ew_message,"quakeId", json_object_new_int64(arcSum->qid));
// json_object_object_add(jobj_ew_message,"version", json_object_new_int64(arcSum->version));
json_object_object_add(jobj_ew_message,"version", json_object_new_string(ew2openapi_get_name_version(arcSum->version)));
// https://gitlab.rm.ingv.it/earthworm/ew2openapi/-/issues/53
// Set originId using quakeId and version
json_object_object_add(jobj_ew_message,"originId", json_object_new_int64((arcSum->qid * 10) + arcSum->version));
json_object_object_add(jobj_ew_message,"originTime", json_object_new_string(myjson_string_datetime_cdate));
json_object_object_add(jobj_ew_message,"latitude", json_object_new_double_with_precision(arcSum->lat, 6));
json_object_object_add(jobj_ew_message,"longitude", json_object_new_double_with_precision(arcSum->lon, 6));
......
......@@ -87,6 +87,9 @@ char *get_json_string_from_magnitude_ew_struct(MAG_INFO *magSum, MAG_CHAN_INFO *
json_object_object_add(jobj_ew_message,"quakeId", json_object_new_int64(qid_long));
// json_object_object_add(jobj_ew_message,"version", json_object_new_int64(magSum->origin_version));
json_object_object_add(jobj_ew_message,"version", json_object_new_string(ew2openapi_get_name_version(magSum->origin_version)));
// https://gitlab.rm.ingv.it/earthworm/ew2openapi/-/issues/53
// Set originId using quakeId and version
json_object_object_add(jobj_ew_message,"originId", json_object_new_int64((qid_long * 10) + magSum->origin_version));
json_object_object_add(jobj_ew_message,"mag", json_object_new_double_with_precision(magSum->mag, 2));
json_object_object_add(jobj_ew_message,"error", json_object_new_double_with_precision(magSum->error, 2));
json_object_object_add(jobj_ew_message,"quality", json_object_new_double_with_precision(magSum->quality, 2));
......
......@@ -72,7 +72,8 @@ char *get_json_string_from_pick_scnl_ew_struct(EWPICK *pick, MSG_LOGO *reclogo,
json_object_object_add(jobj_ew_message,"component", json_object_new_string(pick->comp));
json_object_object_add(jobj_ew_message,"location", json_object_new_string(pick->loc));
json_object_object_add(jobj_ew_message,"firstMotion", json_object_new_string_len(&(pick->fm), 1));
json_object_object_add(jobj_ew_message,"pickWeight", json_object_new_string_len(&(pick->wt), 1));
/* json_object_object_add(jobj_ew_message,"pickWeight", json_object_new_string_len(&(pick->wt), 1)); */
json_object_object_add(jobj_ew_message,"pickWeight", json_object_new_int(pick->wt - '0'));
json_object_object_add(jobj_ew_message,"timeOfPick", json_object_new_string(tpick_datetime));
jobj_tmp = json_object_new_array();
for(j=0; j<3; j++) {
......
/* DO NOT EDIT. Automatically generated. Change file HISTORY in ew2openapi_version main directory. */
#define EW2OPENAPI_NAME "ew2openapi"
#define EW2OPENAPI_VERSION "1.15.0 (2021-10-11)"
#define EW2OPENAPI_VERSION "1.16.0 (2022-01-11)"
#define EW2OPENAPI_NAME_AND_VERSION EW2OPENAPI_NAME" "EW2OPENAPI_VERSION
#define EW2OPENAPI_USERAGENT EW2OPENAPI_NAME"/"EW2OPENAPI_VERSION
#define EW2OPENAPI_URL_PATH "quakedb/ew/v1"
......
This diff is collapsed.
This diff is collapsed.
{"ewLogo":{"type":"TYPE_MAGNITUDE","module":"MOD_WILDCARD","installation":"INST_WILDCARD","instance":"INST_UNKNOWN","user":"ew","hostname":"kambei.local"},"ewMessage":{"quakeId":75662,"version":"ew final","mag":2.14,"error":0.79,"quality":0.37,"minDist":90.56,"azimuth":-1,"nStations":4,"nChannels":8,"qAuthor":"014101073:028130073","qddsVersion":0,"iMagType":1,"magType":"ML","algorithm":"MED","ingvQuality":"C ","phases":[{"sta":"SARM","comp":"EHE","net":"GU","loc":"--","mag":1.47,"dist":90.56,"corr":0.00,"time1":"2018-05-25T14:52:58.590Z","amp1":-0.0733,"period1":-1.0000,"time2":"2018-05-25T14:52:57.810Z","amp2":-0.0102,"period2":-1.0000},{"sta":"SARM","comp":"EHN","net":"GU","loc":"--","mag":1.46,"dist":90.56,"corr":0.00,"time1":"2018-05-25T14:53:14.990Z","amp1":-0.0481,"period1":-1.0000,"time2":"2018-05-25T14:53:14.260Z","amp2":0.0138,"period2":-1.0000},{"sta":"ZONE","comp":"HHE","net":"IV","loc":"--","mag":1.90,"dist":129.60,"corr":0.00,"time1":"2018-05-25T14:52:51.910Z","amp1":-0.0463,"period1":-1.0000,"time2":"2018-05-25T14:52:52.150Z","amp2":0.0550,"period2":-1.0000},{"sta":"ZONE","comp":"HHN","net":"IV","loc":"--","mag":1.74,"dist":129.60,"corr":0.00,"time1":"2018-05-25T14:52:51.850Z","amp1":-0.0463,"period1":-1.0000,"time2":"2018-05-25T14:52:51.920Z","amp2":0.0241,"period2":-1.0000},{"sta":"RONC","comp":"EHE","net":"ST","loc":"--","mag":2.35,"dist":169.00,"corr":0.00,"time1":"2018-05-25T14:53:42.390Z","amp1":-0.0924,"period1":-1.0000,"time2":"2018-05-25T14:53:42.970Z","amp2":0.0907,"period2":-1.0000},{"sta":"RONC","comp":"EHN","net":"ST","loc":"--","mag":2.56,"dist":169.00,"corr":0.00,"time1":"2018-05-25T14:53:43.120Z","amp1":-0.1340,"period1":-1.0000,"time2":"2018-05-25T14:53:43.190Z","amp2":0.1600,"period2":-1.0000},{"sta":"FAGN","comp":"HHE","net":"IV","loc":"--","mag":3.44,"dist":425.82,"corr":0.00,"time1":"2018-05-25T14:54:22.650Z","amp1":-0.1740,"period1":-1.0000,"time2":"2018-05-25T14:54:22.680Z","amp2":0.0903,"period2":-1.0000},{"sta":"FAGN","comp":"HHN","net":"IV","loc":"--","mag":3.08,"dist":425.82,"corr":0.00,"time1":"2018-05-25T14:54:22.650Z","amp1":-0.0722,"period1":-1.0000,"time2":"2018-05-25T14:54:22.690Z","amp2":0.0424,"period2":-1.0000}]}}
\ No newline at end of file
{"ewLogo":{"type":"TYPE_MAGNITUDE","module":"MOD_WILDCARD","installation":"INST_WILDCARD","instance":"INST_UNKNOWN","user":"ew","hostname":"kambei.int.ingv.it"},"ewMessage":{"quakeId":75662,"version":"ew final","originId":756622,"mag":2.14,"error":0.79,"quality":0.37,"minDist":90.56,"azimuth":-1,"nStations":4,"nChannels":8,"qAuthor":"014101073:028130073","qddsVersion":0,"iMagType":1,"magType":"ML","algorithm":"MED","ingvQuality":"C ","phases":[{"sta":"SARM","comp":"EHE","net":"GU","loc":"--","mag":1.47,"dist":90.56,"corr":0.00,"time1":"2018-05-25T14:52:58.590Z","amp1":-0.0733,"period1":-1.0000,"time2":"2018-05-25T14:52:57.810Z","amp2":-0.0102,"period2":-1.0000},{"sta":"SARM","comp":"EHN","net":"GU","loc":"--","mag":1.46,"dist":90.56,"corr":0.00,"time1":"2018-05-25T14:53:14.990Z","amp1":-0.0481,"period1":-1.0000,"time2":"2018-05-25T14:53:14.260Z","amp2":0.0138,"period2":-1.0000},{"sta":"ZONE","comp":"HHE","net":"IV","loc":"--","mag":1.90,"dist":129.60,"corr":0.00,"time1":"2018-05-25T14:52:51.910Z","amp1":-0.0463,"period1":-1.0000,"time2":"2018-05-25T14:52:52.150Z","amp2":0.0550,"period2":-1.0000},{"sta":"ZONE","comp":"HHN","net":"IV","loc":"--","mag":1.74,"dist":129.60,"corr":0.00,"time1":"2018-05-25T14:52:51.850Z","amp1":-0.0463,"period1":-1.0000,"time2":"2018-05-25T14:52:51.920Z","amp2":0.0241,"period2":-1.0000},{"sta":"RONC","comp":"EHE","net":"ST","loc":"--","mag":2.35,"dist":169.00,"corr":0.00,"time1":"2018-05-25T14:53:42.390Z","amp1":-0.0924,"period1":-1.0000,"time2":"2018-05-25T14:53:42.970Z","amp2":0.0907,"period2":-1.0000},{"sta":"RONC","comp":"EHN","net":"ST","loc":"--","mag":2.56,"dist":169.00,"corr":0.00,"time1":"2018-05-25T14:53:43.120Z","amp1":-0.1340,"period1":-1.0000,"time2":"2018-05-25T14:53:43.190Z","amp2":0.1600,"period2":-1.0000},{"sta":"FAGN","comp":"HHE","net":"IV","loc":"--","mag":3.44,"dist":425.82,"corr":0.00,"time1":"2018-05-25T14:54:22.650Z","amp1":-0.1740,"period1":-1.0000,"time2":"2018-05-25T14:54:22.680Z","amp2":0.0903,"period2":-1.0000},{"sta":"FAGN","comp":"HHN","net":"IV","loc":"--","mag":3.08,"dist":425.82,"corr":0.00,"time1":"2018-05-25T14:54:22.650Z","amp1":-0.0722,"period1":-1.0000,"time2":"2018-05-25T14:54:22.690Z","amp2":0.0424,"period2":-1.0000}]}}
\ No newline at end of file
{"ewLogo":{"type":"TYPE_PICK_SCNL","module":"MOD_WILDCARD","installation":"INST_WILDCARD","instance":"INST_UNKNOWN","user":"ew","hostname":"kambei.local"},"ewMessage":{"pickId":11290455,"network":"IV","station":"GMB","component":"BHZ","location":"--","firstMotion":"?","pickWeight":"3","timeOfPick":"2018-05-25T14:59:05.280Z","pAmplitude":[86,215,61]}}
\ No newline at end of file
{"ewLogo":{"type":"TYPE_PICK_SCNL","module":"MOD_WILDCARD","installation":"INST_WILDCARD","instance":"INST_UNKNOWN","user":"ew","hostname":"kambei.local"},"ewMessage":{"pickId":11290455,"network":"IV","station":"GMB","component":"BHZ","location":"--","firstMotion":"?","pickWeight":3,"timeOfPick":"2018-05-25T14:59:05.280Z","pAmplitude":[86,215,61]}}
\ No newline at end of file
Supports Markdown
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