Open gritk opened 4 months ago
Thank you for reporting this issue. Please can you provide me with the earthkit-data and cdsapi versions you are using?
In my environment the actual cds retrieval works, however from_source
crashes at a later stage when tries to parse the NetCDF file that the zip file contains (see issue https://github.com/ecmwf/earthkit-data/issues/337).
However, even if it is fixed
lc_data.save(f"{LOCAL_DATA_DIR}/lc_2022.zip")
would not work properly because it would only create a NetCDF file called "lc_2022.zip". This is because lc_data
represents a NetCDF file and is decoupled from the zip that originally contained it.
Unfortunately, there is no way in earthkit-data at the moment to retrieve data into a user specified file target without parsing/interpreting the downloaded file(s). So it cannot be used as a simple file retriever! (See issue: https://github.com/ecmwf/earthkit-data/issues/338)
So there are a couple of issues here, which we need to sort out before your use-case could work. I will let you know when these features will be available.
Thank you for the prompt reply!
earthkit-data version - '0.1.1.dev40+g1aaf922' cdsapi versions - 0.6.1
As you wrote, your retrieval works, what I need to change to download at least one file in original format.
lc_data = ek.data.from_source( "cds", 'satellite-land-cover', { 'year': '2022', 'version': 'v2.1.1', 'variable': 'all', } ) lc_data.save(f"{LOCAL_DATA_DIR}/")
Thanks!
1. I noticed that your download error might be related to your permissions to access the CDS:
Exception: the request you have submitted is not valid. Request too large. Requesting 372 items, limit is 10.
You can check it easily if you use the cdsapi
code I posted below. If it is producing the same error it is definitely not an issue on the earthkit side.
2.
I noticed your earthkit-data
version is very-very old. The latest one available is 0.5.6, I suggest you upgrade to this one. However, it is not yet able to download the zip file in the way you want to do in your code. For that purpose I recommend to use cdsapi
like this:
import cdsapi
cds = cdsapi.Client()
cds.retrieve(
'satellite-land-cover',
{
'year': '2022',
'version': 'v2.1.1',
'variable': 'all',
'format': 'zip',
}, 'download.zip')
Thank you very much - now it works!
What happened?
The download of Land Cover data from CDS is probably not possible. This is needed for the development of tutorials and use cases foreseen in the C3S-LOT5 contract.
What are the steps to reproduce the bug?
If you are using the pre-downloaded data then please set DOWNLOAD_FROM_CDS to False and set the LOCAL_DATA_DIR to where you stored the data. DOWNLOAD_FROM_CDS = True LOCAL_DATA_DIR = "../data/"
if DOWNLOAD_FROM_CDS: lc_data = ek.data.from_source( "cds", 'satellite-land-cover', { 'year': '2022', 'version': 'v2.1.1', 'variable': 'all', 'format': 'zip', } ) lc_data.save(f"{LOCAL_DATA_DIR}/lc_2022.zip") else: lc_data = ek.data.from_source("file", f"{LOCAL_DATA_DIR}/lc_2022.zip")
Version
Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0] Type 'copyright', 'credits' or 'license' for more information IPython 8.15.0 -- An enhanced Interactive Python. Type '?' for help.
Platform (OS and architecture)
Windows 11 Pro
Relevant log output
Accompanying data
No response
Organisation
No response