Return the temperature in the specified units. This functions extracts the necessary variables from the NetCDF file object in order to perform the calculation. Args: wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \ iterable): WRF-ARW NetCDF
(wrfin, timeidx=0, method="cat", squeeze=True,
cache=None, meta=True, _key=None,
units="K")
| 83 | description="temperature") |
| 84 | @convert_units("temp", "k") |
| 85 | def get_temp(wrfin, timeidx=0, method="cat", squeeze=True, |
| 86 | cache=None, meta=True, _key=None, |
| 87 | units="K"): |
| 88 | """Return the temperature in the specified units. |
| 89 | |
| 90 | This functions extracts the necessary variables from the NetCDF file |
| 91 | object in order to perform the calculation. |
| 92 | |
| 93 | Args: |
| 94 | |
| 95 | wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \ |
| 96 | iterable): WRF-ARW NetCDF |
| 97 | data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile` |
| 98 | or an iterable sequence of the aforementioned types. |
| 99 | |
| 100 | timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The |
| 101 | desired time index. This value can be a positive integer, |
| 102 | negative integer, or |
| 103 | :data:`wrf.ALL_TIMES` (an alias for None) to return |
| 104 | all times in the file or sequence. The default is 0. |
| 105 | |
| 106 | method (:obj:`str`, optional): The aggregation method to use for |
| 107 | sequences. Must be either 'cat' or 'join'. |
| 108 | 'cat' combines the data along the Time dimension. |
| 109 | 'join' creates a new dimension for the file index. |
| 110 | The default is 'cat'. |
| 111 | |
| 112 | squeeze (:obj:`bool`, optional): Set to False to prevent dimensions |
| 113 | with a size of 1 from being automatically removed from the shape |
| 114 | of the output. Default is True. |
| 115 | |
| 116 | cache (:obj:`dict`, optional): A dictionary of (varname, ndarray) |
| 117 | that can be used to supply pre-extracted NetCDF variables to the |
| 118 | computational routines. It is primarily used for internal |
| 119 | purposes, but can also be used to improve performance by |
| 120 | eliminating the need to repeatedly extract the same variables |
| 121 | used in multiple diagnostics calculations, particularly when using |
| 122 | large sequences of files. |
| 123 | Default is None. |
| 124 | |
| 125 | meta (:obj:`bool`, optional): Set to False to disable metadata and |
| 126 | return :class:`numpy.ndarray` instead of |
| 127 | :class:`xarray.DataArray`. Default is True. |
| 128 | |
| 129 | _key (:obj:`int`, optional): A caching key. This is used for internal |
| 130 | purposes only. Default is None. |
| 131 | |
| 132 | units (:obj:`str`): The desired units. Refer to the :meth:`getvar` |
| 133 | product table for a list of available units for 'temp'. Default |
| 134 | is 'K'. |
| 135 | |
| 136 | Returns: |
| 137 | :class:`xarray.DataArray` or :class:`numpy.ndarray`: The |
| 138 | temperature in the specified units. |
| 139 | If xarray is enabled and the *meta* parameter is True, then the result |
| 140 | will be a :class:`xarray.DataArray` object. Otherwise, the result will |
| 141 | be a :class:`numpy.ndarray` object with no metadata. |
| 142 |
no test coverage detected