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

Wave Watch III unstructured grid #1084

Open
tinaok opened this issue Nov 22, 2024 · 5 comments
Open

Wave Watch III unstructured grid #1084

tinaok opened this issue Nov 22, 2024 · 5 comments
Assignees
Labels
new feature New feature or request

Comments

@tinaok
Copy link

tinaok commented Nov 22, 2024

Proposed new feature or change:

Hello UXARRAY community,

The Wave Watch III (WW3) model generates outputs on unstructured grids. Has the UXARRAY community previously worked with WW3 model outputs? If so, could you provide examples of loading and plotting these datasets?

For reference, here's an example WW3 output: RSCD_WW3-RSCD-UG_202301.nc

Thank you for your assistance.
@mickaelaccensi @ardhuin @keewis

@tinaok tinaok added the new feature New feature or request label Nov 22, 2024
@github-project-automation github-project-automation bot moved this to 📚 Backlog in UXarray Development Nov 22, 2024
@philipc2 philipc2 self-assigned this Nov 22, 2024
@philipc2 philipc2 moved this from 📚 Backlog to 📝 To-Do in UXarray Development Nov 22, 2024
@philipc2
Copy link
Member

Hi @tinaok

Thank you for reaching out! We haven't previously worked with any WW3 model output before, however the dataset that you provided has enough information to create a triangular grid using UXarray.

import uxarray as ux
import xarray as xr
# load an xarray dataset since 
xrds = xr.open_dataset(r"RSCD_WW3-RSCD-UG_202301.nc")

# face node connectivity (indices of the nodes that make up each face, zero-indexed)
face_node_connectivity = xrds.tri.data - 1
node_lon = xrds.longitude.data
node_lat = xrds.latitude.data

# create a minimal grid from corner nodes and face node connectivity
uxgrid = ux.Grid.from_topology(face_node_connectivity=face_node_connectivity, node_lon=node_lon, node_lat=node_lat)

Here's a plot of a region of the grid (1.0 degree bounding circle centered around -5 longitude 50 latitude)

import holoviews as hv
out = uxgrid.subset.bounding_circle((-5, 50), r=1.0).plot(backend='matplotlib', width=4000, height=4000, linewidth=1)
hv.save(out, filename='RSCD-UG.png')

Image

All the data variables appear to be mapped to the corners of the triangles. I'll open up a PR for supporting this grid format and also for creating a UxDataset from all the data variables.

Would you be able to provide any reference visualizations or workflows that I can take a look at? I'd love to put together an example for UXarray.

@mickaelaccensi
Copy link

Hi @philipc2 ,

Thanks for this great example ! I'll try to play with it asap.
If you want to look how we do visualization, please look at :
https://nbviewer.org/urls/gitlab.ifremer.fr/resourcecode/tools/exploratory-data-analysis/-/raw/branch/default/index.ipynb

Let me know if you need more information.

@mickaelaccensi
Copy link

I'm not able to import uxarray in a fresh new micromamba env due to static TLS error. Do you have any clue ?

Thanks for your help

>>> import uxarray as ux
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/__init__.py", line 1, in <module>
    from .core.api import open_grid, open_dataset, open_mfdataset
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/core/__init__.py", line 1, in <module>
    from .api import open_grid, open_dataset, open_mfdataset
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/core/api.py", line 9, in <module>
    from uxarray.grid import Grid
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/grid/__init__.py", line 1, in <module>
    from .grid import Grid
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/grid/grid.py", line 68, in <module>
    from uxarray.grid.neighbors import (
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/grid/neighbors.py", line 8, in <module>
    from sklearn.neighbors import BallTree as SKBallTree
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/sklearn/__init__.py", line 85, in <module>
    from .utils._show_versions import show_versions
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/sklearn/utils/_show_versions.py", line 15, in <module>
    from ._openmp_helpers import _openmp_parallelism_enabled
ImportError: dlopen: cannot load any more object with static TLS

@philipc2
Copy link
Member

I'm not able to import uxarray in a fresh new micromamba env due to static TLS error. Do you have any clue ?

Thanks for your help

>>> import uxarray as ux
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/__init__.py", line 1, in <module>
    from .core.api import open_grid, open_dataset, open_mfdataset
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/core/__init__.py", line 1, in <module>
    from .api import open_grid, open_dataset, open_mfdataset
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/core/api.py", line 9, in <module>
    from uxarray.grid import Grid
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/grid/__init__.py", line 1, in <module>
    from .grid import Grid
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/grid/grid.py", line 68, in <module>
    from uxarray.grid.neighbors import (
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/uxarray/grid/neighbors.py", line 8, in <module>
    from sklearn.neighbors import BallTree as SKBallTree
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/sklearn/__init__.py", line 85, in <module>
    from .utils._show_versions import show_versions
  File "/home1/datawork/maccensi/micromamba/envs/env_xarray/lib/python3.12/site-packages/sklearn/utils/_show_versions.py", line 15, in <module>
    from ._openmp_helpers import _openmp_parallelism_enabled
ImportError: dlopen: cannot load any more object with static TLS

Can you show me the versions of all of your packages? conda list or mamba list should work.

@philipc2 philipc2 moved this from 📝 To-Do to 🏗 In progress in UXarray Development Nov 26, 2024
@tinaok
Copy link
Author

tinaok commented Nov 26, 2024

Hi @mickaelaccensi , I tried on pangeo-eosc cloud, https://pangeo-data.github.io/pangeo-eosc/
just with pip install uxarray on pangeo enviroment it works.

Image

( If we can expose your file in virtual zarr, it should go faster. )

If you are using datarmor, I think RIC put pangeo enviroment, so if it up to date, you just need to do pip install xarray.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
Status: 🏗 In progress
Development

No branches or pull requests

3 participants