Automatic range for colorbar, possibility of looping same script through different files?

Hello eveybody,

for my script and a colorbar I want to make a cpt fitting to the corresponding values. Instead of defining it like -T-10/10/1 I want it to automate, but I have problems using the correct commands for it, I tried by defining the column n makecpt by e.g. -i5 but that didn’t work and the colorbar is then always from 0 to 1.

Another question is, if it is possible to loop the same script through different files which have the same format, and output seperate .pdf files for each inputfile by giving “dynamic” names, so they won’t get overwritten?

Thanks very much!!

grd2cpt can generate automated .cpt files, for example like grd2cpt -T= -E21

for loops, old school bash can do for example

for g in grid1 grid2 grid3;do
grd2cpt $g.grd > $g.cpt
grdimage $g.grd -C$g.cpt > $g.ps
done

1 Like

For the loop I suspect that you could also use gmt batch.

1 Like

Thanks, but I want want it for a column of values (eg. -1.2, 0.1, 2.4… but really longand I basically want to get the min and max) not for a grid file. Does it still work?