If I replace this line of code in your second script, it works.
timesteps, nx, ny = hraw.shape
With random data, because we don’t know how you load the h raw and uraw.
timesteps, nx, ny = 174, 200, 50
hraw = np.random.rand(timesteps, nx, ny) # Example-horizontal data
uraw = np.random.rand(timesteps, nx, ny) # Example-speed data
Does this not look like what you are searching for, or please explain your target. How do you load your data?