Re: [python-users] MetPy Value Error

  • To: "ashwinD12 ." <winash12@xxxxxxxxx>
  • Subject: Re: [python-users] MetPy Value Error
  • From: Ryan May <rmay@xxxxxxxx>
  • Date: Thu, 13 Oct 2016 16:17:50 -0600
Ashwin,

I'm responsible chiefly for MetPy so that's fine. For future reference,
though, I prefer public channels in general, either Unidata's python-users
email list or issues over at http://github.com/metpy/MetPy/issues so that
the rest of the community can chime in with answers or benefit from the
information. I'm cc'ing the python-users list so we can take the
conversation there.

That error message implies that something is off with the size of one of
your arrays. What are the sizes of temp, u_wind, and v_wind?

Ryan



On Thu, Oct 13, 2016 at 9:53 AM, ashwinD12 . <winash12@xxxxxxxxx> wrote:

> Hello Ryan,
>                     I am not sure if I should be contacting you regarding
> MetPy errors. But I ran a slightly modified example of this cookbook -
> http://nbviewer.jupyter.org/github/unidata/notebook-
> gallery/blob/master/notebooks/850mb_Temperature_Advection.ipynb and I am
> getting this runtime error -
> Any idea what that means ?
> Traceback (most recent call last):
>   File "tempAdv.py", line 38, in <module>
>     adv = advection(temp * units.kelvin, [u_wind,
> v_wind],(42583.44283066879 * units.meter, 55588.7366760194 * units.meter))
> * units('degF/sec')
>   File "/usr/local/lib/python3.5/dist-packages/MetPy-0.3.1-py3.
> 5.egg/metpy/calc/kinematics.py", line 166, in advection
>     grad = _stack(_gradient(scalar, *deltas))
>   File "/usr/local/lib/python3.5/dist-packages/MetPy-0.3.1-py3.
> 5.egg/metpy/calc/kinematics.py", line 18, in _gradient
>     grad = np.gradient(f, *args, **kwargs)
>   File "/usr/lib/python3/dist-packages/numpy/lib/function_base.py", line
> 1440, in gradient
>     "Shape of array too small to calculate a numerical gradient, "
> ValueError: Shape of array too small to calculate a numerical gradient, at
> least two elements are required.
>
>
>


-- 
Ryan May, Ph.D.
Software Engineer
UCAR/Unidata
Boulder, CO
  • 2016 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the python-users archives: