我创建了一个python脚本,其中包含一系列用于图像处理的函数。这些函数中的每一个都需要用户将变量插入到它们中。
我正在尝试找出如何提示用户定义要使用的函数的变量。输入的变量将是字符串/文件路径。
以下是该功能的示例以及主程序程序的开始:
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()
在上面的示例中,空变量是我希望用户提供的。如何将其写入我的python脚本?
非常感谢您的帮助!