Skip to content

Commit

Permalink
Set an upper limit on the number of visualizations to 50
Browse files Browse the repository at this point in the history
Clarify error about not referencing incomplete datasets in catalog.jsonnet

PiperOrigin-RevId: 581978130
  • Loading branch information
simonff authored and copybara-github committed Nov 13, 2023
1 parent 064289d commit 4c749d8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion checker/node/visualizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def run(cls, node: stac.Node) -> Iterator[stac.Issue]:
yield cls.new_issue(node, f'{VISUALIZATIONS} must have at least 1 entry')
return

if len(visualizations) > 4:
if len(visualizations) > 50:
yield cls.new_issue(
node, f'{VISUALIZATIONS} has too many entries: {len(visualizations)}')

Expand Down
5 changes: 3 additions & 2 deletions checker/node/visualizations_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ def test_visualizations_too_many(self):
'image_visualization': {},
'lookat': {'lat': 1, 'lon': 2, 'zoom': 3}}
self.assert_collection(
{'summaries': {'gee:visualizations': [vis, vis, vis, vis, vis]}},
'gee:visualizations has too many entries: 5')
{'summaries': {'gee:visualizations': [vis] * 51}},
'gee:visualizations has too many entries: 51',
)

def test_visualization_not_dict(self):
self.assert_collection(
Expand Down
6 changes: 4 additions & 2 deletions checker/tree/parent_child.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ def run(cls, nodes: list[stac.Node]) -> Iterator[stac.Issue]:
f'catalog_url != parent_url: {catalog_url} {a_parent_url}')
elif node.stac.get(GEE_SKIP_INDEXING):
message = (
f'Child link when {GEE_SKIP_INDEXING} is true: '
f'{catalog_url} {a_self_url}')
"Please don't reference in catalog.jsonnet datasets that have "
f'{GEE_SKIP_INDEXING} set to true: '
f'{catalog_url} {a_self_url}'
)
yield cls.new_issue(node, message)
else:
if (node.id != GEE_CATALOG and not node.stac.get(GEE_SKIP_INDEXING) and
Expand Down
4 changes: 3 additions & 1 deletion checker/tree/parent_child_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ def test_incorrectly_have_child_link_with_skip_indexing(self):

issues = list(Check.run(nodes))
message = (
'Child link when gee:skip_indexing is true: AAFC/catalog AAFC/AAFC_ACI')
"Please don't reference in catalog.jsonnet datasets that have "
'gee:skip_indexing set to true: AAFC/catalog AAFC/AAFC_ACI'
)
expect = [Check.new_issue(a_collection_node, message)]
self.assertEqual(expect, issues)

Expand Down

0 comments on commit 4c749d8

Please sign in to comment.