API Reference¶
cwt.auth¶
|
Base authenticator. |
|
Bearer token authenticator. |
|
KeyCloak authenticator. |
-
class
cwt.auth.
Authenticator
(key=None, config_path=None, store=True)¶ Base authenticator.
-
clear
()¶ Removes a stored credential.
- Parameters
key – Identifier of credentials to remove.
-
prepare
(headers, query)¶ Retrieves credentials.
- Parameters
key – Identifier of credentials.
headers – Dict to append authorization headers.
query – Dict to append authorization parameters.
-
read
()¶ Reads credentials.
- Returns
A dict storing credentials.
-
write
(data)¶ Writes credentials.
- Parameters
data – Dict mapping keys to credential store.
-
-
class
cwt.auth.
BearerTokenAuthenticator
(token=None, **kwargs)¶ Bearer token authenticator.
-
class
cwt.auth.
KeyCloakAuthenticator
(url, realm, client_id=None, client_secret=None, pkce=False, redirect_port=None, **kwargs)¶ KeyCloak authenticator.
cwt.dimension¶
|
Coordinate Reference System (CRS). |
|
Dimension. |
Dimension module.
-
class
cwt.dimension.
CRS
(name)¶ Coordinate Reference System (CRS).
Provides information about the CRS of a dimensions values.
-
name
¶ A String name of the CRS.
-
to_dict
()¶ Returns a dictionary representation.
-
-
class
cwt.dimension.
Dimension
(name, start, end, crs=CRS(name='values'), step=None)¶ Dimension.
Describes a dimension of a plane. This dimension can be constrained between two points and the length between each step can be specified or it will default to 1.
There are three pre-defined CRS’s; INDICES, VALUES and TIMESTAMPS.
A dimension starting at 90, ending at -90 with step width of 0.5 degrees.
>>> lat = Dimension('lat', 90, -90, Dimension.VALUES, step=0.5)
A dimension representing a single point at 90.
>>> lat = Dimension.from_single_value(90)
A dimension with a custom name.
>>> lat = Dimension('lat', 90, -90, Dimension.VALUES, step=0.5)
-
start
¶ A (str, int, float) of the starting point.
-
end
¶ A (str, int, float) of the ending point.
-
crs
¶ The CRS of the start and end points.
-
step
¶ The distance between each step between the start and end points.
-
classmethod
from_dict
(data, name)¶ Create dimension from dict representation.
-
classmethod
from_single_index
(name, value, step=None)¶ Creates dimension from single index.
-
classmethod
from_single_value
(name, value, step=None)¶ Creates dimension from single value.
-
parameterize
()¶ Parameterizes object for get queries.
-
cwt.domain¶
|
Domain. |
Domain Module.
-
class
cwt.domain.
Domain
(*args, mask=None, name=None, **kwargs)¶ Domain.
A domain consist of one or more dimensions. A mask can be associated with a domain, further construing the domain being represented.
Simple domain.
>>> domain = Domain([Dimesnion('lat', 90, -90, Dimension.values)])
Domain with a mask.
>>> domain = Domain( Dimension('lat', 90, -90, Dimension.values, name='lat'), Dimension('lon', 0, 90, Dimension.values, name='lon'), mask=Mask('http://thredds/clt.nc', 'clt', 'var_data<0.5'))
-
dimensions
¶ List of Dimensions.
-
mask
¶ Mask to be applied to the domain.
-
name
¶ Name of the domain.
-
classmethod
from_dict
(data)¶ Creates domain from dict reperesentation.
-
parameterize
()¶ Returns parameter for GET request.
-
to_dict
()¶ Returns a dictionary representation.
-
cwt.errors¶
|
|
|
|
|
|
|
|
|
-
exception
cwt.errors.
CWTError
(fmt, *args, **kwargs)¶
-
exception
cwt.errors.
JobMissingError
(fmt, *args, **kwargs)¶
-
exception
cwt.errors.
MissingRequiredKeyError
(key)¶
-
exception
cwt.errors.
WPSAuthError
(fmt, *args, **kwargs)¶
-
exception
cwt.errors.
WPSClientError
(fmt, *args, **kwargs)¶
-
exception
cwt.errors.
WPSServerError
(fmt, *args, **kwargs)¶
-
exception
cwt.errors.
WPSTimeoutError
(elapsed)¶
cwt.process¶
|
A WPS Process |
Process Module.
-
class
cwt.process.
Process
(**kwargs)¶ A WPS Process
Wraps a WPS Process.
- Parameters
process – A DescribeProcessResponse object.
name – A string name for the process to be used as the input of another process.
-
add_inputs
(*args)¶ Set the inputs of the Process.
- Parameters
args – A list of Process/Variable objects.
-
add_parameters
(*args, **kwargs)¶ Add a parameter.
kwargs can contain two formats.
k=v where v is a NamedParameter
- Parameters
args – A list of NamedParameter objects.
kwargs – A dict of NamedParameter objects or k=v where k is the name and v is string.
-
collect_input_processes
()¶ Aggregates the process trees inputs.
A DFS to collect the trees inputs into two lists, Operations and Variables.
- Returns
A two lists, one of Processes and the other of Variables.
-
classmethod
from_dict
(data)¶ Attempts to load a process from a dict.
-
get_parameter
(name, required=False)¶ Retrieves a parameter
- Parameters
name – A string name of the parameter.
required – A boolean flag denoting whether the parameter is required.
- Returns
A NamedParameter object.
- Raises
Exception – The parameter is required and not present.
-
property
output
¶ Return the output of the process if done.
-
parameterize
()¶ Create a dictionary representation of the Process.
-
property
processing
¶ Checks if the process is still working.
This will update the wrapper with the latest status and return True if the process is waiting or running.
- Returns
A boolean denoting whether the process is still working.
-
to_dict
()¶ Returns a dictionary representation.
cwt.variable¶
|
Variable. |
Variable module.
-
class
cwt.variable.
Variable
(uri, var_name, **kwargs)¶ Variable.
Describes a variable to be used by an Operation.
>>> tas = Variable('http://thredds/tas.nc', 'tas', name='tas')
-
uri
¶ A String URI for the file containing the variable data.
-
var_name
¶ A String name of the variable.
-
domains
¶ List of Domain objects to constrain the variable data.
-
mime_type
¶ A String name of the URI mime-type.
-
name
¶ Custom name of the Variable.
-
classmethod
from_dict
(data)¶ Create variable from dict representation.
-
parameterize
()¶ Parameterize variable for GET request.
-
resolve_domains
(domains)¶ Resolves the domain identifiers to objects.
-
cwt.llnl_client¶
|
LLNLClient. |
LLNL KeyCloak authenticator. |
|
|
Represents a job. |
|
Represents a list of jobs. |
-
class
cwt.llnl_client.
JobListWrapper
(url, data, headers=None)¶ Represents a list of jobs.
-
property
current
¶ Returns current page.
-
next
()¶ Loads the next page of results
-
previous
()¶ Returns the previous page of results
-
property
-
class
cwt.llnl_client.
JobWrapper
(data, headers=None)¶ Represents a job.
-
class
cwt.llnl_client.
LLNLClient
(*args, **kwargs)¶ LLNLClient.
This client is a subclass of WPSClient providing methods specific to the LLNL WPS implementation.
-
jobs
(limit=10)¶ Retrieves listing of jobs.
-
-
class
cwt.llnl_client.
LLNLKeyCloakAuthenticator
(base_url, keycloak_url, realm, *args, **kwargs)¶ LLNL KeyCloak authenticator.