Commit a5a98719 authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

h5Tool rename fixes

parent e2b18a41
Pipeline #37010 failed with stages
in 45 minutes and 52 seconds
# section_run/program_basis_set_type
MM -> none
Gaussians -> GTOs
gaussians -> GTOs
"Real-space grid" -> "real-space grid"
# section_calculation_info/calculation_uploader_name
"danilo brambila" -> "Danilo Brambila"
"-" -> none
"–" -> none
# section_run/section_method/section_XC_functionals/XC_functional_name
x_qe_VDW_DF1 -> vDW_DF
x_qe_VDW_DF2 -> vDW_DF2
x_qe_GGA_X_GAUP -> HYB_GGA_XC_GAU_PBE
#!/bin/bash
cmd="java -Djava.library.path=/lib -jar /app/h5Tool.jar"
baseName=${baseName:-toRename-}
targetDir=${targetDir:---target-dir=/normalized/productionH5-patched}
globPattern=${globPattern:-??}
renames=${renames:---renames=/app/meta-values-replacements.txt}
cmdArgs=${cmdArgs:-rename $renames $targetDir --source-paths-file=\$f}
if [ -e /config.sh ] ; then
source /config.sh
fi
cd /work
for f in /work/$baseName$globPattern ; do
(
if [[ -e "$f" ]] ; then
echo $cmd $cmdArgs "out-$(basename $f).txt"
eval $cmd $cmdArgs >& "out-$(basename $f).txt"
fi
) &
done
wait
......@@ -22,18 +22,18 @@ object H5Rename {
/**
* Renames the values of the value table at repl.metaPath of all calculations in the archive according to the repl.replacements mapping
*/
def renameStr(file: FileH5, repl: Replacements): Unit = {
def renameStr(file: FileH5, repls: Seq[Replacements]): Unit = {
for (arch <- file.archives()) {
renameStr(arch, repl)
renameStr(arch, repls)
}
}
/**
* Renames the values of the value table at repl.metaPath of all calculations in the archive according to the repl.replacements mapping
*/
def renameStr(archive: ArchiveH5, repl: Replacements): Unit = {
def renameStr(archive: ArchiveH5, repls: Seq[Replacements]): Unit = {
for (calculation <- archive.calculations()) {
renameStr(calculation, repl)
renameStr(calculation, repls)
}
}
......@@ -41,10 +41,12 @@ object H5Rename {
* Renames the values of the value table at repl.metaPath of the given calculation
* according to the repl.replacements mapping
*/
def renameStr(calculation: CalculationH5, repl: Replacements): Unit = {
val valueTablePath = repl.metaPath
val valueTable = calculation.sectionTable(valueTablePath.dropRight(1)).subValueTable(valueTablePath.last)
renameStr(valueTable, repl.replacements)
def renameStr(calculation: CalculationH5, repls: Seq[Replacements]): Unit = {
for (repl <- repls) {
val valueTablePath = repl.metaPath
val valueTable = calculation.sectionTable(valueTablePath.dropRight(1)).subValueTable(valueTablePath.last)
renameStr(valueTable, repl.replacements)
}
}
/**
......@@ -79,8 +81,10 @@ object H5Rename {
}
}
}
if (hasRenames)
if (hasRenames) {
//logger.debug(s"$valueTable has replacements")
H5Lib.datasetWrite(valueDatasetId, value = vals, dtypeStr = "C")
}
} finally {
H5Lib.datasetClose(valueDatasetId)
}
......
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