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

Issue with some zipped vector data #607

Open
malmans2 opened this issue Feb 6, 2025 · 3 comments
Open

Issue with some zipped vector data #607

malmans2 opened this issue Feb 6, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@malmans2
Copy link
Contributor

malmans2 commented Feb 6, 2025

What happened?

We are having issues opening some zipped vector data.
In the snippet below, earthkit.data works fine with version="rgi_6_0", but it raises an error with version="rgi_7_0".

What are the steps to reproduce the bug?

import earthkit.data

dataset = "insitu-glaciers-extent"
request = {
    "variable": "glacier_area",
    "product_type": "vector",
}

for version in ("rgi_6_0", "rgi_7_0"):
    ds = earthkit.data.from_source("cds", dataset, request | {"version": version})
    try:
        df = ds.to_pandas()
    except Exception as exc:
        print(f"{version = }: {exc!s}")
        raise
    else:
        print(f"{version = }: OK!")

Version

0.12.1

Platform (OS and architecture)

Darwin MacBook-Pro-di-Bopen.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:24 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6030 arm64

Relevant log output

Unknown file type, no reader available. path=/var/folders/z4/9f32__x92kl340wxp0m4hfym0000gp/T/tmp4_wsms_8/cds-023bde4eed526ccb72379966cbf08d5cfebea278f82f2143efc49ec801b34338.d/rgi2000_v70_vector.shp magic=b"\x00\x00'\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$\xceo\xa4\xe8\x03\x00\x00\x0f\x00\x00\x00#h\xcc$\xea}f\xc0;\x1c]\xa5\xbb\x93S\xc0\x96A\xb5\xc1\txf@\x96\xcc\xb1\xbc" content_type=None
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[1], line 12
     10 ds = earthkit.data.from_source("cds", dataset, request | {"version": version})
     11 try:
---> 12     df = ds.to_pandas()
     13 except Exception as exc:
     14     print(f"{version = }: {exc!s}")

File ~/miniforge3/envs/earthkit-data/lib/python3.11/site-packages/earthkit/data/core/__init__.py:50, in Base.to_pandas(self, **kwargs)
     47 @abstractmethod
     48 def to_pandas(self, **kwargs):
     49     """Converts into a pandas dataframe"""
---> 50     self._not_implemented()

File ~/miniforge3/envs/earthkit-data/lib/python3.11/site-packages/earthkit/data/core/__init__.py:155, in Base._not_implemented(self)
    153 if hasattr(self, "path"):
    154     extra = f" on {self.path}"
--> 155 raise NotImplementedError(f"{module}.{name}.{func}(){extra}")

NotImplementedError: earthkit.data.sources.empty.EmptySource.to_pandas()

Accompanying data

No response

Organisation

B-Open/EQC

@sandorkertesz
Copy link
Collaborator

@malmans2, thank you for reporting this issue. When I try to run it with:

earthkit-data develop
cdsapi 0.7.4

I get the following error for both versions:

HTTPError: 400 Client Error: Bad Request for url: https://cds.climate.copernicus.eu/api/retrieve/v1/processes/insitu-glaciers-extent/execution
invalid request
Request has not produced a valid combination of values, please check your selection.
{'variable': 'glacier_area', 'product_type': 'vector', 'version': 'r'}

@malmans2
Copy link
Contributor Author

Are you sure you are running the exact same snippet I sent you?
Looks like your version is incorrect: 'version': 'r'. It should be either "rgi_6_0" or "rgi_7_0".

Maybe you have a bug in your code and you are iterating over a string rather than an iterable of strings?

@sandorkertesz
Copy link
Collaborator

I am sorry, you were right I used a wrong request. Now I am able to reproduce the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants