def test_wps_spatial_analog_process_small_sample(): client = client_for( Service(processes=[SpatialAnalogProcess()], cfgfiles=CFG_FILE)) datainputs = ("candidate=files@xlink:href={0};" "target=files@xlink:href={1};" "location={2},{3};" "indices={4};" "indices={5};" "dist={6};" "dateStartCandidate={7};" "dateEndCandidate={8};" "dateStartTarget={7};" "dateEndTarget={8}").format(TESTDATA['indicators_small.nc'], TESTDATA['indicators_medium.nc'], -72, 46, 'meantemp', 'totalpr', 'kldiv', '1970-01-01', '1990-01-01') resp = client.get(service='wps', request='execute', version='1.0.0', identifier='spatial_analog', datainputs=datainputs) assert_response_success(resp)
def test_wps_point_inspection(): client = client_for( Service(processes=[PointinspectionProcess()], cfgfiles=CFG_FILE)) datainputs = datainputs_fmt.format( TESTDATA['cmip5_tasmax_2006_nc'], "2.356138, 48.846450", ) resp = client.get(service='wps', request='execute', version='1.0.0', identifier='pointinspection', datainputs=datainputs) assert_response_success(resp)
def run_service(): with ocgis.vm.scoped('Service launch', [0]): # There will be null communicators for the duration of the context manager. if not ocgis.vm.is_null: client = client_for( Service(processes=[M1Process()], cfgfiles=CFG_FILE)) datainputs = "resource=files@xlink:href={0}".format(TESTDATA['cmip5_tasmax_2006_nc']) resp = client.get( service='wps', request='execute', version='1.0.0', identifier='mpimean', datainputs=datainputs) print(resp.response)
def test_wps_map_spatial_analog(): client = client_for( Service(processes=[MapSpatialAnalogProcess()], cfgfiles=CFG_FILE)) datainputs = ( "resource=files@xlink:href={0};" "fmt={1};fmt={2};fmt={3};fmt={4};" "title={5}" ).format(TESTDATA['dissimilarity.nc'], 'png', 'pdf', 'svg', 'eps', "Spatial Analog Example") resp = client.get( service='wps', request='execute', version='1.0.0', identifier='map_spatial_analog', datainputs=datainputs) assert_response_success(resp)
def test_wps_esmfregrid_process(): client = client_for( Service(processes=[ESMFRegridProcess()], cfgfiles=CFG_FILE)) datainputs = datainputs_fmt.format( TESTDATA['cmip5_tasmax_2006_nc'], TESTDATA['cordex_tasmax_2006_nc'], "bilinear", "True", ) resp = client.get(service='wps', request='execute', version='1.0.0', identifier='esmf_regrid', datainputs=datainputs) #print(resp.response[0]) #print(datainputs) assert_response_success(resp)
def test_wps_subset_countries(): client = client_for( Service(processes=[ClippingProcess()], cfgfiles=CFG_FILE)) datainputs = datainputs_fmt.format( TESTDATA['cmip5_tasmax_2006_nc'], 'CAN', "True", ) resp = client.get(service='wps', request='execute', version='1.0.0', identifier='subset_countries', datainputs=datainputs) assert_response_success(resp) # Check output file size is smaller than input. out = get_output(resp.xml) ins = os.path.getsize(TESTDATA['cmip5_tasmax_2006_nc'][6:]) outs = os.path.getsize(out['ncout'][6:]) assert (outs < ins)