c4cds-wps¶
- c4cds-wps (the bird)
- c4cds-wps is a bird …
A WPS Compute Service for Climate Data Store
- Free software: Apache Software License 2.0
- Documentation: https://c4cds-wps.readthedocs.io.
Credits¶
This package was created with Cookiecutter and the bird-house/cookiecutter-birdhouse project template.
Installation¶
Install from Conda¶
Warning
TODO: Prepare Conda package.
Install from GitHub¶
Check out code from the c4cds-wps GitHub repo and start the installation:
$ git clone https://github.com/cp4cds/c4cds-wps.git
$ cd c4cds
$ conda env create -f environment.yml
$ source activate c4cds
$ python setup.py develop
… or do it the lazy way¶
The previous installation instructions assume you have Anaconda installed.
We provide also a Makefile
to run this installation without additional steps:
$ git clone https://github.com/cp4cds/c4cds-wps.git
$ cd c4cds
$ make clean # cleans up a previous Conda environment
$ make install # installs Conda if necessary and runs the above installation steps
Start c4cds-wps PyWPS service¶
After successful installation you can start the service using the c4cds
command-line.
$ c4cds --help # show help
$ c4cds start # start service with default configuration
OR
$ c4cds start --daemon # start service as daemon
loading configuration
forked process id: 42
The deployed WPS service is by default available on:
http://localhost:5000/wps?service=WPS&version=1.0.0&request=GetCapabilities.
Note
Remember the process ID (PID) so you can stop the service with kill PID
.
You can find which process uses a given port using the following command (here for port 5000):
$ netstat -nlp | grep :5000
Check the log files for errors:
$ tail -f pywps.log
… or do it the lazy way¶
You can also use the Makefile
to start and stop the service:
$ make start
$ make status
$ tail -f pywps.log
$ make stop
Run c4cds-wps as Docker container¶
You can also run c4cds-wps as a Docker container.
Warning
TODO: Describe Docker container support.
Use Ansible to deploy c4cds-wps on your System¶
Use the Ansible playbook for PyWPS to deploy c4cds-wps on your system.
Configuration¶
Command-line options¶
You can overwrite the default PyWPS configuration by using command-line options. See the c4cds-wps help which options are available:
$ c4cds start --help
--hostname HOSTNAME hostname in PyWPS configuration.
--port PORT port in PyWPS configuration.
Start service with different hostname and port:
$ c4cds start --hostname localhost --port 5001
Use a custom configuration file¶
You can overwrite the default PyWPS configuration by providing your own
PyWPS configuration file (just modifiy the options you want to change).
Use one of the existing sample-*.cfg
files as example and copy them to etc/custom.cfg
.
For example change the hostname (demo.org) and logging level:
$ cd c4cds
$ vim etc/custom.cfg
$ cat etc/custom.cfg
[server]
url = http://demo.org:5000/wps
outputurl = http://demo.org:5000/outputs
[logging]
level = DEBUG
Start the service with your custom configuration:
# start the service with this configuration
$ c4cds start -c etc/custom.cfg
Developer Guide¶
Building the docs¶
First install dependencies for the documentation:
$ make bootstrap_dev
$ make docs
Running tests¶
Run tests using pytest.
First activate the c4cds
Conda environment and install pytest
.
$ source activate c4cds
$ conda install pytest flake8 # if not already installed
Run quick tests (skip slow and online):
$ pytest -m 'not slow and not online'"
Run all tests:
$ pytest
Check pep8:
$ flake8
Run tests the lazy way¶
Do the same as above using the Makefile
.
$ make test
$ make testall
$ make pep8
Bump a new version¶
Make a new version of c4cds-wps in the following steps:
- Make sure everything is commit to GitHub.
- Update
CHANGES.rst
with the next version. - Dry Run:
bumpversion --dry-run --verbose --new-version 0.8.1 patch
- Do it:
bumpversion --new-version 0.8.1 patch
- … or:
bumpversion --new-version 0.9.0 minor
- Push it:
git push
- Push tag:
git push --tags
See the bumpversion documentation for details.
Processes¶
CMIP5 Regridder¶
-
class
c4cds.processes.wps_cmip5_regridder.
CMIP5Regridder
[source]¶ cmip5_regridder CMIP5 Regridder (v1.0)
CMIP5 Regridder using CDO.
Parameters: - model ({'HadGEM2-ES', 'IPSL-CM5A-MR', 'MPI-ESM-MR'}) – Choose a model like HadGEM2-ES.
- experiment ({'historical', 'rcp26'}) – Choose an experiment like historical.
- variable ({'pr', 'tas', 'tasmax', 'tasmin'}) – Choose a variable like tas.
Returns: - output (application/x-netcdf) – Regridded Dataset.
- ncdump (text/plain) – ncdump of regridded Dataset.
- preview (image/png) – Preview of subsetted Dataset.
References
CORDEX Subsetter¶
-
class
c4cds.processes.wps_cordex_subsetter.
CordexSubsetter
[source]¶ cordex_subsetter CORDEX Subsetter (v1.0)
CORDEX Subsetter using CDO.
Parameters: - country ({'Egypt', 'UK', 'France', 'Germany'}) – Choose a Country like UK.
- model ({'MOHC-HadRM3P'}) – Choose a model like MOHC-HadRM3P.
- experiment ({'evaluation'}) – Choose an experiment like evaluation.
- variable ({'tas', 'tasmax', 'tasmin'}) – Choose a variable like tas.
- year ({'1990', '2000', '2010'}) – File should match this year.
Returns: - output (application/x-netcdf) – Subsetted Dataset.
- ncdump (text/plain) – ncdump of subsetted Dataset.
- preview (image/png) – Preview of subsetted Dataset.
References