-
Notifications
You must be signed in to change notification settings - Fork 236
Add extension to ConservativeRegridding.jl #4396
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
base: main
Are you sure you want to change the base?
Conversation
This depends on JuliaGeo/ConservativeRegridding.jl#7 |
src_cells = compute_cell_matrix(src_field) | ||
dst_cells = compute_cell_matrix(dst_field) | ||
|
||
src_polygons = GI.Polygon.(GI.LinearRing.(eachcol(src_cells))) .|> GO.fix | ||
dst_polygons = GI.Polygon.(GI.LinearRing.(eachcol(dst_cells))) .|> GO.fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should only be necessary to define a new method for ConservativeRegridding.get_vertices
I think!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But cell_matrix
is a matrix, so you don't have to do anything!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting! I think we may want to exert some control here but not sure. For example, we probably want to interpret user input and throw some specific errors. We also want to support regridding in vertical slices and whatnot. So I believe we will want to extend regrid!
for Field? Let's see though.
end | ||
|
||
ConservativeRegridding.regrid!(dst_field::Field, regridder::ConservativeRegridding.regridder, src_field::AbstractField) = | ||
regrid!(vec(interior(dst_field)), regridder, vec(interior(src_field))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this wouldn't work for the 3D cases right? In that case you only want to unravel the horizontal dimensions into a vector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, but I think it will be easy to support such a thing in this PR by making a stack of vec(interior(field, :, :, k))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a quick dispatch for this case
This PR adds an extension to ConservativeRegridding which ultimately should allow us to "regrid" fields conservatively between grids with different resolutions or alignments. "Conservative" means that regridding conserves the mean value of the field. This should be useful for nesting as well as coupling.