예제 #1
0
def test_netcdf():
    import netCDF4 as nc
    from birdy.client.converters import Netcdf4Converter, JSONConverter

    # Xarray is the default converter. Use netCDF4 here.
    if nc.getlibversion() > "4.5":
        m = WPSClient(url=url, processes=["output_formats"], converters=[Netcdf4Converter, JSONConverter])
        ncdata, jsondata = m.output_formats().get(asobj=True)
        assert isinstance(ncdata, nc.Dataset)
        ncdata.close()
        assert isinstance(jsondata, dict)
예제 #2
0
def test_52north_offline():
    """Check offline 52north processes."""
    WPSClient(
        url_52n,
        caps_xml=open(resource_file("wps_52n_caps.xml"), "rb").read(),
        desc_xml=open(resource_file("wps_52n_desc.xml"), "rb").read(),
    )
예제 #3
0
def test_wps_with_language_arg():  # noqa: D103
    wps = WPSClient(URL_EMU, language="fr-CA")
    assert wps.language == "fr-CA"
    p = wps._processes["translation"]
    assert p.title == "Processus traduit"
    resp = wps.translation(10)
    assert resp.processOutputs[0].title == "Sortie #1"
예제 #4
0
파일: test_client.py 프로젝트: f-PLT/birdy
def test_wps_with_language_arg():
    wps = WPSClient(URL_EMU, language='fr-CA')
    assert wps.language == 'fr-CA'
    p = wps._processes['translation']
    assert p.title == "Processus traduit"
    resp = wps.translation(10)
    assert resp.processOutputs[0].title == "Sortie #1"
예제 #5
0
def test_process_subset_names():  # noqa: D103
    with pytest.raises(ValueError, match="missing"):
        WPSClient(url=URL_EMU, processes=["missing"])
    with pytest.raises(ValueError, match="wrong, process, names"):
        WPSClient(url=URL_EMU, processes=["wrong", "process", "names"])
예제 #6
0
def test_process_subset_only_one():  # noqa: D103
    m = WPSClient(url=URL_EMU, processes=["nap", "sleep"])
    assert count_class_methods(m) == 2

    m = WPSClient(url=URL_EMU, processes="nap")
    assert count_class_methods(m) == 1
예제 #7
0
def test_interactive(capsys):  # noqa: D103
    m = WPSClient(url=URL_EMU, progress=True)
    assert m.hello("david").get()[0] == "Hello david"
    captured = capsys.readouterr()
    assert captured.out.startswith(str(datetime.date.today()))
    assert m.binaryoperatorfornumbers().get()[0] == 5
예제 #8
0
def test_interactive(capsys):
    m = WPSClient(url=url, progress=True)
    assert m.hello("david").get()[0] == "Hello david"
    captured = capsys.readouterr()
    assert captured.out.startswith(str(datetime.date.today()))
    assert m.binaryoperatorfornumbers().get()[0] == 5
예제 #9
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May  9 11:24:45 2019

