cat > plot_berlin.py <<EOF
exec(open('/home/f/Fabian.Jakub/python/custom_cmaps.py').read())
import xarray as xr
import sys
from pylab import *

print("Plotting {} -> {}".format(sys.argv[1], sys.argv[2]))
r = xr.open_dataset(sys.argv[1]).transmissivity.T.load().data

imshow(r,origin='lower',cmap='gray')
plt.axis('off')
plt.savefig(sys.argv[2], dpi=600)
EOF


for TAU in 0.00 0.01 0.10 0.50 1.00 2.00 5.00
do
OUT=$(pwd)/berlin_rayli_${TAU}.nc
if [ ! -e $OUT ]; then
  make -j -C build && \
    srun --time=08:00:00 -N 1 -n 1 -c 60 -p met-vis,cluster,met-ws build/bin/city_like_mystic /home/f/Fabian.Jakub/work/cjson/ex_berlin_neukoelln/merged.nc $OUT 1000000000 $TAU
fi
done

for f in berlin_rayli_*.nc
do
  P=$(basename $f .nc).png
  [ ! -e $P ] && python plot_berlin.py $f $P
done
