Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to new cds #62

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
2950aee
edit the doc due to new cds api
SarahAlidoost Oct 16, 2024
2c3dac3
add a version to cdsapi in pyproject
SarahAlidoost Oct 16, 2024
bba68a9
fix regrid.most_common due to changes in version xarray_regrid v0.4.0
SarahAlidoost Oct 16, 2024
b63505f
fix the use of regrid.most_common in land_cover.py due to changes in …
SarahAlidoost Oct 18, 2024
c17eb37
fix ruff error
SarahAlidoost Oct 18, 2024
1b99791
rename valid_time dim to time in ecmwf_dataset, see issue 59
SarahAlidoost Oct 18, 2024
692bae5
unify chunks before regrid
SarahAlidoost Oct 18, 2024
dcb9bb0
fix calculating freq in recipe
SarahAlidoost Oct 18, 2024
5ce238c
fix version syntax in fapar_lai
SarahAlidoost Oct 18, 2024
47b57ce
fix version in land_cover cds request
SarahAlidoost Oct 18, 2024
00aa356
fix version in test_fapar_lai
SarahAlidoost Oct 18, 2024
d9ab924
fix version in test_land_cover
SarahAlidoost Oct 18, 2024
4e6fe3e
fix version of land_cover request in test_cds_utils
SarahAlidoost Oct 18, 2024
ddb7c58
add spatial bounds for landcover, fix spatial bounds in target grid i…
SarahAlidoost Oct 21, 2024
868bc0e
increase timeout in cds request
SarahAlidoost Oct 21, 2024
1459245
fix test cds_utils
SarahAlidoost Oct 21, 2024
d0d57a7
fix mypy error
SarahAlidoost Oct 21, 2024
71c2224
remove parallel from lai to avoid segmentation fault error
SarahAlidoost Oct 21, 2024
75e5a67
update doc
SarahAlidoost Oct 21, 2024
5b82327
reduce time range in recipe of stemmus_scope
SarahAlidoost Oct 21, 2024
75df274
replace frequency H with h due to deprecation errors of pandas
SarahAlidoost Oct 21, 2024
f4a5882
add a few more checks in tests
SarahAlidoost Oct 21, 2024
540b9e7
fix linter error
SarahAlidoost Oct 21, 2024
3ae6603
fix ruff errors
SarahAlidoost Oct 21, 2024
5ba1f7f
fix a minor thing
SarahAlidoost Oct 21, 2024
42edfc3
add more tests for frequency in recipe
SarahAlidoost Oct 22, 2024
1eab581
remove unused import from test_recipe
SarahAlidoost Oct 22, 2024
49637d1
fix ruff format
SarahAlidoost Oct 22, 2024
c24bbf7
refactor get_url_size
SarahAlidoost Oct 22, 2024
0cab2df
Update docs/index.md
SarahAlidoost Oct 25, 2024
b3bdeb7
update test dataset, and related tests
SarahAlidoost Oct 30, 2024
56c5a5b
change freq M to ME in cds_utils
SarahAlidoost Oct 30, 2024
0f70d77
add acheck before ds coarsen in eth_canopy_height
SarahAlidoost Oct 30, 2024
8b6070f
fix tests init
SarahAlidoost Oct 30, 2024
09ddc53
use dask unique instead of numpy unique
SarahAlidoost Nov 15, 2024
d03b0f4
fix linter errors
SarahAlidoost Nov 15, 2024
ab1cbc3
fix ruff format errors
SarahAlidoost Nov 15, 2024
09d38f6
add parallel=True to FaparLAI
SarahAlidoost Nov 15, 2024
eca46d1
fix get unique values in land cover
SarahAlidoost Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,25 @@ The configuration file should contain the `working_directory`, for instance:
working_directory: /path_to_a_working_directory/ #for example: /home/bart/Zampy
```

If you need access to data on CDS or ADS server, you should add your CDS or ADS credentials to `zampy_config.yml`:
The old Climate Data Store (CDS) is shut down on 3 September 2024. For more
information see:
[the-new-climate-data-store-beta](https://forum.ecmwf.int/t/the-new-climate-data-store-beta-cds-beta-is-now-live/3315).
To use the new CDS/ADS, you need to have an ECMWF account, your existing CDS/ADS
credentials does not work.

If you need access to data on CDS or ADS server, you should add your CDS/ADS
credentials to `zampy_config.yml`. To find your key, go to [CDS how to
api](https://cds.climate.copernicus.eu/how-to-api), or [ADS how to
api](https://ads.atmosphere.copernicus.eu/how-to-api). You can skip the steps
related to `.cdsapirc` and simply add the key to `zampy_config.yml`:

```yaml
cdsapi:
url: # for example https://cds.climate.copernicus.eu/api/v2
key: # for example 12345:xhashd-232jcsha-dsaj429-cdjajd29319
url: # for example https://cds.climate.copernicus.eu/api
key: # for example xhashd-232jcsha-dsaj429-cdjajd29319
adsapi:
url: # for example https://ads.atmosphere.copernicus.eu/api/v2
key: # for example 12345:xhashd-232jcsha-dsaj429-cdjajd29319
url: # for example https://ads.atmosphere.copernicus.eu/api
key: # for example xhashd-232jcsha-dsaj429-cdjajd29319
```

## Instructions for CDS/ADS datasets
Expand All @@ -45,9 +55,6 @@ To download the following datasets, users need access to CDS/ADS via `cdsapi`/`a
- ADS
- CAMS EGG4 (e.g. co2)

