Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file indexing for files containing more than 1yr of data fails if start or end year are not named in files #335

Open
bitterbark opened this issue Oct 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@bitterbark
Copy link
Collaborator

ADF run type

Model vs. Model

What happened?

If there is more than one year of data in a file, every year is not represented in the list of file names. Calling for a start or end year that is not alos one of the file names throws an error that the years are not in range (even though they are).

Eg: I have 3 years of data in each file, model run from year 1-22, so file names are

b.e30_beta02.BLT1850.ne30_t232.104_mdtf.cam.h5a.0001-01-01-10800.nc
b.e30_beta02.BLT1850.ne30_t232.104_mdtf.cam.h5a.0004-01-01-10800.nc
...
b.e30_beta02.BLT1850.ne30_t232.104_mdtf.cam.h5a.0022-01-01-10800.nc

If I try to run with start year = 2 and end year = 6, I get an error that the years are out of range. But in fact it is only seeing if the years 3 & 6 are in the set of the years from the file names:

case_climo_yrs = [int(str(i).partition(f"{hist_str}.")[2][0:4]) for i in file_list]
print(f"{case_climo_yrs=} {case_found_syr=} {case_found_eyr=}")

case_climo_yrs=[1, 4, 7, 10, 13, 16, 19, 22] case_found_syr=1 case_found_eyr=22

So we should just check if the years are in the range [case_found_syr,case_found_eyr] instead of in the set case_climo_yrs

ADF Hash you are using

5f825af

What machine were you running the ADF on?

CISL machine

What python environment were you using?

NPL (CISL machines only)

Extra info

No response

@bitterbark bitterbark added the bug Something isn't working label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant