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

Better validation for LatitudeLongitudeGrid + add test for sum(Azᶜᶜᵃ) ≈ 4πr² #3240

Merged
merged 4 commits into from
Aug 29, 2023

Conversation

navidcy
Copy link
Collaborator

@navidcy navidcy commented Aug 29, 2023

Closes #3241

@navidcy navidcy added testing 🧪 Tests get priority in case of emergency evacuation grids 🗺️ labels Aug 29, 2023
Copy link
Member

@glwagner glwagner left a comment

Choose a reason for hiding this comment

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

Nice!

Should we implement this test for OrthogonalSphericalShellGrid instead, considering we are going to deprecate LatitutdeLongitudeGrid?

@navidcy navidcy changed the title Add test for sum(Azᶜᶜᵃ) ≈ 4πr² for LatitudeLongitudeGrid Better validation for LatitudeLongitudeGrid + add test for sum(Azᶜᶜᵃ) ≈ 4πr² Aug 29, 2023
@navidcy
Copy link
Collaborator Author

navidcy commented Aug 29, 2023

Nice!

Should we implement this test for OrthogonalSphericalShellGrid instead, considering we are going to deprecate LatitutdeLongitudeGrid?

That's already implemented for OSSG + other similar tests.

Nx, Ny = 10, 8
grid = OrthogonalSphericalShellGrid(arch, FT, size=(Nx, Ny, 1); z, radius)
# the sum of area metrics Azᶜᶜᵃ is 1/6-th of the area of the sphere
@test sum(grid.Azᶜᶜᵃ) 4π * grid.radius^2 / 6
# the sum of the distance metrics Δxᶜᶜᵃ and Δyᶜᶜᵃ that correspond to great circles
# are 1/4-th of the circumference of the sphere's great circle
#
# (for odd number of grid points, the central grid points fall on great circles)
Nx, Ny = 11, 9
grid = OrthogonalSphericalShellGrid(arch, FT, size=(Nx, Ny, 1); z, radius)
@test sum(grid.Δxᶜᶜᵃ[:, (Ny+1)÷2]) 2π * grid.radius / 4
@test sum(grid.Δyᶜᶜᵃ[(Nx+1)÷2, :]) 2π * grid.radius / 4
Nx, Ny = 10, 9
grid = OrthogonalSphericalShellGrid(arch, FT, size=(Nx, Ny, 1); z, radius)
@test sum(grid.Δxᶜᶜᵃ[:, (Ny+1)÷2]) 2π * grid.radius / 4
Nx, Ny = 11, 8
grid = OrthogonalSphericalShellGrid(arch, FT, size=(Nx, Ny, 1); z, radius)
@test sum(grid.Δyᶜᶜᵃ[(Nx+1)÷2, :]) 2π * grid.radius / 4

@navidcy
Copy link
Collaborator Author

navidcy commented Aug 29, 2023

I also improved the validation according to the discussion in #3241.

@navidcy navidcy merged commit ef43350 into main Aug 29, 2023
@navidcy navidcy deleted the ncc/latlon-minor-cleanup branch August 29, 2023 13:38
siddharthabishnu pushed a commit that referenced this pull request Sep 11, 2023
…ᶜᵃ) ≈ 4πr²` (#3240)

* minor code cleanup

* add area test for lat-lon grid

* cleaner info msg

* better validate_lat_lon_grid_args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grids 🗺️ testing 🧪 Tests get priority in case of emergency evacuation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LatitudeLongitudeGrid validation seems to be leaky
2 participants