@author: ets
"""

import time

import pandas as pd
from birdy import WPSClient

url = "http://localhost:9099/wps"
wps = WPSClient(url, progress=True)

nbBasin = 5797

for i in range(1, nbBasin + 1):

    # Read the current dataset
    tmp = pd.read_csv('gauged_catchment_properties.csv')

    # Read the land use data
    Forest = tmp['forest']
    Shrubs = tmp['shrubs']
    Wetland = tmp['wetland']
    Crops = tmp['crops']
    Urban = tmp['urban']
    Grass = tmp['grass']
    SnowIce = tmp['snowIce']
예제 #10
0
파일: test_client.py 프로젝트: f-PLT/birdy
def test_52north_simple():
    """Check only a few 52north processes."""
    WPSClient(url_52n, processes=[
        'org.n52.wps.server.algorithm.r.AnnotationValidation',
        'org.n52.wps.server.r.uncertweb.make-realizations',
    ])
예제 #11
0
# -*- coding: utf-8 -*-
"""Top-level package for rooki."""

__author__ = """Carsten Ehbrecht"""
__contact__ = "*****@*****.**"
__copyright__ = "Copyright 2018 United Kingdom Research and Innovation"
__license__ = "BSD - see LICENSE file in top-level package directory"
__version__ = "0.1.0"

from birdy import WPSClient
from rooki import config

rooki = WPSClient(config.get_config_value('service', 'url'), verify=False)
예제 #12
0
def test_process_subset_only_one():
    m = WPSClient(url=url, processes=["nap", "sleep"])
    assert count_class_methods(m) == 2

    m = WPSClient(url=url, processes="nap")
    assert count_class_methods(m) == 1
예제 #13
0
 def test_birdy(self):
     pytest.importorskip("birdy")
     from birdy import WPSClient
     WPSClient(url=self.URL, caps_xml=self.cap, desc_xml=self.desc)
예제 #14
0
파일: test_client.py 프로젝트: f-PLT/birdy
def test_flyingpigeon_offline():
    WPSClient(
        url_fly,
        caps_xml=open(resource_file('wps_fly_caps.xml'), 'rb').read(),
        desc_xml=open(resource_file('wps_fly_desc.xml'), 'rb').read(),
    )
예제 #15
0
파일: test_client.py 프로젝트: f-PLT/birdy
def test_flyingpigeon():
    WPSClient(url_fly)
예제 #16
0
def wps():  # noqa: D103
    return WPSClient(url=URL_EMU)
예제 #17
0
def test_flyingpigeon():  # noqa: D103
    WPSClient(url_fly)
예제 #18
0
def wps_offline():  # noqa: D103
    return WPSClient(url=URL_EMU, caps_xml=EMU_CAPS_XML, desc_xml=EMU_DESC_XML)
예제 #19
0
파일: test_client.py 프로젝트: f-PLT/birdy
def test_52north():
    """This WPS server has process and input ids with dots and dashes."""
    WPSClient(url_52n)
예제 #20
0
def wps():
    return WPSClient(url=url)
예제 #21
0
def test_52north():
    """This WPS server has process and input ids with dots and dashes."""
    url = "http://geoprocessing.demo.52north.org:8080/wps/" \
          "WebProcessingService?service=WPS&version=2.0.0&request=GetCapabilities"
    WPSClient(url)
예제 #22
0
def test_flyingpigeon_offline():  # noqa: D103
    WPSClient(
        url_fly,
        caps_xml=open(resource_file("wps_fly_caps.xml"), "rb").read(),
        desc_xml=open(resource_file("wps_fly_desc.xml"), "rb").read(),
    )
예제 #23
0
def test_flyingpigeon():
    url = 'https://pavics.ouranos.ca/twitcher/ows/proxy/flyingpigeon/wps'
    WPSClient(url)
from birdy import WPSClient
import birdy
from os.path import basename
import urllib.request

fp_server = 'http://localhost:8093/wps'  # flyingpigeon
fp_i = WPSClient(fp_server, progress=True)
fp = WPSClient(fp_server)

finch_server = 'http://localhost:8092/wps'  # finch
finch_i = WPSClient(url=finch_server, progress=True)
finch = WPSClient(finch_server)

# files to be displayed

tas_obs = '/home/nils/nap_niger/data/bbox/tas_AFR-22_ECMWF-ERAINT_evaluation_r1i1p1_CLMcom-KIT-CCLM5-0-15_v1_day_19790101-20161231.nc'
tas_hist = '/home/nils/nap_niger/data/bbox/tas_AFR-22_MOHC-HadGEM2-ES_historical_r1i1p1_CLMcom-KIT-CCLM5-0-15_v1_day_19500101-20051230.nc'
tasAdjust_hist = '/home/nils/nap_niger/data/adjust/tasAdjust_AFR-22_MOHC-HadGEM2-ES_historical_r1i1p1_CLMcom-KIT-CCLM5-0-15_v1_day_19500101-20051230.nc'
tas26Adjust_rcp26 = '/home/nils/nap_niger/data/adjust/tasAdjust_AFR-22_MOHC-HadGEM2-ES_rcp26_r1i1p1_CLMcom-KIT-CCLM5-0-15_v1_day_20060101-20981230.nc'

url_obs = finch.tg_mean(tas=tas_obs, freq='YS').get()[0]
url_hist = finch.tg_mean(tas=tas_hist, freq='YS').get()[0]
url_histAjust = finch.tg_mean(tas=tasAdjust_hist, freq='YS').get()[0]
url_rcp26Ajust = finch.tg_mean(tas=tas26Adjust_rcp26, freq='YS').get()[0]

plot = fp.plot_spaghetti(
    resource=[url_obs, url_hist, url_histAjust, url_rcp26Ajust], variable=None)

# get the url for the image to be displayed in a web browser
plot.get()[0]
예제 #25
0
파일: test_client.py 프로젝트: f-PLT/birdy
def wps():
    return WPSClient(url=URL_EMU)