-
Notifications
You must be signed in to change notification settings - Fork 303
Catch and report PyAPS Copernicus Climate Store credential error #226
Description
Not sure if it is bug report or feature request.
ERA5 PYAPS Tropospheric delay correction currently fails with a hard to diagnose ZeroDivisionError in the progress bar class when the user's login credentials for https://cds.climate.copernicus.eu/ is not correct (or if the user has not accepted the T&Cs). This makes a simple problem (user registration) very hard to figure out.
Going through the code and error stack below reveals that the division error is a result of the date_list2grib_file function not returning a list of data since it does not have access to the service. The progress bar then uses the length of this empty list to set the endpoint of the progress bar resulting in the error.
I think one solution would be to catch the specific error in the try clause (line 398) of the dload_grib_files function in tropo_pyaps3.py.
calcualting` delay for each date using PyAPS (Jolivet et al., 2011; 2014) ...
number of grib files used: 0
Traceback (most recent call last):
File "/home/app/app.py", line 10, in
smallbaselineApp.main()
File "/home/python/MintPy/mintpy/smallbaselineApp.py", line 1069, in main
app.run(steps=inps.runSteps, plot=inps.plot)
File "/home/python/MintPy/mintpy/smallbaselineApp.py", line 1019, in run
self.run_tropospheric_delay_correction(sname)
File "/home/python/MintPy/mintpy/smallbaselineApp.py", line 751, in run_tropospheric_delay_correction
tropo_pyaps3.main(scp_args.split())
File "/home/python/MintPy/mintpy/tropo_pyaps3.py", line 570, in main
get_delay_timeseries(inps, atr)
File "/home/python/MintPy/mintpy/tropo_pyaps3.py", line 523, in get_delay_timeseries
prog_bar = ptime.progressBar(maxValue=num_date)
File "/home/python/MintPy/mintpy/utils/ptime.py", line 277, in init
self.reset()
File "/home/python/MintPy/mintpy/utils/ptime.py", line 282, in reset
self.update_amount(0) # Build progress bar string
File "/home/python/MintPy/mintpy/utils/ptime.py", line 296, in update_amount
percentDone = (diffFromMin / np.float(self.span)) * 100.0
ZeroDivisionError: float division by zero