X-Git-Url: https://git.wikimedia.ca/?p=eccc_to_commons.git;a=blobdiff_plain;f=eccc_to_commons.sh;fp=eccc_to_commons.sh;h=f6d399b67fe8028ca26475d128d15a9c474e90f6;hp=5381bb5933d8f1bc3903f2ef9ee1134b061f558e;hb=6ff82316880b4664fb2e31c9dd5fc21d919390e5;hpb=700372c3cf8433ed8e4fd643642f4545b14e6f21 diff --git a/eccc_to_commons.sh b/eccc_to_commons.sh index 5381bb5..f6d399b 100755 --- a/eccc_to_commons.sh +++ b/eccc_to_commons.sh @@ -92,6 +92,14 @@ do elif [ ${STATIONDATA_COUNT} -eq 0 ]&& \ [ ${AL_MONTH_COUNT} -gt 0 ] then + # Check file contains data + declare -i AL_DAY_COUNT=$(xmlstarlet sel -t -v 'count(//day)' "${REPLY}") + if [ ${AL_DAY_COUNT} -eq 0 ] + then + echo "${REPLY}: No day found. Ignoring." >&2 + continue + fi + STYLESHEET_PATH='almanac_to_commons.xslt' DESTINATION_PATH="${DESTINATION}/weather.gc.ca/Almanac/${CLIMATE_ID}.tab" else