UXarray aims to address the geoscience community need for tools that enable standard data analysis techniques to operate directly on unstructured grids. It extends upon and inherits from the commonly used Xarray Python package to provide a powerful and familiar interface for working with unstructured grids in Python. UXarray provides Xarray styled functions to better read in and use unstructured grid datasets that follow standard conventions, including UGRID, MPAS, SCRIP, and Exodus formats.
The “U” in UXarray stands for “Unstructured Grids”.
# make a color map of fixed colors cmap = colors.ListedColormap(['white', 'green', 'red', 'blue', 'white']) uxds["ivgtyp"].plot(coastline="10m", cmap=cmap, clim=(11, 15), dynamic=True)
The Hover Tooltip: When you point your mouse cursor over any cell in the interactive map, the popup bubble will dynamically compute and print the exact geographical location along with your real cell identification
#--- jupyter notebook import uxarray as ux import numpy as np import matplotlib.pyplot as plt from matplotlib import colors from bokeh.models import HoverTool import holoviews as hv from bokeh.models import HoverTool
import os import pyproj # Automatically finds and points PROJ to the correct database directory os.environ["PROJ_LIB"] = pyproj.datadir.get_data_dir()
# 1. Print all available column keys that Bokeh/HoloViews sent to the canvas print("Available hover names:", interactive_map.vdims)
# 2. Alternatively, drill directly into the underlying dictionary structure: # This extracts the exact pandas/spatialpandas data columns print("Data columns:", interactive_map.data.columns.tolist())
# Available hover names: [Dimension('ivgtyp')] # Data columns: ['geometry', 'ivgtyp']
ERROR 1: PROJ: proj_create_from_database: Open of /uxarray/share/proj failed
This error occurs because the GDAL/PROJ geospatial libraries cannot locate the mandatory proj.db database file at the hardcoded or environment-specified path /uxarray/share/proj. This usually happens when utilizing geospatial tools inside isolated environments (like Conda or Docker) without properly initializing the underlying library paths.
1 2 3 4 5 6 7 8 9
import uxarray as ux import numpy as np import matplotlib.pyplot as plt from matplotlib import colors
import os import pyproj # Automatically finds and points PROJ to the correct database directory os.environ["PROJ_LIB"] = pyproj.datadir.get_data_dir()
# jupyter notebook import uxarray as ux import numpy as np import matplotlib.pyplot as plt from matplotlib import colors from bokeh.models import HoverTool import holoviews as hv from bokeh.models import HoverTool
import os import pyproj # Automatically finds and points PROJ to the correct database directory os.environ["PROJ_LIB"] = pyproj.datadir.get_data_dir()
# 2. Print all available column keys that Bokeh/HoloViews sent to the canvas print("Available hover names:", interactive_map.vdims)
# 3. Alternatively, drill directly into the underlying dictionary structure: # This extracts the exact pandas/spatialpandas data columns print("Data columns:", interactive_map.data.columns.tolist())