mercredi 7 octobre 2015

Python 3 else SyntaxError: invalid syntax [on hold]

I get this error when running my script, it is probably something simple, but I can't place it!

 else: return ""
   ^

SyntaxError: invalid syntax

def createspawnlist_singlelocation(nparticles, latitude, longitude, date, model_output):

bottom_scrape = 0.1
global p_box_count
o = range(p_box_count, p_box_count + nparticles)
p_box_count = p_box_count + nparticles
p = list(o) #number of particle
latvar = model_output.variables['latc']
lonvar = model_output.variables['lonc']
iy, ix = brute_force_location_index(latvar, lonvar, latitude, longitude)
depth = dataset.variables['bathymetry'][iy,ix]
depthinterval = (depth - bottom_scrape)/(nparticles-1)

if depth > spawn_bottom_depth-tolerance and depth < spawn_bottom_depth + tolerance:
    list_of_lists = [[particle+1,latitude,longitude,(particle)*depthinterval,date] for particle in p]

return list_of_lists
else:
    return ""

Aucun commentaire:

Enregistrer un commentaire