Thanks for catching these typos!

23? That's not divisible by 3. You must mean 27, since we've got

~~~~
lat.range <- 24:50
lon.range <- 48:116
~~~~