Prompting user for variables in a function

88 views Asked by At

I have created a python script with a selection of functions for image processing. Each of these functions require variables to be inserted into them by the user.

I'm trying to work out how to prompt the user to define the variables for the function to work. The variables being inputted will be strings / file paths.

Below is an example of the function and also the start of the main procedural program:

def SRTMprocessing():
    """
    The following function mosaics together SRTM tiles, then reprojects the
    mosaic from WGS84 geographic coordinate to a projected WGS84 UTM zone
    coordinate system.
    """

    # Defining inputs

    DTM_output = "/DEMs/SRTM.tif"
    SRTM_input1 = ""
    SRTM_input2 = ""
    SRTM_input3 = ""
    UTM_Zone = ""
    Overwrite = DTM_output
    Reprojected_DTM = ""

    # Unzipping and mosaicing the Digital Terrain Model

    os.system("gdal_merge.py -init 0 -o %s %s"
             %(DTM_output, tiles))

    # Reprojecting from WGS84 geographic projection to UTM zone projection

    os.system("gdalwarp -t_srs '+proj=utm +zone=%s +datum=WGS84' -overwrite %s\
             %s" %(UTM_Zone, Overwrite, Reprojected_DTM))

    os.system("rm %s" %(DTM_output))

print ("Which data type are you processing?"),

data_type = input()
elif data_type == "SRTM":

print("Processing the SRTM input.")

SRTMprocessing()

In the example above the empty variables are what I want the user to provide. How do I write this into my python script?

Many Thanks for the help!

0

There are 0 answers