Skip to content

Commit 55297c3

Browse files
committed
Merge branch 'main' of github.com:xcube-dev/xcube-cds into main
2 parents aa20665 + 580e3df commit 55297c3

File tree

15 files changed

+751
-211
lines changed

15 files changed

+751
-211
lines changed

README.md

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
An [xcube plugin](https://xcube.readthedocs.io/en/latest/plugins.html)
66
which can generate data cubes from the
7-
[Copernicus Climate Data Store (CDS) API](https://cds.climate.copernicus.eu/api-how-to).
7+
[Copernicus Climate Data Store (CDS) API](https://cds-beta.climate.copernicus.eu/how-to-api).
88

99
## Description
1010

@@ -14,76 +14,61 @@ CDS.
1414

1515
Currently supported datasets:
1616

17-
- [ERA5 hourly data on single levels from 1979 to present](https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels)
18-
- [ERA5-Land hourly data from 1981 to present](https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-land)
19-
- [ERA5 monthly averaged data on single levels from 1979 to present](https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels-monthly-means?tab=overview)
20-
- [ERA5-Land monthly averaged data from 1981 to present](https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-land-monthly-means)
21-
- [Soil moisture gridded data from 1978 to present](https://cds.climate.copernicus.eu/cdsapp#!/dataset/satellite-soil-moisture)
22-
- [Sea ice thickness gridded data from 2002 to present](https://cds.climate.copernicus.eu/cdsapp#!/dataset/satellite-sea-ice-thickness)
17+
- [ERA5 hourly data on single levels from 1940 to present](https://cds-beta.climate.copernicus.eu/datasets/reanalysis-era5-single-levels?tab=overview)
18+
- [ERA5-Land hourly data from 1950 to present](https://cds-beta.climate.copernicus.eu/datasets/reanalysis-era5-land?tab=overview)
19+
- [ERA5 monthly averaged data on single levels from 1940 to present](https://cds-beta.climate.copernicus.eu/datasets/reanalysis-era5-single-levels-monthly-means?tab=overview)
20+
- [ERA5-Land monthly averaged data from 1950 to present](https://cds-beta.climate.copernicus.eu/datasets/reanalysis-era5-land-monthly-means?tab=overview)
21+
- [Soil moisture gridded data from 1978 to present](https://cds-beta.climate.copernicus.eu/datasets/satellite-soil-moisture?tab=overview)
22+
- [Sea ice thickness gridded data from 2002 to present](https://cds-beta.climate.copernicus.eu/datasets/satellite-sea-ice-thickness?tab=overview)
2323

2424
## Setup
2525

2626
### Configuring access to the CDS API
2727

2828
In order to use the CDS API via the xcube_cds plugin, you need to obtain a
29-
CDS user ID (UID) and API key and write them to a configuration file.
29+
Personal Access Token and write it to a configuration file.
3030
Additionally, you need to use the CDS website to agree in advance to the terms
3131
of use for any datasets you want to acccess.
3232

33-
#### Obtain a CDS API key
33+
#### Obtain a CDS Personal Access Token
3434

35-
You can obtain the UID and API key as follows:
35+
You can obtain a CDS Personal Access Token as follows:
3636

3737
1. Create a user account on the
38-
[CDS Website](https://cds.climate.copernicus.eu/user/register).
39-
2. Log in to the website with your user name and password.
40-
3. Navigate to your [user page](https://cds.climate.copernicus.eu/user/)
41-
on the website. Your API key is shown at the bottom of the page.
38+
[CDS Website](https://cds-beta.climate.copernicus.eu/).
39+
2. Log in to the website with your username and password.
40+
3. Navigate to your [user page](https://cds-beta.climate.copernicus.eu/profile),
41+
where you can find your Personal Access Token.
4242

4343
#### Configure CDS API access
4444

45-
Your CDS API key must be made available to the CDS API library. You can do
46-
this by creating a file named `.cdsapirc` in your home directory, with the
47-
following format:
45+
Your CDS Personal Access Token must be made available to the CDS API library.
46+
You can do this by creating a file named `.cdsapirc` in your home directory,
47+
with the following format:
4848

4949
```
50-
url: https://cds.climate.copernicus.eu/api/v2
51-
key: <UID>:<API-KEY>
50+
url: https://cds-beta.climate.copernicus.eu/api
51+
key: <PERSONAL-ACCESS-TOKEN>
5252
```
5353

54-
Replace `<UID>` with your UID and `<API-KEY>` with your API key, as obtained
55-
from the CDS website.
56-
57-
You can specify an alternative location for the CDS API configuration file
58-
using the `CDSAPI_RC` environment variable, or provide the URL and key
59-
without a configuration file by setting the `CDSAPI_URL` and `CDSAPI_KEY`
60-
environment variables. You can also pass the URL and key directly to the
61-
`CDSDataOpener` and `CDSDataStore` constructors using the named parameters
62-
`cds_api_url` and `cds_api_key`.
63-
64-
> :warning: Note that the `key` value must contain the UID *and* the API key,
65-
> separated by a colon. If you get the error
66-
> [‘TypeError: 'tuple' object is not callable in python cdsapi’](https://stackoverflow.com/q/64422955/6947739),
67-
> check that the `key` value follows this format correctly.
54+
Replace `<PERSONAL-ACCESS-TOKEN>` with your Personal Access Token.
6855

6956
#### Agree to the terms of use for the datasets you require
7057

7158
The datasets available through CDS have associated terms of use. Before
7259
accessing a dataset via the API, you must agree to its terms of use, which
7360
can only be done via the CDS website, as follows:
7461

75-
1. [Log in](https://cds.climate.copernicus.eu/user/login) to the CDS website,
76-
and use the
77-
[search page](https://cds.climate.copernicus.eu/cdsapp#!/search?type=dataset)
78-
to find the dataset you require.
79-
2. On the dataset's web page, select the ‘Download data’ tab.
62+
1. [Log in](https://cds-beta.climate.copernicus.eu) to the CDS website,
63+
and go to 'Datasets' to find the dataset you require.
64+
2. On the dataset's web page, select the ‘Download’ tab.
8065
3. Scroll to the bottom of the page, and you will see a section titled
8166
‘Terms of use’, which will contain either an ‘Accept terms’ button to
8267
allow you to accept the terms, or a confirmation that you have already
8368
accepted the terms.
8469

8570
Once you have accepted the terms on the website, the dataset will also be
86-
made available to you (using the same user credentials) through the API.
71+
made available to you through the API.
8772

8873
### Installing the xcube-cds plugin
8974

environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ channels:
33
- conda-forge
44
- defaults
55
dependencies:
6-
- cdsapi >=0.5.1
6+
- cdsapi >=0.7.2
77
- jsonschema >=3.2.0
88
- numpy >=1.17
9+
- pandas
910
- python-dateutil >=2.8.1
1011
- xarray >=0.18.2
1112
- xcube >=0.9.0

examples/notebooks/Ex0-CDS-store-setup.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
{
118118
"data": {
119119
"text/plain": [
120-
"<xcube_cds.store.CDSDataStore at 0x7fd42095e610>"
120+
"<xcube_cds.store.CDSDataStore at 0x733c607a4890>"
121121
]
122122
},
123123
"execution_count": 4,
@@ -155,8 +155,8 @@
155155
" 'reanalysis-era5-single-levels:reanalysis',\n",
156156
" 'reanalysis-era5-single-levels-monthly-means:monthly_averaged_ensemble_members',\n",
157157
" 'reanalysis-era5-single-levels-monthly-means:monthly_averaged_reanalysis',\n",
158-
" 'reanalysis-era5-land',\n",
159158
" 'reanalysis-era5-land-monthly-means:monthly_averaged_reanalysis',\n",
159+
" 'reanalysis-era5-land',\n",
160160
" 'satellite-soil-moisture:saturation:daily',\n",
161161
" 'satellite-soil-moisture:saturation:10-day',\n",
162162
" 'satellite-soil-moisture:saturation:monthly',\n",
@@ -193,7 +193,7 @@
193193
"name": "python",
194194
"nbconvert_exporter": "python",
195195
"pygments_lexer": "ipython3",
196-
"version": "3.11.6"
196+
"version": "3.12.5"
197197
}
198198
},
199199
"nbformat": 4,

0 commit comments

Comments
 (0)