test_htcp_load_from_file.sh (1591B)
1 #!/bin/sh -e 2 3 # Copyright (C) 2018, 2020-2023, 2025 |Méso|Star> (contact@meso-star.com) 4 # Copyright (C) 2018 Centre National de la Recherche Scientifique 5 # Copyright (C) 2018 Université Paul Sabatier 6 # 7 # This program is free software: you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation, either version 3 of the License, or 10 # (at your option) any later version. 11 # 12 # This program is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20 dump_data() { 21 variable="$1" 22 netcdf="$2" 23 printf "Dump the variable \"%s\" from \"%s\"\n" "${variable}" "${netcdf}" 24 dump_netcdf_data.sh "${variable}" "${netcdf}" 25 } 26 27 if [ $# -ne 1 ]; then 28 printf "usage: %s netcdf\n" "${0##*/}" >&2 29 exit 1 30 fi 31 32 nc="$1" 33 34 if [ ! -f "${nc}" ]; then 35 printf "Invalid netcdf: %s\n" "${nc}" >&2 36 exit 1 37 fi 38 39 prefix=$(basename "${nc}") 40 prefix=${prefix%.*} 41 htcp="${prefix}.htcp" 42 path=$(pwd) 43 44 printf "Convert \"%s\" to \"%s\"\n" "${nc}" "${htcp}" 45 les2htcp -m 1000 -i "${nc}" -fo "${htcp}" 46 47 printf "Dump the descriptor of \"%s\"\n" "${nc}" 48 dump_netcdf_desc.sh "${nc}" 49 50 dump_data "PABST" "${nc}" 51 dump_data "RCT" "${nc}" 52 dump_data "RVT" "${nc}" 53 dump_data "THT" "${nc}" 54 55 test_htcp_load_from_file "${prefix}.htcp" "${path}"