I was able to run the below script from @EmilBrundage.
However, the raster to be calculated were not paired correctly.
I am trying to loop files from 2 folders and perform raster calculation afterwards. The sequence of calculation must be:
(1st) out-0225*out-0225 [from clip qx folder] + out-0225*out-0225 [from clip qy folder]
(2nd) out-0226*out-0226 [from clip qx folder] + out-0226*out-0226 [from clip qy folder]
(3rd) out-0227*out-0227 [from clip qx folder] + out-0227*out-0227 [from clip qy folder]
and so on.
But then the script calculates like the image below.
The script used is the ff:
import arcpy, os, math
arcpy.CheckOutExtension("Spatial")
ws1 = r"E:\clip_qx"
ws2 = r"E:\clip_qy"
outws = r"E:\ras_calc_qxy"
arcpy.env.workspace = ws1
rasterlist = arcpy.ListRasters()
for r in rasterlist:
r1 = arcpy.sa.Raster(r)
r2 = arcpy.sa.Raster(os.path.join(ws2,r1))
result = (r1*r1) + (r2*r2)
result.save(os.path.join(outws, r))