I have the same issue, so I want to use wgrib2 command to extract TMP and save for each point (list of station of csv file) and I'm getting error. I'm using while do loop as below:
ifile="GSM_GPV_Rgl_I"$yyyymmddhh"_grib2.bin" #.nc4 file to read
istnlst="/media/moza/Elements//work1/guidance/temp/Station_Table.csv" #list of lat-lon for which to extract TS
ofile="_tmp_gpv.csv"
while IFS=-,- read -r p; do
echo -e "Reading station..... "$p
stn=$(echo $p | cut -d ',' -f 1)
out="/media/moza/Elements/work1/guidance/temp/gpvdata/"$yyyymmddhh"_"$stn$ofile
lon=$(echo $p | cut -d ',' -f 2)
lat=$(echo $p | cut -d ',' -f 3)
wgrib2 "GSM_GPV_Rgl_I"$yyyymmddhh"_grib2.bin"
-match ":TMP:" -match ":24 hour fcst:|:36 hour fcst:"
-v p -Lon lon lat -csv > $out
sed -i -e "/value/"$stn"/1"$ofile #replace value column name w/ stn name
echo
done < $istnlst
The error is:
Reading station..... "Nacala",40.716,-14.466 ./station_guidance2221.sh: line 67: /media/moza/Elements/work1/guidance/temp/gpvdata/2021060300_"Nacala"_tmp_gpv.csv: Invalid argument
Reading station..... "Dindiza",33.5,-22.75 ./station_guidance2221.sh: line 67: /media/moza/Elements/work1/guidance/temp/gpvdata/2021060300_"Dindiza"_tmp_gpv.csv: Invalid argument
I need some help to solve this.