Skip to content

Commit

Permalink
Merge pull request #631 from dcs4cop/forman-630-xcube_serve_to_ignore…
Browse files Browse the repository at this point in the history
…_datacube

xcube server to ignore datasets that cannot be opened
  • Loading branch information
forman authored Mar 1, 2022
2 parents 309b921 + 72bedb7 commit 684bdbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### Enhancements

* `xcube serve` used to shut down with an error message
if it encountered datasets it could not open. New behaviour
is to emit a warning and ignore such datasets. (#630)

* Introduced helper function `add_spatial_ref()`
of package `xcube.core.gridmapping.cfconv` that allows
adding a spatial coordinate reference system to an existing
Expand Down
7 changes: 6 additions & 1 deletion xcube/webapi/controllers/catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from xcube.constants import LOG
from xcube.core.geom import get_dataset_bounds
from xcube.core.normalize import DatasetIsNotACubeError
from xcube.core.store import DataStoreError
from xcube.core.timecoord import timestamp_to_iso_string
from xcube.util.assertions import assert_instance
from xcube.util.cmaps import get_cmaps
Expand Down Expand Up @@ -136,7 +137,11 @@ def get_dataset(ctx: ServiceContext,
required_scopes = ctx.get_required_dataset_scopes(dataset_config)
assert_scopes(required_scopes, granted_scopes or set())

ml_ds = ctx.get_ml_dataset(ds_id)
try:
ml_ds = ctx.get_ml_dataset(ds_id)
except (ValueError, DataStoreError) as e:
raise DatasetIsNotACubeError(f'could not open dataset: {e}') from e

grid_mapping = ml_ds.grid_mapping
if not grid_mapping.crs.is_geographic:
raise CubeIsNotDisplayable(f'CRS is not geographic:'
Expand Down

0 comments on commit 684bdbd

Please sign in to comment.