Skip to content
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
19 changes: 13 additions & 6 deletions docs/examples/files.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@
"tags": []
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/cgr/git/earthkit-data/src/earthkit/data/readers/netcdf/fieldlist.py:318: FutureWarning: In a future version of xarray decode_timedelta will default to False rather than None. To silence this warning, set decode_timedelta to True, False, or a 'CFTimedeltaCoder' instance.\n",
" return xr.open_dataset(self.path_or_url)\n"
]
},
{
"data": {
"text/html": [
Expand Down Expand Up @@ -508,10 +516,9 @@
}
],
"source": [
"\n",
"fs = ekd.from_source(\"file-pattern\", \"./test{id}.grib\",\n",
"ds = ekd.from_source(\"file-pattern\", \"./test{id}.grib\",\n",
" {\"id\": [4, 6]})\n",
"fs.ls()"
"ds.ls()"
]
},
{
Expand All @@ -531,9 +538,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "dev_ecc",
"display_name": "dev",
"language": "python",
"name": "dev_ecc"
"name": "dev"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -545,7 +552,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.11.12"
}
},
"nbformat": 4,
Expand Down
9 changes: 9 additions & 0 deletions docs/release_notes/version_0.14_updates.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Version 0.14 Updates
/////////////////////////

Version 0.14.2
===============

Fixes
+++++++++++++++++

- Fixed issue when the :ref:`data-sources-file-pattern` source did not return the right data object when the ``hive_partitioning`` option was set to ``False`` (:pr:`697`).
- Fixed issue when disabling the ``add_earthkit_attrs`` option in :py:meth:`~data.readers.grib.index.GribFieldList.to_xarray` caused a crash (:pr:`696`).


Version 0.14.1
===============
Expand Down
2 changes: 1 addition & 1 deletion src/earthkit/data/sources/file_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def mutate(self) -> Union["HiveFilePattern", "FilePattern"]:
if self.hive_partitioning:
return HiveFilePattern(self.pattern, self.params)
else:
return self
return super().mutate()


source = FilePattern
21 changes: 21 additions & 0 deletions tests/sources/test_file_pattern.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
#


from earthkit.data import from_source
from earthkit.data.testing import earthkit_examples_file


def test_file_pattern_source_grib():
ds = from_source("file-pattern", earthkit_examples_file("test{id}.grib"), {"id": [4, 6]})

assert len(ds) == 10
assert ds.metadata("param") == ["t", "z", "t", "z", "t", "u", "v", "t", "u", "v"]
Loading