-
What is your issue?I am attempting to post-process wrf output using xwrf and metpy. After opening the dataset I am trying to work on wind data but getting an error: ds.U.sizes, ds.V.sizes ds = ds.metpy.quantify() Cell In[7], line 2 File /opt/anaconda3/lib/python3.12/site-packages/metpy/xarray.py:1330 in wrapper File /opt/anaconda3/lib/python3.12/site-packages/metpy/units.py:333 in wrapper File /opt/anaconda3/lib/python3.12/site-packages/metpy/calc/basic.py:63 in wind_speed File /opt/anaconda3/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:72 in array_ufunc File /opt/anaconda3/lib/python3.12/site-packages/pint/facets/numpy/numpy_func.py:1071 in numpy_wrap File /opt/anaconda3/lib/python3.12/site-packages/pint/facets/numpy/numpy_func.py:322 in implementation File /opt/anaconda3/lib/python3.12/site-packages/dask/array/core.py:1594 in array_ufunc File /opt/anaconda3/lib/python3.12/site-packages/dask/array/core.py:4795 in elemwise File /opt/anaconda3/lib/python3.12/site-packages/dask/array/core.py:4723 in broadcast_shapes ValueError: operands could not be broadcast together with shapes (8, 47, 116, 133) (8, 47, 117, 132) Any hint on what is causing the error and how to fix it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The problem is that at the point where you call Also, compare with https://xwrf.readthedocs.io/en/stable/tutorials/xgcm.html |
Beta Was this translation helpful? Give feedback.
The problem is that at the point where you call
wind_speed(ds.U, ds.V)
, theU
andV
arrays are not destaggered yet. Your second call towind_speed(ds.U.xwrf.destagger(), ds.V.xwrf.destagger())
(please note thexwrf
instead ofwrf
) should work.Also, compare with https://xwrf.readthedocs.io/en/stable/tutorials/xgcm.html