Beispiel #1
0
    def test_subset_wfs_opendap_multi_inputs_01(self):
        # pairing0.1.1-montreal_circles0.1.1
        config_dict = wps_tests_utils.config_is_available(
            'pairing0.1.1-montreal_circles0.1.1',
            ['opendap_path', 'fileserver_path', 'geoserver'],
            self.config,
            set_wps_host=True)

        # let's start with one example...
        resource1 = os.path.join(
            config_dict['opendap_path'],
            'pairing_day_global-reg-grid_360_720_nobounds_ref180.nc')
        resource2 = os.path.join(
            config_dict['opendap_path'],
            'pairing_day_global-reg-grid_360_720_bounds_ref180.nc')

        wps_request = (
            '?service=WPS&request=execute&version=1.0.0&'
            'identifier=subset_WFS&DataInputs=resource={0};resource={1};'
            'typename={2};featureids={3};featureids={4};geoserver={5}').format(
                resource1, resource2, 'testgeom:montreal_circles',
                'montreal_circles.43', 'montreal_circles.45',
                config_dict['geoserver'])

        html_response = wps_tests_utils.wps_response(config_dict['wps_host'],
                                                     wps_request, self.client)
        outputs = wps_tests_utils.parse_execute_response(html_response)
        if outputs['status'] == 'ProcessFailed':
            raise RuntimeError(wps_request)
        output_json = outputs['outputs']['output']
        if output_json[:7] == 'file://':
            output_json = output_json[7:]
            f1 = open(output_json, 'r')
            json_data = json.loads(f1.read())
            f1.close()
        else:
            json_data = json.loads(wps_tests_utils.get_wps_xlink(output_json))
        self.assertEqual(len(json_data), 4)
        output_netcdf = json_data[0]
        if output_netcdf[:7] == 'file://':
            tmp_output_netcdf = output_netcdf[7:]
        else:
            tmp_output_netcdf = '/tmp/testtmp.nc'
            f1 = open(tmp_output_netcdf, 'w')
            f1.write(wps_tests_utils.get_wps_xlink(output_netcdf))
            f1.close()

        nc = netCDF4.Dataset(tmp_output_netcdf, 'r')
        nclon = nc.variables['lon']
        nclat = nc.variables['lat']
        ncvar = nc.variables['pairing']
        self.assertEqual(nclon.shape, (21, ))
        self.assertEqual(nclat.shape, (21, ))
        self.assertEqual(ncvar.shape, (365, 21, 21))
        self.assertTrue(ncvar[0, 0, 0] is ma.masked)
        self.assertEqual(ncvar[0, 10, 10], 271213.0)
        self.assertEqual(nc.subset_typename, 'testgeom:montreal_circles')
        self.assertEqual(nc.subset_featureid, 'montreal_circles.43')
        nc.close()
Beispiel #2
0
    def test_getcapabilities(self):
        config_dict = wps_tests_utils.config_is_available(
            'averagerwfs', [], self.config, set_wps_host=True)

        html_response = wps_tests_utils.wps_response(
            config_dict['wps_host'],
            '?service=WPS&request=GetCapabilities&version=1.0.0',
            self.client)
        self.assertTrue(html_response)
Beispiel #3
0
    def test_process_exists(self):
        config_dict = wps_tests_utils.config_is_available('subsetwfs', [],
                                                          self.config,
                                                          set_wps_host=True)

        html_response = wps_tests_utils.wps_response(
            config_dict['wps_host'],
            '?service=WPS&request=GetCapabilities&version=1.0.0', self.client)
        processes = wps_tests_utils.parse_getcapabilities(html_response)
        self.assertTrue('subset_WFS' in processes)
Beispiel #4
0
    def test_describeprocess(self):
        config_dict = wps_tests_utils.config_is_available(
            'averagerwfs', [], self.config, set_wps_host=True)

        html_response = wps_tests_utils.wps_response(
            config_dict['wps_host'],
            ('?service=WPS&request=DescribeProcess&version=1.0.0&'
             'identifier=averager_WFS'),
            self.client)
        describe_process = wps_tests_utils.parse_describeprocess(html_response)
        self.assertTrue('mosaic' in describe_process[0]['inputs'])
        self.assertTrue('output' in describe_process[0]['outputs'])