Exemple #1
0
def profileCsv(request, layerId):
    offset = datetime.timedelta(hours=settings.XGDS_PLOT_TIME_OFFSET_HOURS)
    minTime = parseTime(request.GET.get('start', '-72'), offset)
    maxTime = parseTime(request.GET.get('end', 'now'), offset)
    assert minTime <= maxTime, 'HTTP GET parameters: start, end: start time must be before end time'
    fill = int(request.GET.get('fill', '1'))
    assert fill in (0, 1), 'HTTP GET parameters: fill: specify either 0 or 1'
    csvData = profiles.getProfileCsvData(layerId,
                                         minTime=minTime,
                                         maxTime=maxTime,
                                         fill=fill)
    django.db.reset_queries()  # clear query log to reduce memory usage
    return HttpResponse(csvData, content_type='text/csv')
Exemple #2
0
def profileCsv(request, layerId):
    offset = datetime.timedelta(hours=settings.XGDS_PLOT_TIME_OFFSET_HOURS)
    minTime = parseTime(request.GET.get('start', '-72'), offset)
    maxTime = parseTime(request.GET.get('end', 'now'), offset)
    assert minTime <= maxTime, 'HTTP GET parameters: start, end: start time must be before end time'
    fill = int(request.GET.get('fill', '1'))
    assert fill in (0, 1), 'HTTP GET parameters: fill: specify either 0 or 1'
    csvData = profiles.getProfileCsvData(layerId,
                                         minTime=minTime,
                                         maxTime=maxTime,
                                         fill=fill)
    django.db.reset_queries()  # clear query log to reduce memory usage
    return HttpResponse(csvData,
                        content_type='text/csv')
Exemple #3
0
def profilesPage(request):
    offset = datetime.timedelta(hours=settings.XGDS_PLOT_TIME_OFFSET_HOURS)
    minTime = parseTime(request.GET.get('start', '-72'), offset)
    maxTime = parseTime(request.GET.get('end', 'now'), offset)
    assert minTime <= maxTime, 'HTTP GET parameters: start, end: start time must be before end time'
    showSamplePoints = int(request.GET.get('pts', '1'))
    assert showSamplePoints in (0, 1), 'HTTP GET parameters: pts: specify either 0 or 1'
    return render_to_response('xgds_plot/profiles.html',
                              {'minTime': javaStyle(minTime),
                               'maxTime': javaStyle(maxTime),
                               'showSamplePoints': showSamplePoints,
                               'minDisplayTime': shortTime(minTime + offset),
                               'maxDisplayTime': shortTime(maxTime + offset),
                               'displayTimeZone': settings.XGDS_PLOT_TIME_ZONE_NAME,
                               'profiles': profiles.PROFILES},
                              context_instance=RequestContext(request))
Exemple #4
0
def getStaticPlot(request, seriesId):
    if seriesId not in meta.getTimeSeriesLookup():
        return HttpResponseNotFound('<h1>404 No time series named "%s"</h1>' %
                                    seriesId)

    offset = datetime.timedelta(hours=settings.XGDS_PLOT_TIME_OFFSET_HOURS)
    minTime = parseTime(request.GET.get('start', '-72'), offset)
    maxTime = parseTime(request.GET.get('end', 'now'), offset)
    assert minTime <= maxTime, 'HTTP GET parameters: start, end: start time must be before end time'

    widthPix = int(request.GET.get('w', '800'))
    heightPix = int(request.GET.get('h', '120'))

    imgData = (staticPlot.getPlotDataMultiprocessing(seriesId, widthPix,
                                                     heightPix,
                                                     javaStyle(minTime),
                                                     javaStyle(maxTime)))
    django.db.reset_queries()  # clear query log to reduce memory usage
    return HttpResponse(imgData, content_type='image/png')
