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

Refactor array fieldlists #471

Merged
merged 15 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
317 changes: 214 additions & 103 deletions docs/examples/grib_array_backends.ipynb

Large diffs are not rendered by default.

25 changes: 14 additions & 11 deletions docs/examples/numpy_fieldlist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"tags": []
},
"source": [
"In this notebook we will show how to do some computations with GRIB data and generate a :py:class:`~data.sources.numpy_list.ArrayFieldList` from the results.\n",
"In this notebook we will show how to do some computations with GRIB data and generate a array fieldlist from the results.\n",
"\n",
"First we :ref:`read <data-sources-file>` some GRIB data containing pressure level fields."
]
Expand Down Expand Up @@ -227,7 +227,7 @@
{
"data": {
"text/plain": [
"<earthkit.data.readers.grib.metadata.GribMetadata at 0x1379bfe20>"
"<earthkit.data.readers.grib.metadata.StandAloneGribMetadata at 0x1694997b0>"
]
},
"execution_count": 7,
Expand Down Expand Up @@ -280,7 +280,7 @@
"tags": []
},
"source": [
"A new FieldList (type of :py:class:`~data.sources.numpy_list.ArrayFieldList`) can be created from the resulting ndarray and the modified metadata. It behaves as if it were a :py:class:`~data.readers.grib.index.GribFieldList`."
"A new FieldList (type of :py:class:`~data.indexing.fieldlist.SimpleFieldList`) can be created from the resulting ndarray and the modified metadata. It will store a list of :py:class:`~data.sources.array_list.ArrayField` fields each containing a values array and a metadata object entirely in memory. This fieldlist behaves as if it were a :py:class:`~data.readers.grib.index.GribFieldList`."
]
},
{
Expand Down Expand Up @@ -373,7 +373,7 @@
{
"data": {
"text/plain": [
"ArrayField()"
"ArrayField(pt,850,20180801,1200,0,0)"
]
},
"execution_count": 10,
Expand Down Expand Up @@ -447,7 +447,7 @@
"tags": []
},
"source": [
"We can save the :py:class:`~data.sources.numpy_list.ArrayFieldList` into a GRIB file:"
"We can save our new fieldlist into a GRIB file:"
]
},
{
Expand Down Expand Up @@ -716,7 +716,7 @@
"tags": []
},
"source": [
"We create a :py:class:`~data.sources.numpy_list.ArrayFieldList` from the resulting ndarray and the modified metadata."
"We create an array fieldlist from the resulting ndarray and the modified metadata."
]
},
{
Expand Down Expand Up @@ -887,7 +887,7 @@
"tags": []
},
"source": [
"We can save the :py:class:`~data.sources.numpy_list.ArrayFieldList` into a GRIB file:"
"We can save the fieldlist into a GRIB file:"
]
},
{
Expand Down Expand Up @@ -1169,10 +1169,13 @@
"slideshow": {
"slide_type": ""
},
"tags": []
"tags": [],
"vscode": {
"languageId": "raw"
}
},
"source": [
"We can save the :py:class:`~data.sources.numpy_list.ArrayFieldList` into a GRIB file:"
"We can save the results into a GRIB file:"
]
},
{
Expand Down Expand Up @@ -1293,9 +1296,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "dev",
"display_name": "dev_ecc",
"language": "python",
"name": "dev"
"name": "dev_ecc"
},
"language_info": {
"codemirror_mode": {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dynamic = [
"version",
]
dependencies = [
"array-api-compat",
"cfgrib>=0.9.10.1",
"dask",
"earthkit-geo>=0.2",
Expand Down Expand Up @@ -68,7 +69,6 @@ optional-dependencies.cds = [
"cdsapi>=0.7.1",
]
optional-dependencies.ci = [
"array-api-compat",
"torch",
]
optional-dependencies.covjsonkit = [
Expand Down
4 changes: 4 additions & 0 deletions src/earthkit/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@
from .core.caching import CACHE as cache
from .core.fieldlist import FieldList
from .core.settings import SETTINGS as settings
from .indexing.fieldlist import SimpleFieldList
from .readers.grib.output import new_grib_output
from .sources import Source
from .sources import from_source
from .sources import from_source_lazily
from .sources.array_list import ArrayField
from .utils.examples import download_example_file
from .utils.examples import remote_example_file

__all__ = [
"ALL",
"ArrayField",
"cache",
"download_example_file",
"FieldList",
Expand All @@ -41,6 +44,7 @@
"new_grib_output",
"remote_example_file",
"settings",
"SimpleFieldList",
"Source",
"__version__",
]
Loading
Loading