Applying python path glob using f-string

Viewed 38

I have about 8000 netCDF files in a directory named like so:

FLDAS_NOAH001_G_CA_D.A20011001.001.nc.SUB.nc4

Here 2000 represents the year and I have data for each day from 2000 to 2022. I want to get all files for a given year using glob. Here is my code:

base_path = '/dir_user/data'
year = 2001
fls = base_path.glob(f'FLDAS_NOAH001*{year}*.nc4')

However, this results in 0 files even when there are clearly files for 2001 in that directory:
print(len(list(fls)))

What am I doing wrong?

0 Answers
Related