Project

General

Profile

RE: Loop "remapnn" command for many locations » script.sh

Christ Reflin, 2023-03-15 04:06

 
#!/usr/bin/env bash

coords=coordinate.txt
infile=merge_5_variables_example.nc

rm -f extracted*.txt

while IFS=, read -r id lon lat
do
if [[ $id == "id" ]]; then
continue
fi

echo "$id $lon $lat"

cdo -s -outputtab,date,name,lon,lat,value -remapnn,lon=${lon}_lat=${lat} \
$infile >> extracted_${id}.txt

done < $coords
(2-2/4)