wrf.combine_files

wrf.combine_files(wrfin, varname, timeidx, is_moving=None, method='cat', squeeze=True, meta=True, _key=None)

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 performed, so files must be properly ordered in the sequence prior to calling this function.
  • ‘join’: Join the files by creating a new leftmost dimension for the file index. In situations where there are multiple files with multiple times, and the last file contains less times than the previous files, the remaining arrays will be arrays filled with missing values. There are checks in place within the wrf-python algorithms to look for these missing arrays, but be careful when calling compiled routines outside of wrf-python.
Parameters:
  • wrfin (iterable) – An iterable type, which includes lists, tuples, dictionaries, generators, and user-defined classes.
  • varname (str) – The variable name.
  • timeidx (int or wrf.ALL_TIMES, optional) – The desired time index. This value can be a positive integer, negative integer, or wrf.ALL_TIMES (an alias for None) to return all times in the file or sequence. The default is 0.
  • is_moving (bool) – A boolean type that indicates if the sequence is a moving nest.
  • method (str, optional) – The aggregation method to use for sequences. Must be either ‘cat’ or ‘join’. ‘cat’ combines the data along the Time dimension. ‘join’ creates a new dimension for the file index. The default is ‘cat’.
  • squeeze (bool, optional) – Set to False to prevent dimensions with a size of 1 from being automatically removed from the shape of the output. Default is True.
  • meta (bool, optional) – Set to False to disable metadata and return numpy.ndarray instead of xarray.DataArray. Default is True.
  • _key (int, optional) – Cache key for the coordinate variables. This is used for internal purposes only. Default is None.
Returns:

If xarray is enabled and the meta parameter is True, then the result will be a xarray.DataArray object. Otherwise, the result will be a numpy.ndarray object with no metadata.

Return type:

xarray.DataArray or numpy.ndarray