I am a starter of GrADS. I would like to set loop to convert many .ctl files into netcdf. First, I succeeded to convert one file to netcdf using below script.
open surf_HFB_2K_MI_m102_203009_rain_subset.ctl
define rain = rain
set sdfwrite surf_HFB_2K_MI_m102_203009_rain_subset.nc
sdfwrite rain
" Then, I tried to set loops using for / while, but the error which says "unknown command for (while)".
the code I tried is like:
for ctlfile in $(ls *.ctl); do
open $ctlfile
define rain = rain
set sdfwrite ${ctlfile%.*}.nc
sdfwrite rain
done
All .ctl files in the same folder like "m101" where I set as a current directory.
How can I use loop in GrADS?