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

Define array2field and field2array #1768

Merged
merged 2 commits into from
May 31, 2024
Merged

Define array2field and field2array #1768

merged 2 commits into from
May 31, 2024

Conversation

charleskawczynski
Copy link
Member

This PR moves some of the array2field and field2array methods into ClimaCore (from ClimaAtmos). I also added some simple tests.

@charleskawczynski charleskawczynski merged commit 673cfc3 into main May 31, 2024
11 of 13 checks passed
@charleskawczynski charleskawczynski deleted the ck/array2field branch May 31, 2024 20:25
Copy link
Member

@Sbozzolo Sbozzolo left a comment

Choose a reason for hiding this comment

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

Thanks, I think there's a couple of functions that are not tested and two docstrings that are swapped, but everything else looks good to me. The NEWS.md file should be updated too.

src/Fields/Fields.jl Show resolved Hide resolved
src/DataLayouts/DataLayouts.jl Show resolved Hide resolved
Comment on lines +623 to +627
if sizeof(eltype(field)) != sizeof(eltype(parent(field)))
f_axis_size = sizeof(eltype(parent(field))) ÷ sizeof(eltype(field))
error("unable to use field2array because each Field element is \
represented by $f_axis_size array elements (must be 1)")
end
Copy link
Member

Choose a reason for hiding this comment

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

Would it be easy to add a test for this error?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but I ran out of time this evening.

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.

None yet

2 participants