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')
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))
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')
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')
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 }, )
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')
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')