Open amotl opened 1 year ago
As a workaround, a few commands of Unix magic can be applied to the problem. This incantation will read the file sensor_ids.txt
, containing a list of sensor identifiers, separated by newlines, and will reformat it to be comma-separated.
cat sensor_ids.txt | printf "%s" "$(< /dev/stdin)" | tr '\n' ','
In this way, it is suitable for feeding it to the --sensor=
option of Luftdatenpumpe. Imagine you have a file sensor_ids.txt
, you could use a wrapper program like ldipumpe.sh
, attached below, by invoking ./ldipumpe.sh sensor_ids.txt --reverse-geocode --target=...
.
#!/bin/bash
#
# Use Luftdatenpumpe to acquire data by list of
# sensor identifiers from file.
#
# Synopsis:
#
# ./ldipumpe.sh sensor_ids.txt --reverse-geocode
#
# Read input file name.
infile=$1
shift
# Sanity checks.
if [ -z "${infile}" ]; then
echo "ERROR: No input file given"
exit 1
fi
# Read and reformat text file to comma-separated list.
sensor_ids=$(cat "${infile}" | printf "%s" "$(< /dev/stdin)" | tr '\n' ',')
echo "Using sensor identifiers: ${sensor_ids}"
# Invoke Luftdatenpumpe with given sensor identifiers,
# forwarding other command line options.
luftdatenpumpe stations \
--network=ldi --sensor="${sensor_ids}" \
"$@"
Hi there,
at ^1, @ohobby asked about how he would be able to feed a list of sensor identifiers from a file to the
luftdatenpumpe stations
orluftdatenpumpe readings
commands.Indeed, it would be sweet if Luftdatenpumpe provided such an option.
With kind regards, Andreas.