pysteps.io.archive.find_by_date

pysteps.io.archive.find_by_date

pysteps.io.archive.find_by_date(date, root_path, path_fmt, fn_pattern, fn_ext, timestep, num_prev_files=0, num_next_files=0, silent=False)

List input files whose timestamp matches the given date.

Parameters
date: datetime.datetime

The given date.

root_path: str

The root path to search the input files.

path_fmt: str

Path format. It may consist of directory names separated by ‘/’, date/time specifiers beginning with ‘%’ (e.g. %Y/%m/%d) and wildcards (?) that match any single character.

fn_pattern: str

The name pattern of the input files without extension. The pattern can contain time specifiers (e.g. %H, %M and %S).

fn_ext: str

Extension of the input files.

timestep: float

Time step between consecutive input files (minutes).

num_prev_files: int

Optional, number of previous files to find before the given timestamp.

num_next_files: int

Optional, number of future files to find after the given timestamp.

silent: bool

Optional, whether to suppress all messages from the method.

Returns
out: tuple

If num_prev_files=0 and num_next_files=0, return a pair containing the found file name and the corresponding timestamp as a datetime.datetime object. Otherwise, return a tuple of two lists, the first one for the file names and the second one for the corresponding timestemps. The lists are sorted in ascending order with respect to timestamp. A None value is assigned if a file name corresponding to a given timestamp is not found.