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

Function _get_numfiles

src/wrf/util.py:1787–1807  ·  view source on GitHub ↗

Return the number of files in the sequence. This function will first try to call the builtin :meth:`len` function, but if that fails, the entire squence will be iterated over and counted. Args: wrfseq (iterable): An iterable type, which includes lists, tuples, dict

(wrfseq)

Source from the content-addressed store, hash-verified

1785
1786
1787def _get_numfiles(wrfseq):
1788 """Return the number of files in the sequence.
1789
1790 This function will first try to call the builtin :meth:`len` function, but
1791 if that fails, the entire squence will be iterated over and counted.
1792
1793 Args:
1794
1795 wrfseq (iterable): An iterable type, which includes lists, tuples,
1796 dictionaries, generators, and user-defined classes.
1797
1798 Returns:
1799
1800 :obj:`int`: The number of files in the sequence.
1801
1802 """
1803 try:
1804 return len(wrfseq)
1805 except TypeError:
1806 wrf_iter = iter(wrfseq)
1807 return sum(1 for _ in wrf_iter)
1808
1809
1810def _join_files(wrfseq, varname, timeidx, is_moving, meta, _key):

Callers 1

_join_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected