def calculate_surface_features(temp_ascii_dem, input_array, output_srf, window_size, window_count, window_step, output_text_file):
    
    # Now export the final DEM to an Arc ASCII format
    LB_ArrayUtils.writeArrayToFile(temp_ascii_dem, input_array, "Float", "E", 1)

    print ("writing file to %s" % temp_ascii_dem)

    # Construct a command string for Landserf

    #java_comm = "java -classpath .%s../../../lib/landserf/landserf230.jar%s../../../lib/landserf/utils230.jar RandomSurface" % (os.pathsep, os.pathsep)
    java_comm = "java -classpath .%slib/landserf/landserf230.jar%slib/landserf/utils230.jar RandomSurface" % (os.pathsep, os.pathsep)
    print "Java command is:"


    # NB - for Windows a semi-colon is needed, rather than a colon :-(

    # Append space and input file name 
    java_command = "%s \"%s\" \"%s\" %d %d %d \"%s\"" % (java_comm, temp_ascii_dem, output_srf, window_size, window_count, window_step, output_text_file) 
    print java_command

    # cd to java directory 
    savedPath = os.getcwd()
    newPath = "%s/java" % savedPath
    os.chdir(newPath)
            
    # run java
    os.system(java_command)

    os.chdir(savedPath)
##for i in range(1,(erosion_runs+1)):
##
##    newDEM = Hydro_Network.RiverNetwork(erodedDEMs[i-1], generated_DEMs, i, variables['river_drop'])
##    erodedDEMs.append(newDEM)
##
### Now we should have the whole sequence of erosions - let's save them and see how it looks
##pylab.imsave("Output/DEM_before_erosion",erodedDEMs[0])
##for i in range(1,erosion_runs):
##    erodedDEMname = "Output/DEM_input%d" % i
##    pylab.imsave(erodedDEMname,erodedDEMs[i])

i = 0
# TODO remove the line above for full runs

# Now export the final DEM to an Arc ASCII format
LB_ArrayUtils.writeArrayToFile(variables['ascii_dem'], erodedDEMs[i], "Float", "E", 1)
print "writing file to %s" % variables['ascii_dem']

# Construct a command string for Landserf
# input file = the DEM that was just written out 
# output file = qualifiedparams['output_csv']
# window size = variables['window_size']

# java_comm = "java -classpath .:~/src/rdv-framework/lib/landserf/landserf230.jar:~/src/rdv-framework/lib/landserf/utils230.jar RandomSurface"
java_comm = "java  -classpath .;../../../lib/landserf/landserf230.jar;../../../lib/landserf/utils230.jar RandomSurface"

# Append space and input file name TODO
java_command = "%s ../%s ../%s %d ../%s" % (java_comm, variables['ascii_dem'], variables['output_features'], variables['window_size'],variables['landserf_output']) 
# java_command += qualifiedparams['ascii_dem']
#java_command += qualifiedparams['output_features']
# java_command += variables['window_size']