Skip to content

[MISC]: xwrf metpy on wrf data #200

@fipoucat

Description

@fipoucat

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:
from metpy.calc import wind_speed
wind_speed(ds.U, ds.V)

ds.U.sizes, ds.V.sizes

ds = ds.metpy.quantify()
wind_speed(ds.U.wrf.destagger(), ds.V.wrf.destagger())
Traceback (most recent call last):

Cell In[7], line 2
wind_speed(ds.U, ds.V)

File /opt/anaconda3/lib/python3.12/site-packages/metpy/xarray.py:1330 in wrapper
result = func(*bound_args.args, **bound_args.kwargs)

File /opt/anaconda3/lib/python3.12/site-packages/metpy/units.py:333 in wrapper
return func(*args, **kwargs)

File /opt/anaconda3/lib/python3.12/site-packages/metpy/calc/basic.py:63 in wind_speed
return np.hypot(u, v)

File /opt/anaconda3/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:72 in array_ufunc
return numpy_wrap("ufunc", ufunc, inputs, kwargs, types)

File /opt/anaconda3/lib/python3.12/site-packages/pint/facets/numpy/numpy_func.py:1071 in numpy_wrap
return handled[name](*args, **kwargs)

File /opt/anaconda3/lib/python3.12/site-packages/pint/facets/numpy/numpy_func.py:322 in implementation
result_magnitude = func(*stripped_args, **stripped_kwargs)

File /opt/anaconda3/lib/python3.12/site-packages/dask/array/core.py:1594 in array_ufunc
return elemwise(numpy_ufunc, *inputs, **kwargs)

File /opt/anaconda3/lib/python3.12/site-packages/dask/array/core.py:4795 in elemwise
broadcast_shapes(*shapes)

File /opt/anaconda3/lib/python3.12/site-packages/dask/array/core.py:4723 in broadcast_shapes
raise ValueError(

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions