Skip to content

Commit

Permalink
#12 getDiff webservice
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuku Man committed Apr 9, 2019
1 parent ed9a412 commit 2b73ef1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
24 changes: 23 additions & 1 deletion webAPI/GPS_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,29 @@ def getURLprefix():
def run_getDiff(args):
""" run getDiff function """

return "True"
# required sta1 sta2
# non-required az
inputdict = {}
inputdict ['sta1'] = args ['sta1']
inputdict ['sta2'] = args ['sta2']

inputdict['az'] = False
if 'az' in args:
inputdict['az'] = args['az']


outputdir = setoutputlocation()
inputdict ['output'] = outputdir + os.path.sep
paras = objdict(inputdict)
getDiff(paras)
# list of output file
kmllist = os.listdir(outputdir)
urlprefix = getURLprefix()
foldername = os.path.basename(outputdir)
urlslist = [urlprefix + foldername + "/" + x for x in kmllist]

return json.dumps({"urlprefix":urlprefix,"folder":foldername,"results":kmllist,"urls":urlslist})


def generateKML(args):
""" main function to generate KMLs """
Expand Down
8 changes: 8 additions & 0 deletions webAPI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ http://172.16.104.138:5000/gpsservice/kml?function=getvelocities&lat=33.1&lon=-1
output:
{"results": ["velocity_vertical.kml", "velocity_table.txt", "velocity_horizontal.kml"], "urlprefix": "http://172.16.104.138:5000/static/", "folder": "kml096320193009113018", "urls": ["http://172.16.104.138:5000/static/kml096320193009113018/velocity_vertical.kml", "http://172.16.104.138:5000/static/kml096320193009113018/velocity_table.txt", "http://172.16.104.138:5000/static/kml096320193009113018/velocity_horizontal.kml"]}

getDiff
paras: sta1 sta1 az(optional)
sample call:
http://172.16.104.138:5000/gpsservice/kml?function=getDiff&sta1=P493&sta2=P503&az=100
output:
{"urls": ["http://172.16.104.138:5000/static/kml116420190109140151/P493-P503_az100.txt"], "folder": "kml116420190109140151", "urlprefix": "http://172.16.104.138:5000/static/", "results": ["P493-P503_az100.txt"]}


Add a new non-required parameter:
-- add para to nonrequired list
-- set the default value
Expand Down
3 changes: 3 additions & 0 deletions webAPI/getDiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def getDiff(results):
else:
output = results.sta1 + "-" + results.sta2 + ".txt"
angle = 0.0
#setup output folder
output = results.output + output

#print(angle)
location1 = 'https://sideshow.jpl.nasa.gov/pub/JPL_GPS_Timeseries/repro2018a/post/point/'+sta1+'.series'
location2 = 'https://sideshow.jpl.nasa.gov/pub/JPL_GPS_Timeseries/repro2018a/post/point/'+sta2+'.series'
Expand Down

0 comments on commit 2b73ef1

Please sign in to comment.