Combine and return an array object for the sequence of WRF output files. Two aggregation methodologies are available to combine the sequence: - 'cat': Concatenate the files along the 'Time' dimension. The Time dimension will be the leftmost dimension. No sorting is perf
(wrfin, varname, timeidx, is_moving=None,
method="cat", squeeze=True, meta=True,
_key=None)
| 2064 | |
| 2065 | |
| 2066 | def combine_files(wrfin, varname, timeidx, is_moving=None, |
| 2067 | method="cat", squeeze=True, meta=True, |
| 2068 | _key=None): |
| 2069 | """Combine and return an array object for the sequence of WRF output |
| 2070 | files. |
| 2071 | |
| 2072 | Two aggregation methodologies are available to combine the sequence: |
| 2073 | |
| 2074 | - 'cat': Concatenate the files along the 'Time' dimension. The Time |
| 2075 | dimension will be the leftmost dimension. No sorting is performed, |
| 2076 | so files must be properly ordered in the sequence prior to calling |
| 2077 | this function. |
| 2078 | |
| 2079 | - 'join': Join the files by creating a new leftmost dimension for the |
| 2080 | file index. In situations where there are multiple files with |
| 2081 | multiple times, and the last file contains less times than the |
| 2082 | previous files, the remaining arrays will be arrays filled with |
| 2083 | missing values. There are checks in place within the wrf-python |
| 2084 | algorithms to look for these missing arrays, but be careful when |
| 2085 | calling compiled routines outside of wrf-python. |
| 2086 | |
| 2087 | |
| 2088 | Args: |
| 2089 | |
| 2090 | wrfin (iterable): An iterable type, which includes lists, tuples, |
| 2091 | dictionaries, generators, and user-defined classes. |
| 2092 | |
| 2093 | varname (:obj:`str`) : The variable name. |
| 2094 | |
| 2095 | timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The |
| 2096 | desired time index. This value can be a positive integer, |
| 2097 | negative integer, or |
| 2098 | :data:`wrf.ALL_TIMES` (an alias for None) to return |
| 2099 | all times in the file or sequence. The default is 0. |
| 2100 | |
| 2101 | is_moving (:obj:`bool`): A boolean type that indicates if the |
| 2102 | sequence is a moving nest. |
| 2103 | |
| 2104 | method (:obj:`str`, optional): The aggregation method to use for |
| 2105 | sequences. Must be either 'cat' or 'join'. |
| 2106 | 'cat' combines the data along the Time dimension. |
| 2107 | 'join' creates a new dimension for the file index. |
| 2108 | The default is 'cat'. |
| 2109 | |
| 2110 | squeeze (:obj:`bool`, optional): Set to False to prevent dimensions |
| 2111 | with a size of 1 from being automatically removed from the shape |
| 2112 | of the output. Default is True. |
| 2113 | |
| 2114 | meta (:obj:`bool`, optional): Set to False to disable metadata and |
| 2115 | return :class:`numpy.ndarray` instead of |
| 2116 | :class:`xarray.DataArray`. Default is True. |
| 2117 | |
| 2118 | _key (:obj:`int`, optional): Cache key for the coordinate variables. |
| 2119 | This is used for internal purposes only. Default is None. |
| 2120 | |
| 2121 | Returns: |
| 2122 | |
| 2123 | :class:`xarray.DataArray` or :class:`numpy.ndarray`: If xarray is |
no test coverage detected