I want to apply the CDO (Climate Data Operator) "remapnn" command in order to extract time series for a set of points that are stored in the "coords.txt" file. The stucture of the coords.txt file is the following:
station , lat , lon ABTR2100 ,39.13,34.52 GRMR0100 ,20.18,49.00 DDDD0100 ,23.22,46.81 SLPT0100 ,26.91,32.23 NDRT0100 ,29.55,48.97
For this reason, I have tried to write the following bash shell that will allow me to run the remapnn command for all stations in a loop:
#!/bin/bash while read p; do echo $p cdo remapnn,lon=$lon_lat=$lat, temperature.nc $output.nc done <coords.txt
More specifically, where "lon" the longitude of the station is supposed to be assigned, and where "lat" the latitude of the station is supposed to be assigned. The "temperature.nc" file is my NetCDF file from which I want to extract the time series, "out.nc" is the output. The command works perfectly for a single location, for instance:
cdo remapnn,lon=34.52_lat=39.13, temperature.nc output.nc
but unfortunately, doesn't work in a loop. This is the error message I get:
cdo remapnn (Abort): Open failed on lon==!