Shell script for extracting time series at multiple locations using remapnn- regarding
Added by Naveen Pothula over 4 years ago
Hi all,
I am new to shell scripting, What I understand from some of the posts is that one can extract a time series of a variable at a location using remapnn in cdo.
cdo -outputtab,date,value -remapnn,lon=80.625_lat=30.625 $ifile> ofile1.txt. Can someone help in writing the correct script as given below for a series of locations given in a text file.
#!/bin/bash
while read p ; do
echo $p;
cdo -outputtab,date,value -remapnn,lon=${lon}_lat=${lat} $ifile.nc > $pct.txt
done <gridlocation.txt
gridlocation.txt
grid,lon,lat
g10,77.25;13.25
g20,78.25,13.75
g45,78.75,15.25
g36,78.25,14.75
kindly help,
best,
naveen
Replies (1)
RE: Shell script for extracting time series at multiple locations using remapnn- regarding - Added by Karin Meier-Fleischer over 4 years ago
Hi Naveen,
this is a shell scripting question and not about CDO.
#!/bin/bash infile="your_data_file.nc" cat << EOF > gridlocation.txt 77.25,13.25 78.25,13.75 78.75,15.25 78.25,14.75 EOF rm -rf values.txt while read line do lon=$(echo $line | cut -d ',' -f 1) lat=$(echo $line | cut -d ',' -f 2) cdo -outputtab,date,value -remapnn,"lon=${lon}_lat=${lat}" $infile >> values.txt done < gridlocation.txt