Skip to content

Commit

Permalink
Version and top level folder (#1036)
Browse files Browse the repository at this point in the history
* Make 'datacube-ows --version' work.

* Autowrap top level in single folder if necessary.

* Document top-level folder autowrapping behaviour.

* Update integration test translation files.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Pass auth token to codecov GHA.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

(cherry picked from commit d71b0ef)
  • Loading branch information
SpacemanPaul committed Jul 30, 2024
1 parent 024b951 commit 33d634b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
9 changes: 7 additions & 2 deletions datacube_ows/ows_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,13 +1513,18 @@ def parse_layers(self, cfg: list[CFG_DICT]):
self.declare_unready("native_product_index")
self.root_layer_folder = OWSFolder(cast(CFG_DICT, {
"title": "Root Folder (hidden)",
"label": "ows_root_hidden",
"abstract": self.abstract,
"label": "ows_root",
"layers": cfg
}), global_cfg=self, parent_layer=None)

@property
def layers(self) -> list[OWSLayer]:
return self.root_layer_folder.child_layers
# Multiple top-level are not consistent with a strict reading of the OWS standard.
# If we have multiple top-level folders, wrap them in an auto-generated top-level folder.
if len(self.root_layer_folder.child_layers) == 1:
return self.root_layer_folder.child_layers
return [self.root_layer_folder]

def alias_bboxes(self, bboxes: CFG_DICT) -> CFG_DICT:
out: CFG_DICT = {}
Expand Down
7 changes: 7 additions & 0 deletions datacube_ows/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@
# The location of the datcube config file.
os.environ.setdefault("DATACUBE_CONFIG_PATH", "/opt/odc/.datacube.conf.local")

from datacube_ows import __version__

from datacube_ows.ogc import app # isort:skip

application = app


def main():
if "--version" in sys.argv:
print("Open Data Cube Open Web Services (datacube-ows) version",
__version__
)
exit(0)
app.run()


Expand Down
9 changes: 9 additions & 0 deletions docs/cfg_layers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ at least one named layer (defined below).

The "layers" section is a list of Layer configurations.

> Note: Although many WMS clients support multiple
> top-level layers, a strict reading of the WMS standard requires
> only one. Some WMS clients do not recognise all top level
> layers if more than one is defined.
>
> Therefore, in the interests of WMS standards compliance, if you define multiple top
> level layers, they will be automatically wrapped in a single top-level folder
> using the global metadata.

A layer may be either:

* A `named layer <#named-layers>`_ which represents a queryable
Expand Down

0 comments on commit 33d634b

Please sign in to comment.