Skip to content

Commit 7d05c11

Browse files
authored
Merge pull request #1174 from xcube-dev/toniof-xxx-support_jpeg2000
Add support for JPEG 2000 to file system data stores
2 parents 0de66ae + 2432c15 commit 7d05c11

File tree

15 files changed

+704
-481
lines changed

15 files changed

+704
-481
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
`from xcube.core.store import get_filename_extensions`.
66
It allows for retrieving mappings of recognized filename extensions to
77
respective data openers and writers. (#726)
8+
* The file data stores (e.g., `store = new_data_store("file")`) now support
9+
reading JPEG2000 files as datasets or multi-level datasets from file
10+
systems. Openers and writers are available as `dataset:jpeg2000:<protocol>` or
11+
`mldataset:jpeg2000:<protocol>`, where protocol is the respective file system.
12+
These openers and writers are available to any file system data store,
13+
e.g., `"file"`, `"s3"`.
814

915
### Other changes
1016

docs/source/dataaccess.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ The following `storage_options` can be used for the `ftp` data store:
299299
* `password` - User's password, if using
300300

301301
All filesystem data stores can open datasets from various data formats.
302-
Datasets in Zarr, GeoTIFF / COG, or NetCDF format will be provided either by
303-
[xarray.Dataset] or xcube [MultiLevelDataset] instances.
302+
Datasets in Zarr, GeoTIFF / COG, JPEG 2000, or NetCDF format will be provided
303+
either by [xarray.Dataset] or xcube [MultiLevelDataset] instances.
304304
Datasets stored in GeoJSON or ESRI Shapefile will yield
305305
[geopandas.GeoDataFrame] instances.
306306

docs/source/mldatasets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ In xcube, multi-resolution datasets are represented by the abstract class
2525
`xcube.core.mldataset.MultiLevelDataset`. The xcube data store framework
2626
refers to this datatype using the alias `mldataset`. The corresponding
2727
default data format is the xcube _Levels_ format, named `levels`.
28-
xcube also supports the Cloud Optimized GeoTIFF (COG) format
28+
xcube also supports the Cloud Optimized GeoTIFF (COG) and the JPEG 2000 format
2929
for reading multi-resolution datasets.
3030

3131
The xcube Levels Format

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies:
2020
- geopandas >=0.8
2121
- jdcal >=1.4
2222
- jsonschema >=3.2
23+
- libgdal-jp2openjpeg
2324
- mashumaro
2425
- matplotlib-base >=3.8.3
2526
- netcdf4 >=1.5

examples/serve/demo/sample-sb.jp2

152 KB
Binary file not shown.

examples/serve/demo/sample.jp2

763 KB
Binary file not shown.

test/cli/test_io.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Permissions are hereby granted under the terms of the MIT License:
33
# https://opensource.org/licenses/MIT.
44

5+
import dask
56
import json
67
import os.path
78
from test.cli.helpers import CliTest
@@ -71,7 +72,9 @@ def test_data(self):
7172
" cube.nc <no title>\n"
7273
" sample-cog.tif <no title>\n"
7374
" sample-geotiff.tif <no title>\n"
74-
"6 data resources found.\n"
75+
" sample-sb.jp2 <no title>\n"
76+
" sample.jp2 <no title>\n"
77+
"8 data resources found.\n"
7578
),
7679
result.stdout,
7780
)
@@ -143,11 +146,14 @@ def setUpClass(cls) -> None:
143146
yaml.dump(cls.STORE_CONF, fp)
144147
with open("store-conf.json", "w") as fp:
145148
json.dump(cls.STORE_CONF, fp)
149+
cls._dask_scheduler = dask.config.get("scheduler", None)
150+
dask.config.set(scheduler="single-threaded")
146151

147152
@classmethod
148153
def tearDownClass(cls) -> None:
149154
rimraf("store-conf.json")
150155
rimraf("store-conf.yml")
156+
dask.config.set(scheduler=cls._dask_scheduler)
151157

152158
def tearDown(self) -> None:
153159
rimraf("store-dump.json")

test/core/store/fs/impl/test_geotiff.py

Lines changed: 0 additions & 203 deletions
This file was deleted.

0 commit comments

Comments
 (0)