- echo "${REPLY}: Almanac data not compatible yet. Ignoring." >&2
- continue
- DESTINATION_PATH="${DESTINATION}/weather.gc.ca/Almanac/${STATION_ID}.tab"
+ # 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"