Skip to content

Make nodes() return the correct indices when passed a view of a Field#4814

Merged
tomchor merged 26 commits intomainfrom
tc/sliced-nodes
Nov 18, 2025
Merged

Make nodes() return the correct indices when passed a view of a Field#4814
tomchor merged 26 commits intomainfrom
tc/sliced-nodes

Conversation

@tomchor
Copy link
Copy Markdown
Member

@tomchor tomchor commented Sep 25, 2025

Resolves #4729

In addition to improving the behavior of nodes(), this PR, together with #4730, makes it possible to write different slices of a Field (or several Fields) into one NetCDF file.

@glwagner
Copy link
Copy Markdown
Member

glwagner commented Oct 1, 2025

Should nodes return a KernelFunctionOperation? If it did, would this PR be easier?

@tomchor
Copy link
Copy Markdown
Member Author

tomchor commented Oct 6, 2025

Should nodes return a KernelFunctionOperation?

Not sure. I imagine this being more cumbersome for the end user, but possibly reducing code and makings things more flexible.

If it did, would this PR be easier?

A little, yes. But I don't think enough as to motivate this change by itself.

Comment thread src/Fields/field.jl Outdated
Comment thread src/Grids/latitude_longitude_grid.jl Outdated
@glwagner
Copy link
Copy Markdown
Member

glwagner commented Oct 6, 2025

After #4805, it will be pretty trivial to return KernelFunctionOperation for nodes. Do you want me to wait for this PR to do that, or should I do that before this PR so you don't have to worry about CPU vs GPU for nodes?

@glwagner
Copy link
Copy Markdown
Member

glwagner commented Oct 6, 2025

Basically if nodes return KernelFunctionOperation, then the way to get correct indices will be the same as building a Field and passing indices to the Field constructor. We won't need any "special" functionality for windowing the nodes, compared to windowing Field.

@tomchor
Copy link
Copy Markdown
Member Author

tomchor commented Oct 6, 2025

After #4805, it will be pretty trivial to return KernelFunctionOperation for nodes. Do you want me to wait for this PR to do that, or should I do that before this PR so you don't have to worry about CPU vs GPU for nodes?

You can go ahead and make nodes return KernelFunctionOperation first!

@tomchor tomchor merged commit c978abb into main Nov 18, 2025
72 checks passed
@tomchor tomchor deleted the tc/sliced-nodes branch November 18, 2025 03:07
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.

nodes() returns the full grid when given a smaller view of a Field

4 participants