You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tutorial on defining grid topology + fitting data into the data model #976
I am interested in fitting xradar datasets/datatrees (radar data in radial coordinates) into the uxarray data model! This would allow us to represent the data more accurately in-memory, with proper edges to the native coordinates.
Reading through the docs for uxarray, I am looking for a tutorial on how to take an existing xarray dataset and transform it into a uxarray dataset with proper grid topology + conventions that would enable the use of the full functionality in this library.
Do you have any recommendations on where to get started? This is something I would be willing to help with if I can figure out how to get started here 👍
But I am not sure of the variable/coordinate names I need to transform before feeding the dataset into this function. Any help here would be greatly appreciated!
Thanks for the issue. This is very doable: xradar data needs be represented in the UGRID framework. This would require defining how the radial coordinates and associated metadata map onto the UGRID concepts.
Initial implementation could extend open_grid and follow style of this reader
There are a few ways we could handle this, and this is with me making the assumption that the data provided can be easily converted to spherical or Cartesian coordinates.
Triangulation or Tessellation
We could run scipy.spatial.Delaunay or scipy.spatial.SphericalVoronoi to create a UGRID compatible grid. For reference, a minimal grid to be read in using uxarray.Grid.from_topology() requires the following variables
node_lon & node_lat: The longitude and lattitude of the corner nodes of each cell
face_node_connectivity: The indices of the nodes that surround each face
Remapping
As part of #892, I can add an option to remap arbitrary coordinate onto a structured grid. This would require the user to provide a destination grid, but makes me lean towards the first option.
To make sure I am understanding the geometry the radar data can have correctly: There are point clouds (gate centers?) on arbitrary geolocations (maybe not that arbitrary because of the radar sweeps?), and there are edges that are consisting of pairs of those gate centers, which is already generated by pyart, right? Also, pyart doesn't care about any faces/cells that could consist of groups of those edges, also several gate centers, correct?
In UXarray though, we need faces to be also defined for a grid topology to be represented. We need to know (or generate through triangulation as @philipc2 pointed out) face-to-node connectivity at the least (our "node"s correspond to your gate centers I believe?). Regardless, UXarray will eventually need to generate a grid out of point clouds, i.e. defining faces (most likely triangles through Delaunay) out of point clouds and the face-node connectivity, since this seems to be much needed anyways. In the pyart case though, since you are already generating edges out of points, we'd need to use those edges to generate faces rather than making a simple triangulation of the points disregarding your edges. @rajeeja@philipc2 feel free to correct any points.
If we can do that, I think radar applications can benefit much from UXarray's existing and future edge-based plotting and analysis functions (if I am correct with my above understanding of the radar geometry). I am not sure though if UXarray grids' faces/cells, triangles in this case, can be of any use for analysis (they can still be helpful with visualization funcs like rasterized plots for instance).
I have been thinking about this at SciPy... planning on revisiting next week, picking up on the notebook I had drafted! Will be sure to ping you all when there is progress 👍
I didn't follow this issue earlier, please share the notebook or a small test case and I'd be happy to work with you on this. Maybe we can get him a slack call next week
One thing we noticed: Grid.validate() fails _check_area for radar gates close to the radar. The check uses a fixed absolute tolerance (about 1e-10 on the unit sphere, roughly 4,000 m²), and a 0.5° × 250 m gate at 2 km covers only about 4,600 m². All face areas are positive and correct, so a relative or configurable tolerance would help for small-cell meshes like radar sweeps.
Activity
rajeeja commentedon Sep 27, 2024
Thanks for the issue. This is very doable: xradar data needs be represented in the UGRID framework. This would require defining how the radial coordinates and associated metadata map onto the UGRID concepts.
Initial implementation could extend open_grid and follow style of this reader
philipc2 commentedon Sep 27, 2024
Hi @mgrover1
There are a few ways we could handle this, and this is with me making the assumption that the data provided can be easily converted to spherical or Cartesian coordinates.
Triangulation or Tessellation
We could run
scipy.spatial.Delaunayorscipy.spatial.SphericalVoronoito create a UGRID compatible grid. For reference, a minimal grid to be read in usinguxarray.Grid.from_topology()requires the following variablesnode_lon&node_lat: The longitude and lattitude of the corner nodes of each cellface_node_connectivity: The indices of the nodes that surround each faceRemapping
As part of #892, I can add an option to remap arbitrary coordinate onto a structured grid. This would require the user to provide a destination grid, but makes me lean towards the first option.
uxarray/uxarray/grid/grid.py
Lines 290 to 343 in 27975a1
mgrover1 commentedon Sep 27, 2024
Thanks for the quick response @rajeeja and @philipc2 👍
Here is an example of what a plan position indicator (PPI) plot usually look like with proper grid edges defined and plotting with matplotlib
https://arm-doe.github.io/pyart/examples/plotting/plot_ppi_cfradial.html
We currently extract the edges in this function
https://github.com/ARM-DOE/pyart/blob/main/pyart/core/transforms.py#L149
I am not sure if this would help with the triangulation then or if we could feed this manually-defined cell edge information into the function(s) here
erogluorhan commentedon Sep 27, 2024
Hi @mgrover1 , thanks for the issue!
To make sure I am understanding the geometry the radar data can have correctly: There are point clouds (gate centers?) on arbitrary geolocations (maybe not that arbitrary because of the radar sweeps?), and there are edges that are consisting of pairs of those gate centers, which is already generated by pyart, right? Also, pyart doesn't care about any faces/cells that could consist of groups of those edges, also several gate centers, correct?
In UXarray though, we need faces to be also defined for a grid topology to be represented. We need to know (or generate through triangulation as @philipc2 pointed out) face-to-node connectivity at the least (our "node"s correspond to your gate centers I believe?). Regardless, UXarray will eventually need to generate a grid out of point clouds, i.e. defining faces (most likely triangles through Delaunay) out of point clouds and the face-node connectivity, since this seems to be much needed anyways. In the pyart case though, since you are already generating edges out of points, we'd need to use those edges to generate faces rather than making a simple triangulation of the points disregarding your edges. @rajeeja @philipc2 feel free to correct any points.
If we can do that, I think radar applications can benefit much from UXarray's existing and future edge-based plotting and analysis functions (if I am correct with my above understanding of the radar geometry). I am not sure though if UXarray grids' faces/cells, triangles in this case, can be of any use for analysis (they can still be helpful with visualization funcs like rasterized plots for instance).
Thoughts?
erogluorhan commentedon Jul 8, 2025
Hi @mgrover1 just curious if you had a chance to think about this again.
kmuehlbauer commentedon Jul 11, 2025
@erogluorhan Coming here from openradar/xradar#212 while triaging old issues. This is still interesting for xradar, but efforts have stalled a bit.
Also not sure how far @mgrover1 did explore this.
mgrover1 commentedon Jul 12, 2025
I have been thinking about this at SciPy... planning on revisiting next week, picking up on the notebook I had drafted! Will be sure to ping you all when there is progress 👍
rajeeja commentedon Jul 12, 2025
I didn't follow this issue earlier, please share the notebook or a small test case and I'd be happy to work with you on this. Maybe we can get him a slack call next week
philipc2 commentedon Jul 12, 2025
@mgrover1 @kmuehlbauer
Thanks for following up!
erogluorhan commentedon Jul 14, 2025
Thanks all, looking forward to further discussions!
Add to_uxarray: radar sweeps as UGRID unstructured grids
syedhamidali commentedon Oct 4, 2026
Following up from the radar side: radarx now builds a UGRID grid from a radar sweep using
Grid.from_topology. Each gate becomes a quadrilateral face built from the gate edges (halfway between neighbouring rays and gates), rather than from a triangulation of gate centres. Notebook: https://radarx.readthedocs.io/en/latest/notebooks/Radar_UGRID_uxarray.htmlOne thing we noticed:
Grid.validate()fails_check_areafor radar gates close to the radar. The check uses a fixed absolute tolerance (about 1e-10 on the unit sphere, roughly 4,000 m²), and a 0.5° × 250 m gate at 2 km covers only about 4,600 m². All face areas are positive and correct, so a relative or configurable tolerance would help for small-cell meshes like radar sweeps.