Giter Club home page Giter Club logo

Comments (3)

bladwig1 avatar bladwig1 commented on July 16, 2024

I am guessing your varname was either wspd_wdir10 or uvmet10_wspd_wdir. I was able to reproduce this as well. I'll try to get out a hotfix soon.

from wrf-python.

bladwig1 avatar bladwig1 commented on July 16, 2024

If you want to quickly patch your code before the hotfix is out, modify _calc_wspd_wdir in site-packages/wrf_python-1.0b3-py3.5-linux-x86_64.egg/wrf/wind.py to be this:

def _calc_wspd_wdir(u, v, two_d, units):
    """Return the wind speed and wind direction.
    
    The leftmost dimension of the returned array represents two different 
    quantities:
        
        - return_val[0,...] will contain WSPD
        - return_val[1,...] will contain WDIR
    
    Args:
    
        u (:class:`numpy.ndarray`): The u component of the wind.
        
        v (:class:`numpy.ndarray`): The v component of the wind.
        
        two_d (:obj:`bool`): Set to True if the u,v wind components are 
            for a two-dimensional array (no height dimension).  Otherwise,
            set to False.
            
        units (:obj:`str`): The desired units.  Refer to the :meth:`getvar` 
            product table for a list of available units for 'uvmet_wspd_wdir'.  
            Default is 'm s-1'.
            
    Returns:
    
        :class:`numpy.ndarray`: The wind speed and wind direction, whose 
        leftmost dimension is 2 (0=WSPD, 1=WDIR).
    
    """
    wspd = _calc_wspd(u, v, units)
    wdir = _calc_wdir(u, v)

    idx_end = -2 if two_d else -3
    
    outdims = [2] + list(wspd.shape[0:idx_end]) + list(wspd.shape[idx_end:])
    
    result = np.zeros(outdims, wspd.dtype)
    
    idxs0 = ((0,Ellipsis, slice(None), slice(None), slice(None)) 
            if not two_d else 
            (0, Ellipsis, slice(None), slice(None)))
    
    idxs1 = ((1, Ellipsis, slice(None), slice(None), slice(None)) 
            if not two_d else 
            (1, Ellipsis, slice(None), slice(None)))
    
    result[idxs0] = wspd[:]
    result[idxs1] = wdir[:]
    
    return result

from wrf-python.

andreas-h avatar andreas-h commented on July 16, 2024

Yes, my varname is uvmet10_wspd_wdir. Thanks for the super-fast help! I'll try out your fix later and will let you know if my problem is solved.

from wrf-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.