Xander Bakker,@Dan Patterson, Randy burton, @kevin Dunlop, @Joshua Bixby After getting the code to run using just numbers to replace the rasters, I tried this code but it didn't quite work. Please help. This is doing my head in. I tried this code which I basically tried to cut out a chunk of a code that once worked in iteration. Please help. I am running out of time for a dealine
import os
... import arcpy
... import scipy
... import numpy as np
... def myFunction(z):
... E = z[0]
... G = z[1]
... H = z[2]
... F = np.empty((3))
... F[0] = (file/fize)*3*H*pow(abs(H),-(1/6))-G
... F[1] = fixe-E-H-G
... F[2] = file*H-E
... return F
...
... zGuess= np.array([1,1,1])
... arcpy.env.workspace ="D:/GIS Data/Sixth Creek ET.gdb"
... rasters = arcpy.ListRasters("*", "All")
... path = "C:\\Workspace\\test geowrite\\Betasigma\\"
... path2 = "C:\\Workspace\\test geowrite\\sigma\\"
... path3 = "C:\\Workspace\\test geowrite\\Netrad\\"
... files= [f for f in os.listdir(path) if f.endswith(".tif")]
... fizes= [f for f in os.listdir(path2) if f.endswith(".tif")]
... fixes= [f for f in os.listdir(path2) if f.endswith(".tif")]
... for i in range(0,46):
... file = path+files
... fize = path2+fizes
... fixe = path3+fixes
... z = fsolve(myFunction,zGuess)
...
Runtime error
Traceback (most recent call last):
File "<string>", line 28, in <module>
File "C:\Program Files (x86)\python27\ArcGIS10.4\lib\site-packages\scipy\optimize\minpack.py", line 140, in fsolve
res = _root_hybr(func, x0, args, jac=fprime, **options)
File "C:\Program Files (x86)\python27\ArcGIS10.4\lib\site-packages\scipy\optimize\minpack.py", line 197, in _root_hybr
shape, dtype = _check_func('fsolve', 'func', func, x0, args, n, (n,))
File "C:\Program Files (x86)\python27\ArcGIS10.4\lib\site-packages\scipy\optimize\minpack.py", line 20, in _check_func
res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
File "<string>", line 10, in myFunction
TypeError: unsupported operand type(s) for /: 'str' and 'str'