MCPcopy Create free account
hub / github.com/NCAR/wrf-python / _join_files

Function _join_files

src/wrf/util.py:1810–2063  ·  view source on GitHub ↗

Return an array object from a sequence of files using the join method. The join method creates a new leftmost dimension for the file/sequence index. In situations where there are multiple files with multiple times, and the last file contains less times than the previous files, the

(wrfseq, varname, timeidx, is_moving, meta, _key)

Source from the content-addressed store, hash-verified

1808
1809
1810def _join_files(wrfseq, varname, timeidx, is_moving, meta, _key):
1811 """Return an array object from a sequence of files using the join
1812 method.
1813
1814 The join method creates a new leftmost dimension for the file/sequence
1815 index. In situations where there are multiple files with multiple times,
1816 and the last file contains less times than the previous files, the
1817 remaining arrays will be arrays filled with missing values. There are
1818 checks in place within the wrf-python algorithms to look for these missing
1819 arrays, but be careful when calling compiled routines outside of
1820 wrf-python.
1821
1822 In general, join is rarely used, so the concatenate method should be used
1823 for most cases.
1824
1825 Args:
1826
1827 wrfseq (iterable): An iterable type, which includes lists, tuples,
1828 dictionaries, generators, and user-defined classes.
1829
1830 varname (:obj:`str`) : The variable name.
1831
1832 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
1833 desired time index. This value can be a positive integer,
1834 negative integer, or
1835 :data:`wrf.ALL_TIMES` (an alias for None) to return
1836 all times in the file or sequence. The default is 0.
1837
1838 is_moving (:obj:`bool`): A boolean type that indicates if the
1839 sequence is a moving nest.
1840
1841 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
1842 with a size of 1 from being automatically removed from the shape
1843 of the output. Default is True.
1844
1845 meta (:obj:`bool`, optional): Set to False to disable metadata and
1846 return :class:`numpy.ndarray` instead of
1847 :class:`xarray.DataArray`. Default is True.
1848
1849 _key (:obj:`int`, optional): Cache key for the coordinate variables.
1850 This is used for internal purposes only. Default is None.
1851
1852 Returns:
1853
1854 :class:`xarray.DataArray` or :class:`numpy.ndarray`: If xarray is
1855 enabled and the *meta* parameter is True, then the result will be a
1856 :class:`xarray.DataArray` object. Otherwise, the result will be a
1857 :class:`numpy.ndarray` object with no metadata.
1858
1859 """
1860 if is_moving is None:
1861 is_moving = is_moving_domain(wrfseq, varname, _key=_key)
1862 multitime = is_multi_time_req(timeidx)
1863 numfiles = _get_numfiles(wrfseq)
1864 maxtimes = _find_max_time_size(wrfseq)
1865
1866 time_idx_or_slice = timeidx if not multitime else slice(None)
1867 file_times_less_than_max = False

Callers 1

combine_filesFunction · 0.85

Calls 13

is_moving_domainFunction · 0.85
is_multi_time_reqFunction · 0.85
_get_numfilesFunction · 0.85
_find_max_time_sizeFunction · 0.85
extract_dimFunction · 0.85
xarray_enabledFunction · 0.85
_build_data_arrayFunction · 0.85
default_fillFunction · 0.85
_find_coord_namesFunction · 0.85
get_cached_itemFunction · 0.85
extract_timesFunction · 0.85
cache_itemFunction · 0.85

Tested by

no test coverage detected