예제 #1
0
def get_antenna_params(request, antenna_type = None, elevation_id = None):
  elevation_data = ElevationData.objects.filter(id = elevation_id)
  if len(elevation_data) == 0:
    return HttpResponse('Invalid elevation data')

  (sod, sed) = get_sarry_output(antenna_type, elevation_data[0].model, 'unused',
      split(elevation_data[0].flags) + ['--help-antenna',])

  return HttpResponse(trim_options(sed))
예제 #2
0
파일: views.py 프로젝트: ncrookston/startal
def get_algorithm_params(request, algorithm_type = None, antenna_id = None,
    elevation_id = None):
  elevation_data = ElevationData.objects.filter(id = elevation_id)
  if len(elevation_data) == 0:
    return HttpResponse('Invalid elevation data')

  sar_data = SarData.objects.filter(id = antenna_id)
  if len(sar_data) == 0:
    return HttpResponse('Invalid sar data')

  (sod, sed) = get_sarry_output(sar_data[0].model, elevation_data[0].model,
      algorithm_type, split(sar_data[0].flags) + split(elevation_data[0].flags)
      + ['--help-algorithm',])
  return HttpResponse(trim_options(sed, [('--ul-l', 1), ('--ur-l', 1),
        ('--lr-l', 1), ('--ll-l', 1)]))
예제 #3
0
def add_sar_data(request, name = None, antenna_type = None,
    antenna_flags = None, elevation_id = None):
  elevation_data = ElevationData.objects.filter(id=elevation_id)
  if len(elevation_data) == 0:
    return HttpResponse('invalid elevation data')

  elevation_datum = elevation_data[0]
  (sod, sed) = get_sarry_output(antenna_type, elevation_datum.model, 'summary',
      split(elevation_datum.flags) + split(antenna_flags))

  filename = str(uuid4()) + '.kmz'
  content_file = ContentFile(sod)

  data = SarData(name = name, model = antenna_type, flags = antenna_flags)
  data.overview_kmz.save(filename, content_file)
  data.save()
  return HttpResponse(sed)
예제 #4
0
파일: views.py 프로젝트: ncrookston/startal
def add_task(request, sar_data_id = None, roi_id = None, elevation_id = None,
    algorithm_type = None, algorithm_flags = None):

  elevation_data = ElevationData.objects.filter(id=elevation_id)
  if len(elevation_data) == 0:
    return HttpResponse('invalid elevation data')

  sar_data = SarData.objects.filter(id=sar_data_id)
  if len(sar_data) == 0:
    return HttpResponse('invalid sar data')

  rois = RegionOfInterest.objects.filter(id=roi_id)
  if len(rois) == 0:
    return HttpResponse('invalid roi')

  flags = split(elevation_data[0].flags) \
      + split(sar_data[0].flags) + split(algorithm_flags) \
      + ['--ul-lat', str(rois[0].ulLat), '--ul-lon', str(rois[0].ulLon),
         '--ur-lat', str(rois[0].urLat), '--ur-lon', str(rois[0].urLon),
         '--lr-lat', str(rois[0].lrLat), '--lr-lon', str(rois[0].lrLon),
         '--ll-lat', str(rois[0].llLat), '--ll-lon', str(rois[0].llLon)]
  command = get_sarry_command(sar_data[0].model, elevation_data[0].model,
      algorithm_type, flags)

  data = ProcessingTask(
    elevation_data = elevation_data[0],
    sar_data = sar_data[0],
    roi = rois[0],
    model = algorithm_type,
    flags = algorithm_flags,
    command_text = " ".join(command),
    start_time = datetime.now())
  data.save()

  (sod, sed) = get_sarry_output(sar_data[0].model, elevation_data[0].model,
      algorithm_type, flags)

  filename = str(uuid4()) + '.kmz'
  content_file = ContentFile(sod)

  data.output_kmz.save(filename, content_file)
  data.stop_time = datetime.now()
  data.output_text = sed
  data.save()
  return HttpResponse(sed)
예제 #5
0
def get_elevation_params(request, elevation_type = None):
  (sod, sed) = get_sarry_output('unused', elevation_type, 'unused',
      ['--help-elevation',])
  return HttpResponse(trim_options(sed))