Skip to content

Initial Implementation of Latitude Longitude Face Bounds - #692

Merged
philipc2 merged 61 commits into
mainfrom
get-bounding-box
Apr 11, 2024
Merged

philipc2 merged 61 commits into
mainfrom
get-bounding-box

Conversation

@philipc2

@philipc2 philipc2 commented Feb 5, 2024 •

Copy link
Copy Markdown
Member

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
Comment thread uxarray/grid/grid.py Resolved
Comment thread uxarray/grid/geometry.py Resolved

@erogluorhan erogluorhan left a comment •

Copy link
Copy Markdown
Member

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?

Comment thread test/test_grid.py Resolved
Comment thread test/test_grid.py Resolved
Comment thread test/test_helpers.py Resolved
Comment thread uxarray/constants.py Resolved
Comment thread uxarray/grid/geometry.py Resolved
@philipc2

philipc2 commented Apr 2, 2024

Copy link
Copy Markdown
Member Author

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

philipc2 commented Apr 2, 2024

Copy link
Copy Markdown
Member Author

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

philipc2 commented Apr 2, 2024

Copy link
Copy Markdown
Member Author

@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
Copy Markdown
Contributor

@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
Copy Markdown
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.

Comment thread uxarray/grid/geometry.py Resolved
@philipc2

philipc2 commented Apr 3, 2024

Copy link
Copy Markdown
Member Author

@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

philipc2 commented Apr 9, 2024

Copy link
Copy Markdown
Member Author

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
@erogluorhan
erogluorhan deleted the get-bounding-box branch December 2, 2024 16:24
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