Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation fixes and schema cleanup #272

Merged
merged 7 commits into from
Sep 27, 2024

Conversation

scpmw
Copy link
Collaborator

@scpmw scpmw commented Sep 27, 2024

Fix a couple nice-to-haves in the schema documentation:

  • Remove useless dimension list with datasets
  • Remove "impossible" dimensionalities from data variables (like having "antenna_name" with UVW in VisibilityXds). Especially complain if all dimension options are impossible (caught a couple such instances!)
  • Use a more compact table layout
  • Literal lists are a bit refactored, use non-breaking space before "or" to make it look less awkward in corner cases
  • Remove the useless name for anonymous data array schemas

This would allow downstream packages to not only use the schema
checker, but also the documentation generation. It's not a
particularly large module, so no big harm?
This removes e.g. antenna_name from UVW in VisibilityXds, as this is a
dimensionality that would not be allowed in that context.

We especially complain when a data array has impossible
dimensionality, which automatically catches some inconsistencies in
the correlated data schemas.
Also add "data" to the data array one - you can literally get the data
by accessing that member of the DataArray, so it is likely
appropriate.
We are trying to format rather big tables, so all the margins add up
rather quickly.
They just look confusing in the documentation
@scpmw scpmw changed the title Documentation fixes and schema cleanup #262 Documentation fixes and schema cleanup Sep 27, 2024
Turned out to be a bigger refactoring than I had anticipated - but we
should generally try to not use nested parses too much here, and
instead directly generate the document AST.

This also changes the layout slightly - we generate "a,b,c or d"
lists, and use non-breaking spaces to make sure the "or d" bit stays
together.
@scpmw scpmw force-pushed the documentation-fixes-and-schema-cleanup branch from 5ec2625 to 9197852 Compare September 27, 2024 14:23
@scpmw scpmw mentioned this pull request Sep 27, 2024
4 tasks
@Jan-Willem Jan-Willem merged commit 3cc00a8 into main Sep 27, 2024
12 checks passed
@Jan-Willem Jan-Willem deleted the documentation-fixes-and-schema-cleanup branch September 27, 2024 14:53
@@ -1892,7 +1904,7 @@ class SpectrumXds:
"""

# --- Optional Coordinates ---
polarization_mixed: Optional[Coord[tuple[BaselineId, Polarization], str]] = None
polarization_mixed: Optional[Coord[tuple[AntennaName, Polarization], str]] = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


# Assume it's a literal of some kind - collect options
literals = format_literals(attr.typ)
print(literals)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this print is a leftover?

else:
line += nodes.Text(", ")
line += lit
print(line)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants