-
Notifications
You must be signed in to change notification settings - Fork 11
Description
I'm using Martina's pyfesom2 version on levante: /work/ba1264/a270210/fesom_plot_tools/pyfesom2/
Description
I would like to plot a cross section of u and v for the Greenland - Scotland ridge using 3D u- and v- fields on the DART mesh.
Because of memory issues, I can't directly compute an u- or v- transect from the complete 3D u- and v- fields. For this reason, I first use the accessor utility to select a small area that encompasses the transect.
What I did:
from pyfesom2.datasets import open_dataset
mesh_path = "/work/ba1264/a270210/model/input/fesom2/dart/"
data_pathu1 = "/work/ab0995/a270062/runtime/awicm3-v3.1_refactoring/TCO319L137-DART/ctl1950d/outdata/fesom/u.*"
fesom_u1ds = open_dataset(data_pathu1, mesh_path)
datautemp1=fesom_u1ds.pyfesom2.select(region=(-30, 56, -2, 71))
#Greenland - Scotland ridge
lon_start = -27
lat_start = 68.5
lon_end = -5
lat_end = 59
npoints = 50
lonlat = pf.transect_get_lonlat(lon_start, lat_start, lon_end, lat_end, npoints)
u_nodes1 = pf.tonodes3d(datautemp1, mesh_path)
The last command throws an error because datautemp1 doesn't seem to have the shape that is expected:
AttributeError Traceback (most recent call last)
Cell In[5], line 1
----> 1 u_nodes1 = pf.tonodes3d(datautemp1, mesh_path)
2 v_nodes1 = pf.tonodes3d(datavtemp1, mesh_path)
3 u_nodes2 = pf.tonodes3d(datautemp2, mesh_path)
File /work/ba1264/a270210/fesom_plot_tools/pyfesom2/pyfesom2/regridding.py:706, in tonodes3d(component, mesh)
691 def tonodes3d(component, mesh):
692 """Interpolate 3D data from elements to nodes.
693
694 Parameters
(...)
704 2D data (nodes, levels) on nodes
705 """
--> 706 levels = component.shape[1]
707 out_data = np.zeros((mesh.n2d, levels))
708 for level in range(levels):
File /sw/spack-levante/mambaforge-22.9.0-2-Linux-x86_64-kptncg/lib/python3.10/site-packages/xarray/core/common.py:276, in AttrAccessMixin.getattr(self, name)
274 with suppress(KeyError):
275 return source[name]
--> 276 raise AttributeError(
277 f"{type(self).name!r} object has no attribute {name!r}"
278 )
AttributeError: 'Dataset' object has no attribute 'shape'