![wgrib2 命令为 csv 文件列表提取单个变量](https://linux22.com/image/15617/wgrib2%20%E5%91%BD%E4%BB%A4%E4%B8%BA%20csv%20%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8%E6%8F%90%E5%8F%96%E5%8D%95%E4%B8%AA%E5%8F%98%E9%87%8F.png)
我有同样的问题,所以我想使用 wgrib2 命令提取 TMP 并保存每个点(csv 文件的站点列表),但出现错误。我正在使用 while do 循环,如下所示:
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
错误是:
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
我需要一些帮助来解决这个问题。