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

Added try/except for model download #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DL2JNL
Copy link

@DL2JNL DL2JNL commented Nov 17, 2023

Hei Lukas,

I saw that the download functions runs into an error if one of the .nc files is no existent on the thredds server, which happens sometimes for whatever reason.

See for example https://thredds.met.no/thredds/catalog/aromearcticarchive/2022/10/23/arome_arctic_det_2_5km_20221023T18Z.nc (not existent on the server)

If you now want to download model data with the toolbox e.g. for the entire month of Oct. 2022 it will run into an error there and abort the entire download.

What I did now is basically adding a try/except statement to the main dl functions. It is in my opinion a cleaner way of error handling when downloading something or working with external files (that might have changed or do not exist) in general.

IMPORTANT : It is untested yet, because I was a bit afraid of destroying my unisacsi setup while still working on the oceanography report ;). So pls test it before adding it to the main branch. What I basically did with my current setup is setting save_daily_files to True and then do a for-loop with the try/except around the download_MET_model_data function, that is constantly changing the .yml file and then downloads the file just for one day. If it runs into an error, it will skip the day. It's probably not the cleanest solution for it but it works and I actually managed to download a year of data like this without errors interrupting the download, so I assume that it will work the same way inside the toolbox itself.

Regard, Jan (from the AGF-213 course)

added try/except statement for the main model dl functions. Yet untested, needs testing!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant