def test_parameters_local( case_id, grid_id, pour_points, uh_box, routing, domain, convolve_config_file, convolve_config_dict, ): with open(uh_box, "r") as uh_box_csv, open(pour_points, "r") as pour_points_csv: params = (f"case_id={case_id};" f"grid_id={grid_id};" f"pour_points_csv={pour_points_csv.read()};" f"uh_box_csv={uh_box_csv.read()};" f"routing=@xlink:href={routing};" f"domain=@xlink:href={domain};") if convolve_config_file: params += f"convolve_config_file=@xlink:href={convolve_config_file};" if convolve_config_dict: params += f"convolve_config_dict=@xlink:href={convolve_config_dict};" run_wps_process(Parameters(), params)
def test_wps_evaluate_rule(rules, parse_tree, variables): datainputs = ( # rewrite to accept list (see quail) f"{build_rule_input(rules)}" f"parse_tree=@xlink:href={parse_tree};" f"variables=@xlink:href={variables};" ) run_wps_process(EvaluateRule(), datainputs)
def test_wps_climdex_spells(climdex_input, func, span_years): with NamedTemporaryFile(suffix=".rda", prefix="output_", dir="/tmp", delete=True) as out_file: datainputs = build_params(climdex_input, func, span_years, out_file.name) run_wps_process(ClimdexSpells(), datainputs)
def test_wps_get_available_indices_rda(climdex_input, ci_name): with NamedTemporaryFile(suffix=".rda", prefix="output_", dir="/tmp", delete=True) as out_file: datainputs = (f"climdex_input=@xlink:href={climdex_input};" f"ci_name={ci_name};" f"output_file={out_file.name};") run_wps_process(GetIndices(), datainputs)
def test_wps_resolve_rules( mock_thredds_url_root, csv, date_range, region, geoserver, ensemble, thredds, ): with open(csv, "r") as csv_file: datainputs = ( f"csv={csv_file.read()};" f"date_range={date_range};" f"region={region};" f"geoserver={geoserver};" f"ensemble={ensemble};" f"thredds={thredds};" ) run_wps_process(ResolveRules(), datainputs)
def run_single_file(netcdf): datainputs = f"netcdf=@xlink:href={netcdf};" run_wps_process(SplitMergedClimos(), datainputs)
def test_wps_update_metadata_netcdf_str(netcdf, updates): run_wps_process(UpdateMetadata(), build_params(netcdf, updates))
def test_wps_update_metadata_opendap_yaml(netcdf, updates): run_wps_process(UpdateMetadata(), build_params(netcdf, updates))
def run_args_collection(wps_test_process_multi_input, file, csv, argc): params = (";".join([f"file={nc}" for nc in file]) + f';csv_input="{csv}"' + f";argc={argc};") run_wps_process(wps_test_process_multi_input, params)