Exemple #5
0
def profileRender(request, layerId):
    widthPix = int(request.GET.get('w', settings.XGDS_PLOT_PROFILE_TIME_PIX_RESOLUTION))
    heightPix = int(request.GET.get('h', settings.XGDS_PLOT_PROFILE_Z_PIX_RESOLUTION))
    offset = datetime.timedelta(hours=settings.XGDS_PLOT_TIME_OFFSET_HOURS)
    minTime = parseTime(request.GET.get('start', '-72'), offset)
    maxTime = parseTime(request.GET.get('end', 'now'), offset)
    assert minTime <= maxTime, 'HTTP GET parameters: start, end: start time must be before end time'
    # submitted = request.GET.get('submit') is not None
    showSamplePoints = int(request.GET.get('pts', '1'))
    assert showSamplePoints in (0, 1), 'HTTP GET parameters: pts: specify either 0 or 1'
    imageData = (profiles.getProfileContourPlotImageDataMultiprocessing
                 (layerId,
                  widthPix=widthPix,
                  heightPix=heightPix,
                  minTime=minTime,
                  maxTime=maxTime,
                  showSamplePoints=showSamplePoints))
    django.db.reset_queries()  # clear query log to reduce memory usage
    return HttpResponse(imageData,
                        content_type='image/png')
Exemple #6
0
def profilesPage(request):
    offset = datetime.timedelta(hours=settings.XGDS_PLOT_TIME_OFFSET_HOURS)
    minTime = parseTime(request.GET.get('start', '-72'), offset)
    maxTime = parseTime(request.GET.get('end', 'now'), offset)
    assert minTime <= maxTime, 'HTTP GET parameters: start, end: start time must be before end time'
    showSamplePoints = int(request.GET.get('pts', '1'))
    assert showSamplePoints in (
        0, 1), 'HTTP GET parameters: pts: specify either 0 or 1'
    return render(
        request,
        'xgds_plot/profiles.html',
        {
            'minTime': javaStyle(minTime),
            'maxTime': javaStyle(maxTime),
            'showSamplePoints': showSamplePoints,
            'minDisplayTime': shortTime(minTime + offset),
            'maxDisplayTime': shortTime(maxTime + offset),
            'displayTimeZone': settings.XGDS_PLOT_TIME_ZONE_NAME,
            'profiles': profiles.PROFILES
        },
    )
Exemple #7
0
def getStaticPlot(request, seriesId):
    if seriesId not in meta.getTimeSeriesLookup():
        return HttpResponseNotFound('<h1>404 No time series named "%s"</h1>' % seriesId)

    offset = datetime.timedelta(hours=settings.XGDS_PLOT_TIME_OFFSET_HOURS)
    minTime = parseTime(request.GET.get('start', '-72'), offset)
    maxTime = parseTime(request.GET.get('end', 'now'), offset)
    assert minTime <= maxTime, 'HTTP GET parameters: start, end: start time must be before end time'

    widthPix = int(request.GET.get('w', '800'))
    heightPix = int(request.GET.get('h', '120'))

    imgData = (staticPlot.getPlotDataMultiprocessing
               (seriesId,
                widthPix,
                heightPix,
                javaStyle(minTime),
                javaStyle(maxTime)))
    django.db.reset_queries()  # clear query log to reduce memory usage
    return HttpResponse(imgData,
                        content_type='image/png')
Exemple #8
0
def profileRender(request, layerId):
    widthPix = int(
        request.GET.get('w', settings.XGDS_PLOT_PROFILE_TIME_PIX_RESOLUTION))
    heightPix = int(
        request.GET.get('h', settings.XGDS_PLOT_PROFILE_Z_PIX_RESOLUTION))
    offset = datetime.timedelta(hours=settings.XGDS_PLOT_TIME_OFFSET_HOURS)
    minTime = parseTime(request.GET.get('start', '-72'), offset)
    maxTime = parseTime(request.GET.get('end', 'now'), offset)
    assert minTime <= maxTime, 'HTTP GET parameters: start, end: start time must be before end time'
    # submitted = request.GET.get('submit') is not None
    showSamplePoints = int(request.GET.get('pts', '1'))
    assert showSamplePoints in (
        0, 1), 'HTTP GET parameters: pts: specify either 0 or 1'
    imageData = (profiles.getProfileContourPlotImageDataMultiprocessing(
        layerId,
        widthPix=widthPix,
        heightPix=heightPix,
        minTime=minTime,
        maxTime=maxTime,
        showSamplePoints=showSamplePoints))
    django.db.reset_queries()  # clear query log to reduce memory usage
    return HttpResponse(imageData, content_type='image/png')