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

Implement xarray fieldlist #165

Merged
merged 7 commits into from
Aug 31, 2023
Merged

Implement xarray fieldlist #165

merged 7 commits into from
Aug 31, 2023

Conversation

sandorkertesz
Copy link
Collaborator

@sandorkertesz sandorkertesz commented Aug 29, 2023

Fixes to #158.

Implements xarray fieldlists. Example:

>>> import earthkit.data
>>> import xarray as xr
>>> ds = earthkit.data.from_object(xr.open_dataset("docs/examples/tuv_pl.nc"))
>>> ds
<earthkit.data.readers.netcdf.XArrayFieldList object at 0x16059c490>
>>> ds.ls()
   variable  level                time    units
0         t   1000 2018-08-01 12:00:00        K
1         t    850 2018-08-01 12:00:00        K
2         t    700 2018-08-01 12:00:00        K
3         t    500 2018-08-01 12:00:00        K
4         t    400 2018-08-01 12:00:00        K
5         t    300 2018-08-01 12:00:00        K
6         u   1000 2018-08-01 12:00:00  m s**-1
7         u    850 2018-08-01 12:00:00  m s**-1
8         u    700 2018-08-01 12:00:00  m s**-1
9         u    500 2018-08-01 12:00:00  m s**-1
10        u    400 2018-08-01 12:00:00  m s**-1
11        u    300 2018-08-01 12:00:00  m s**-1
12        v   1000 2018-08-01 12:00:00  m s**-1
13        v    850 2018-08-01 12:00:00  m s**-1
14        v    700 2018-08-01 12:00:00  m s**-1
15        v    500 2018-08-01 12:00:00  m s**-1
16        v    400 2018-08-01 12:00:00  m s**-1
17        v    300 2018-08-01 12:00:00  m s**-1
>>> ds[0]
XArrayField(t,level=1000,time=2018-08-01 12:00:00)
>>> ds[0].metadata("level")
1000

@sandorkertesz sandorkertesz changed the title WIP: implement xarray fieldlist Implement xarray fieldlist Aug 31, 2023
@sandorkertesz sandorkertesz merged commit fcb3aa3 into develop Aug 31, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants