예제 #1
0
    def get_redirect_url(self, *args, **kwargs):
        post = self.request.POST

        data, station = get_data(post)
        series = Flow(data=data, source=station)

        if post['date_start'] != '':
            series.date(date_start=post['date_start'],
                        date_end=post['date_end'])

        maxima = series.maximum(station)

        self.request.COOKIES['serie'] = maxima

        data, fig = maxima.plot_hydrogram()
        div = opy.plot(data, auto_open=False, output_type='div')
        self.request.COOKIES['div'] = div

        return reverse('reduction:results')
예제 #2
0
    def post(self, request, *args, **kwargs):
        post = self.request.POST

        data, station = get_data(post)
        series = Flow(data=data, source=station)

        if post['date_start'] != '':
            series.date(date_start=post['date_start'],
                        date_end=post['date_end'])

        maxima = series.maximum(station)

        self.request.COOKIES['serie'] = maxima

        data, fig = maxima.plot_hydrogram()
        div = opy.plot(data, auto_open=False, output_type='div')
        magn = dict()
        for i in [2, 10, 20, 30, 50, 100]:
            magn[i] = round(maxima.magnitude(i, estimador='mml'), 3)

        context = {'magn': magn, 'graphs': div}
        return render(request, 'reduction/serie_result.html', context=context)