Birdy

Birdy offers through its WPSClient class a simplified interface to WPS processes, but it does not yet support the CWT-API extension (see issue 102). Look at the doc for more info.


In [1]:
from birdy import WPSClient
wps = WPSClient('https://bovec.dkrz.de/ows/proxy/pelican')
# wps = WPSClient('http://localhost:5000/wps')
help(wps.pelican_subset)


Help on method pelican_subset in module birdy.client.base:

pelican_subset(variable=None, domain=None, operation=None) method of birdy.client.base.WPSClient instance
    subset netcdf files
    
    Parameters
    ----------
    variable : ComplexData:mimetype:`application/json`
        variable
    domain : ComplexData:mimetype:`application/json`
        domain
    operation : ComplexData:mimetype:`application/json`
        operation
    
    Returns
    -------
    nc : ComplexData:mimetype:`application/x-netcdf`
        NetCDF
    preview : ComplexData:mimetype:`image/png`
        Preview of subsetted Dataset.
    output : ComplexData:mimetype:`application/json`
        Output


In [2]:
from owslib_esgfwps import Variable, Domain, Dimension

In [3]:
# data files we want to process
files = [
    # OpenDAP, CORDEX EUR-44, tasmax, climate index SU (summer days)
    'http://opendap.knmi.nl/knmi/thredds/dodsC/CLIPC/gerics/climatesignalmaps/EUR-44/tasmax/su_python-2-7-6_GERICS_ens-multiModel-climatesignalmap-rcp85-EUR-44_yr_20700101-20991231_1971-2000.nc',
]

In [4]:
su = Variable(uri=files[0], var_name='su')

In [5]:
domain = Domain({'time': Dimension(0, 1, crs='indices')}, )

In [6]:
from owslib_esgfwps import Variables, Domains

resp = wps.pelican_subset(variable=Variables([su]), domain=Domains([domain]))


 owslib.wps.WPSException : {'code': 'NoApplicableCode', 'locator': 'None', 'text': 'Process error: subsetting failed.'}

In [7]:
resp.get(asobj=False)


---------------------------------------------------------------------------
ProcessFailed                             Traceback (most recent call last)
<ipython-input-7-45a9c56a191d> in <module>
----> 1 resp.get(asobj=False)

~/git/Bird-house/birdy/birdy/client/outputs.py in get(self, asobj)
     29         if not self.isSucceded():
     30             # TODO: add reason for failure
---> 31             raise ProcessFailed("Sorry, process failed.")
     32         return self._make_output(asobj)
     33 

ProcessFailed: Sorry, process failed.

In [11]:
out = resp.get(asobj=True)


---------------------------------------------------------------------------
ProcessFailed                             Traceback (most recent call last)
<ipython-input-11-82e6f8a3e95f> in <module>
----> 1 out = resp.get(asobj=True)

~/git/Bird-house/birdy/birdy/client/outputs.py in get(self, asobj)
     29         if not self.isSucceded():
     30             # TODO: add reason for failure
---> 31             raise ProcessFailed("Sorry, process failed.")
     32         return self._make_output(asobj)
     33 

ProcessFailed: Sorry, process failed.

In [12]:
out.preview


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-12-cb2026b269ed> in <module>
----> 1 out.preview

NameError: name 'out' is not defined