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

Improve error message from Field.set_construct when domain axes do not exist #104

Closed
davidhassell opened this issue Jul 28, 2020 · 2 comments · Fixed by #105
Closed

Improve error message from Field.set_construct when domain axes do not exist #104

davidhassell opened this issue Jul 28, 2020 · 2 comments · Fixed by #105
Assignees
Labels
enhancement New feature or request

Comments

@davidhassell
Copy link
Collaborator

Improve error message from Field.set_construct when domain axes do not exist.
For example:

>>> z = cf.Field()
>>> nt = 450
>>> climdim = cf.DimensionCoordinate(data=cf.Data(numpy.arange(nt)))
>>> z.set_construct(climdim)
<snip>
ValueError: Can't insert  DimensionCoordinate: Ambiguous shape: (450,). Consider setting the 'axes' parameter.

It would be better in this case to indicate that a domain axis needs to be created first.

@davidhassell davidhassell added the enhancement New feature or request label Jul 28, 2020
@davidhassell davidhassell self-assigned this Jul 28, 2020
@davidhassell
Copy link
Collaborator Author

When fixed, the error message in this case would say

ValueError: Can't insert <CF DimensionCoordinate: (450) >: There is no domain axis construct with size 450.

@JonathanGregory - is that OK?

@JonathanGregory
Copy link

JonathanGregory commented Jul 28, 2020 via email

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

Successfully merging a pull request may close this issue.

2 participants