OK, let's try this.

Code:

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import imread
import sounddevice as sd
from scipy.signal import correlate
import noise
terrainsize = 256
#load terrain from 256x256 or 512x512 png
zvalues = imread('terrain256.png')
#terrain is perlin noise
#perlin noise generator coeffs
freq=1400
octaves=33
for y in range(terrainsize):
for x in range(terrainsize):
zvalues[x][y] = int(noise.snoise2(x / freq, y / freq, octaves) * 32767)
sps = 44100 #sample rate
duration_s = 1#0.0029 #duration of our waveform. .0029 at 44.1k makes 128 entry buffer. Set long as needed
each_sample_number = np.arange(duration_s * sps)
scale_x = terrainsize / 13.1 #this scales the orbit x size
scale_y = terrainsize / 8.1 #scale orbit y size. Changing these vales changes orbit from circular to ellipse
offset_x = 140 #center of orbit offset x terrain axis
offset_y = 120 #center of orbit offset y terrain axis
freq_hz = 108.0 #osc freq
fm=1.00
# for this demo, moving these values will aptly demonstrate the wave terrain.
def wavetable(_size): ##122uS per loop on my machine to make geometry calculations on 2900uS buffer frame of audio
wavex = np.sin(2 * np.pi * each_sample_number * freq_hz * fm / sps)
wavey = np.cos(2 * np.pi * each_sample_number * freq_hz * fm / sps)
tablex = np.int16(offset_x + (wavex * scale_x))
tabley = np.int16(offset_y + (wavey * scale_y))
ctablex = np.clip(tablex,0,terrainsize-1) #clipping to terrainsize takes as long as making the tables
ctabley = np.clip(tabley,0,terrainsize-1)
ctablez = [x for x in range(_size)]
for v in range(0,_size):
ctablez[v] = zvalues[ctablex[v],ctabley[v]]
ctablez = np.int16(ctablez)
return ctablez

That's code for a wave terrain oscillator. The wav file is the result of playing back a Perlin noise terrain. It uses two oscillators in quadrature to generate an x,y coordinate to read magnitude from a table. This version uses a 256x256 table for 16 bit use. but a terrain oscillator with 65536 x 65536, tracking a plane of coordinates from -(2,147,483,648) to + (2,147,483,647) would give you very good lfo accuracy. Of course, the great thing about it is it makes an excellent oscillator in general. Maybe I'll try to hack your code. I just need to be able to read a 256x256 array, not as easy in c as in python. Nothing is as easy in c as it is in python