NCAR / wrf-python

A collection of diagnostic and interpolation routines for use with output from the Weather Research and Forecasting (WRF-ARW) Model.
https://wrf-python.readthedocs.io
Apache License 2.0
410 stars 155 forks source link

Variables mcape and mcin doesn´t work #194

Closed fedecutraro closed 1 year ago

fedecutraro commented 2 years ago

Documentation says that calling the function getvar with the variables 'mcape' and 'mcin' retrieve only those variables of cape_2d variable but I receive the following error

from wrf import getvar
from netCDF4 import Dataset
nc = Dataset('wrfout_d01_2015-12-24_03:00:00')
mcape = getvar(nc, 'mcape')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [4], line 1
----> 1 mcape = getvar(nc, 'mcape')

File ~/miniconda3/envs/wrf_python_build/lib/python3.10/site-packages/wrf/routines.py:350, in getvar(wrfin, varname, timeidx, method, squeeze, cache, meta, **kwargs)
    348 actual_var = _undo_alias(varname)
    349 if actual_var not in _VALID_KARGS:
--> 350     raise ValueError("'{}' is not a valid variable name".format(varname))
    352 _check_kargs(actual_var, kwargs)
    354 return _FUNC_MAP[actual_var](wrfin, timeidx, method, squeeze, cache,
    355                              meta, _key, **kwargs)

ValueError: 'mcape' is not a valid variable name
erogluorhan commented 1 year ago

Hi @fedecutraro , thanks very much for your contribution! I will look at the corresponding PR #195 soon.