Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

DISCLAIMER:

This project is ALPHA and will be Experimental for the forseable time. Interfaces and functionality are likely to change. DO NOT use this software in any project/software that is operational.

cads-toolbox

CADS Toolbox library provides an entry point to the CADS data and software

Quick Start

import the package

>>> import cads_toolbox
>>> cads_toolbox.config.USE_CACHE = True  # opt-in to use the cache globally

Request some data and download to a local location

>>> request = [
...    "reanalysis-era5-single-levels",
...    {
...        'variable': '2m_temperature',
...        'product_type': 'reanalysis',
...        'year': '2017',
...        'month': '01',
...        'day': '01',
...        'time': '12:00',
...    }
... ]
>>> remote = cads_toolbox.catalogue.retrieve(*request)
>>> remote.download() # Uses filename on server for downloaded result
'...'
>>> remote.download(target='./test.grib') # Saves result in ./test.ext
'./test.grib'

Request some data and explore polymorphism and caching

>>> remote = cads_toolbox.catalogue.retrieve(*request)
>>> dataset = remote.to_xarray() # Involves download to your local cache disk (cacholote) and harmonisation of data coordinates and unit names (cgul)
>>> dataset
<xarray.Dataset>
Dimensions:  ...
>>> dataframe = remote.to_pandas() # Uses cached interim result from to_xarray so re-download is not required.

Request some data, open as an xarray dataset and plot using xarray methods

>>> remote = cads_toolbox.catalogue.retrieve(*request)
>>> dataset = remote.to_xarray()
>>> dataset
<xarray.Dataset>
Dimensions:  ...
>>> dataarray = dataset.to_array()  # Use xarray methods to manipulate the object
>>> dataarray
<xarray.DataArray ...
>>> dataarray.isel(time=0).plot()
<matplotlib.collections.QuadMesh object ...

NOT YET IMPLEMENTED: Use the CADS toolbox service to execute large compute jobs on the CADS infrastructure

>>> remote = cads_toolbox.catalogue.retrieve(*request)  # doctest: +SKIP
>>> climatology = cads_toolbox.climatology(remote, **kwargs)  # doctest: +SKIP
>>> climatology_ds = climatology.to_xarray()  # doctest: +SKIP
>>> # OR downloaded directly:
>>> climatology.download("./my_climatology.nc")  # doctest: +SKIP
'./my_climatology.nc'  # doctest: +SKIP

Workflow for developers/contributors

For best experience create a new conda environment (e.g. DEVELOP) with Python 3.10:

conda create -n DEVELOP -c conda-forge python=3.10
conda activate DEVELOP

Before pushing to GitHub, run the following commands:

  1. Update conda environment: make conda-env-update
  2. Install this package: pip install -e .
  3. Sync with the latest template (optional): make template-update
  4. Run quality assurance checks: make qa
  5. Run tests: make unit-tests
  6. Run the static type checker: make type-check
  7. Build the documentation (see Sphinx tutorial): make docs-build

License

Copyright 2022, European Union.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Release files for cads-toolbox 0.0.2b0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cads-toolbox 0.0.2b0
File Size Uploaded
cads-toolbox-0.0.2b0.tar.gz 162.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cads-toolbox 0.0.2b0
File Interpreter ABI Platform
cads_toolbox-0.0.2b0-py3-none-any.whl Python 3 none any Details

Total release size: 174.0 kB

Release files / cads-toolbox-0.0.2b0.tar.gz

Download URL cads-toolbox-0.0.2b0.tar.gz
Size 162.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9b9ad782028b67406d3ff514afa75b53b6167495d7108188bad7e0b9d20988b6
BLAKE2b-256 checksum
How to use checksums
a9d8b1e1981525eb26c6c24c5097edc5c6c3e50bc257c002982ff04f8d7bda56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / cads_toolbox-0.0.2b0-py3-none-any.whl

Download URL cads_toolbox-0.0.2b0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82c1f7b1ba11ae0f5556a86baaf43b2255cfa8052ba13370997a8dfbbd026a8d
BLAKE2b-256 checksum
How to use checksums
0cfc65c2c8e61f02df7117591dc4b3fedd482b9d4c873d42e58384c709829af1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.0.2b0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page