Beispiel #1
0
    def test_classical(self):
        job_id = self.postzip('classical.zip')
        self.wait()
        # check that we get at least the following 4 outputs
        # fullreport, hcurves, hmaps, realizations
        # we can add more outputs in the future
        results = self.get('%s/results' % job_id)
        resnames = [res['name'] for res in results]
        self.assertGreaterEqual(resnames, [
            'Full Report', 'Hazard Curves', 'Hazard Maps', 'Input Files',
            'Realizations'
        ])

        # check the filename of the hmaps
        hmaps_id = results[2]['id']
        resp = self.c.head('/v1/calc/result/%s?export_type=csv' % hmaps_id)
        #
        # remove output ID digits from the filename
        cd = re.sub(r'\d', '', resp.headers['Content-Disposition'])
        self.assertEqual(cd,
                         'attachment; filename=output--hazard_map-mean_.csv')

        # check oqparam
        dic = self.get('%s/extract/oqparam' % job_id)  # parameters
        self.assertEqual(dic['calculation_mode'], 'classical')

        # check extract hcurves
        url = '/v1/calc/%s/extract/hcurves?kind=stats&imt=PGA' % job_id
        resp = self.c.get(url)
        self.assertEqual(resp.status_code, 200)

        # check deleting job without the webAPI
        engine.del_calculation(job_id, True)
Beispiel #2
0
    def test_classical(self):
        job_id = self.postzip('classical.zip')
        self.wait()

        # check that we get at least the following 5 outputs
        # fullreport, hcurves, hmaps, realizations, sourcegroups
        # we can add more outputs in the future
        results = self.get('%s/results' % job_id)
        self.assertGreaterEqual(len(results), 5)

        # check the filename of the hmaps
        hmaps_id = results[2]['id']
        resp = self.c.head('/v1/calc/result/%s?export_type=csv' % hmaps_id)
        # remove output ID digits from the filename
        cd = re.sub(r'\d', '', resp._headers['content-disposition'][1])
        self.assertEqual(
            cd, 'attachment; filename=output--hazard_map-mean_.csv')

        # check oqparam
        resp = self.get('%s/oqparam' % job_id)  # dictionary of parameters
        self.assertEqual(resp['calculation_mode'], 'classical')

        # check the /extract endpoint
        url = '/v1/calc/%s/extract/hazard/rlzs' % job_id
        resp = self.c.get(url)
        self.assertEqual(resp.status_code, 200)

        # check deleting job without the webAPI
        engine.del_calculation(job_id, True)
Beispiel #3
0
    def test_classical(self):
        job_id = self.postzip('classical.zip')
        self.wait()

        # check that we get at least the following 6 outputs
        # fullreport, input, hcurves, hmaps, realizations, sourcegroups
        # we can add more outputs in the future
        results = self.get('%s/results' % job_id)
        self.assertGreaterEqual(len(results), 5)

        # check the filename of the hmaps
        hmaps_id = results[2]['id']
        resp = self.c.head('/v1/calc/result/%s?export_type=csv' % hmaps_id)
        # remove output ID digits from the filename
        cd = re.sub(r'\d', '', resp._headers['content-disposition'][1])
        self.assertEqual(
            cd, 'attachment; filename=output--hazard_map-mean_.csv')

        # check oqparam
        resp = self.get('%s/oqparam' % job_id)  # dictionary of parameters
        self.assertEqual(resp['calculation_mode'], 'classical')

        # check extract hcurves
        url = '/v1/calc/%s/extract/hcurves?kind=stats&imt=PGA' % job_id
        resp = self.c.get(url)
        self.assertEqual(resp.status_code, 200)

        # check deleting job without the webAPI
        engine.del_calculation(job_id, True)