To generate these API keys, you need to be a registered user on *CDS* via the [registration page](https://cds.climate.copernicus.eu/user/register?destination=%2F%23!%2Fhome), or on *ADS* via the [registration page](https://ads.atmosphere.copernicus.eu/user/register?destination=%2F%23!%2Fhome).

Before submitting any request with `zampy`, please put your `cdsapi`/`adsapi` credentials in `zampy_config.yml`. Here is a short [instruction](https://cds.climate.copernicus.eu/api-how-to) about how to find your CDS/ADS API key. You can skip the steps related to `.cdsapirc` and simply add the key to `zampy_config.yml`.

### Agree to the Terms of Use on CDS/ADS

Expand Down
7 changes: 6 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ download:
cams:
variables:
- co2_concentration

convert:
convention: ALMA
frequency: 1H # outputs at 1 hour frequency. Pandas-like freq-keyword.
Expand All @@ -67,6 +67,11 @@ When you have your reciped created and saved on your disk, you can execute your
zampy /path_to_recipe/sample_recipe.yml
```

>NOTE: You may recieve an error message from CDS/ADS if not all the required
>licences have been accepted. Follow the instructions in the error message to
>accept the licences and run the recipe again.
SarahAlidoost marked this conversation as resolved.
Show resolved Hide resolved


### Interact with `zampy` in notebooks

It is possible to use `zampy` directly in Python via its Python API. This is not recommended, as it is more difficult to reproduce the workflow if there is no recipe.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dependencies = [
"pint",
"cf_xarray", # required to auto-pint CF compliant datasets.
"pint-xarray",
"cdsapi",
"cdsapi>=0.7.2",
"xarray-regrid", # for regridding
]
dynamic = ["version"]
Expand Down
6 changes: 2 additions & 4 deletions src/zampy/datasets/land_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def load(
grid = xarray_regrid.create_regridding_dataset(
utils.make_grid(spatial_bounds, resolution)
)
ds = ds.regrid.most_common(grid, time_dim="time", max_mem=1e9)
ds = ds.regrid.most_common(grid)
SarahAlidoost marked this conversation as resolved.
Show resolved Hide resolved

return ds

Expand Down Expand Up @@ -225,9 +225,7 @@ def extract_netcdf_to_zampy(file: Path) -> xr.Dataset:

target_dataset = xarray_regrid.create_regridding_dataset(new_grid)

ds_regrid = ds.regrid.most_common(
target_dataset, time_dim="time", max_mem=1e9
)
ds_regrid = ds.regrid.most_common(target_dataset)

# rename variable to follow the zampy convention
variable_name = "land_cover"
Expand Down
Loading