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

Initial Implementation of Latitude Longitude Face Bounds #692

Merged
merged 61 commits into from
Apr 11, 2024

Conversation

philipc2
Copy link
Member

@philipc2 philipc2 commented Feb 5, 2024

Closes #91

Overview

  • Introduces the Grid.bounds variable, which contains the Latitude-Longitude bounds for each face.

Expected Usage

import uxarray as ux

grid_path = "/path/to/grid.nc"

uxgrid = ux.open_grid(grid_path)

# obtain bounds
uxgrid.bounds

@philipc2 philipc2 changed the title DRAFT: Grid Bounding Box & Face Bounds DRAFT: Face Bounds Feb 5, 2024
@philipc2 philipc2 linked an issue Feb 5, 2024 that may be closed by this pull request
@philipc2
Copy link
Member Author

Some timing benchmarks on a few of the grids that we have in our test suite.

image

The GeoFlow grid (12s execution time) has 6000 nodes and 3840 faces.

I'll continue investigating optimizations into the performance, however all things considered we can begin to move forward with getting this PR merged (once I finalize a few review comments)

uxarray/grid/grid.py Outdated Show resolved Hide resolved
uxarray/grid/geometry.py Outdated Show resolved Hide resolved
Copy link
Member

@erogluorhan erogluorhan left a comment

Choose a reason for hiding this comment

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

I did a first pass over the code. Thanks for this!

Re @philipc2's benchmarking:

The GeoFlow grid (12s execution time) has 6000 nodes and 3840 faces.

That's extremely slow for such a small grid (though relatable as the algorithm iterates over each face, and each edge of that face). Taking into account bigger grids might be used, the execution times might make the things impractical, and that makes me think that we should consider either to optimize before a release, or provide caution admonitions, if possible, in the documentation to let the user clearly know the extreme performance bottleneck.

Thoughts?

test/test_grid.py Show resolved Hide resolved
test/test_grid.py Outdated Show resolved Hide resolved
test/test_helpers.py Show resolved Hide resolved
uxarray/constants.py Show resolved Hide resolved
uxarray/grid/geometry.py Outdated Show resolved Hide resolved
@philipc2
Copy link
Member Author

philipc2 commented Apr 2, 2024

That's extremely slow for such a small grid (though relatable as the algorithm iterates over each face, and each edge of that face). Taking into account bigger grids might be used, the execution times might make the things impractical, and that makes me think that we should consider either to optimize before a release, or provide caution admonitions, if possible, in the documentation to let the user clearly know the extreme performance bottleneck.

Can you add this note to #730?

@philipc2
Copy link
Member Author

philipc2 commented Apr 2, 2024

Pinging @hongyuchen1030

Made a couple changes, the performance issues will be handled with #730. Once the above comments are addressed, I'm good with merging it.

@philipc2
Copy link
Member Author

philipc2 commented Apr 2, 2024

@hongyuchen1030

Maybe for time being, we can make bounds an internal attribute while we work on optimizing the perfromance.

Grid._bounds

This would allow you to continue working while we work on the optimization. Thoughts?

@philipc2 philipc2 changed the title Face Bounds Initial Implementation of Face Bounds Apr 2, 2024
@philipc2 philipc2 changed the title Initial Implementation of Face Bounds Initial Implementation of Latitude Longitude Face Bounds Apr 2, 2024
@hongyuchen1030
Copy link
Collaborator

@hongyuchen1030

Maybe for time being, we can make bounds an internal attribute while we work on optimizing the perfromance.

Grid._bounds

This would allow you to continue working while we work on the optimization. Thoughts?

I am open to any suggestion as long as I can continue my work. The main point here is: Aren't we supposed to give users at least something they can use now? I know Paul has been receiving numerous requests for these functionalities and keeps asking if there's anything they can start using right now. I feel like at this point doing an agile development might be better for users than a cascade development. We can always put a warning/ description for this function.

We can also discuss this in our next Uxarray meeting as well.

@erogluorhan
Copy link
Member

I am open to any suggestion as long as I can continue my work. The main point here is: Aren't we supposed to give users at least something they can use now? I know Paul has been receiving numerous requests for these functionalities and keeps asking if there's anything they can start using right now. I feel like at this point doing an agile development might be better for users than a cascade development. We can always put a warning/ description for this function.

We can also discuss this in our next Uxarray meeting as well.

12s execution time for a pretty small grid with only 3840 faces is raising a concern about its usability.

I feel like either (1) making it internal until we make usable optimization (for instance, we were able to optimize the nodal averaging over the hackathon by around 80x by only Numpy vectorization), or (2) displaying a strong caution about its performance when the user attempts to use it would suffice for now. We can get your work going on with either of these as well.

I lean towards the option one personally but am happy to discuss. If you'll have a chance to meet with Paul before the next week's meeting, please feel free to discuss before then, bringing these comments up. Otherwise, let's discuss next week.

@philipc2
Copy link
Member Author

philipc2 commented Apr 3, 2024

@hongyuchen1030
Maybe for time being, we can make bounds an internal attribute while we work on optimizing the perfromance.

Grid._bounds

This would allow you to continue working while we work on the optimization. Thoughts?

I am open to any suggestion as long as I can continue my work. The main point here is: Aren't we supposed to give users at least something they can use now? I know Paul has been receiving numerous requests for these functionalities and keeps asking if there's anything they can start using right now. I feel like at this point doing an agile development might be better for users than a cascade development. We can always put a warning/ description for this function.

We can also discuss this in our next Uxarray meeting as well.

That's a fair point. Let's keep it as part of the user API (i.e. Grid.bounds) with a warning within the docstring.

Another data point, I ran this on a 82k node / 41k face mesh and it ran in ~3 minutes, which for this initial implementation is acceptable.

@philipc2
Copy link
Member Author

philipc2 commented Apr 9, 2024

I will be adding a warning about the performance. Once all comments are addressed, we will get it merged.

@philipc2 philipc2 merged commit 0020265 into main Apr 11, 2024
15 checks passed
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.

Add lat-lon bounds
3 participants