Some commonly used functions when python processes NC files

1. glob.glob()

Returns a list of all matching file paths.

The parameter pathname defines the file path matching rules, which can be an absolute path or a relative path.

For example, the following code will return all file paths matching the rule:

t2m_path_list = glob.glob('G:/aaa/sat_dir/mask_daily/era5_t2m_????????.tif')

Each file can be looped through:

for path in tif_path_list:
    print(path)

Guess you like

Origin blog.csdn.net/Mluoo/article/details/130921597