From 2cecbbd9ee56c60c011d335bb1ae25fa58455b3b Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri, 20 Sep 2019 12:05:46 +0200 Subject: [PATCH] Move the permeability specification from solid phase to medium scale. --- xml/movePermeabilityFromSolidPhaseToMedium.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 xml/movePermeabilityFromSolidPhaseToMedium.sh diff --git a/xml/movePermeabilityFromSolidPhaseToMedium.sh b/xml/movePermeabilityFromSolidPhaseToMedium.sh new file mode 100755 index 0000000..2068d2d --- /dev/null +++ b/xml/movePermeabilityFromSolidPhaseToMedium.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +#set -x + +number_of_medium_tags=`xmlstarlet sel -t -v "count(///*/medium)" $1` +number_of_medium_tags=$(($number_of_medium_tags - 1)) + +xmlstarlet ed --move "//OpenGeoSysProject/media/medium[@id=0]/phases/phase/properties/property[name='permeability']" "//OpenGeoSysProject/media/medium[@id=0]/properties" $1 > /tmp/t0.prj + +for i in `seq 1 ${number_of_medium_tags}`; +do + i_m_e=$(($i-1)) + #echo "${i}, ${i_m_e}" + path="//OpenGeoSysProject/media/medium[@id="${i}"]" + xmlstarlet ed --move "$path/phases/phase/properties/property[name='permeability']" "$path/properties" /tmp/t$i_m_e.prj > /tmp/t${i}.prj +done + +#format the result file +xmlstarlet fo -s 4 /tmp/t${number_of_medium_tags}.prj > ${1} -- GitLab