Skip to content

Commit

Permalink
Set dl_verify to False per default
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaussion committed Mar 23, 2023
1 parent ca95601 commit 2e381f9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
14 changes: 1 addition & 13 deletions oggm/cli/prepro_levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def run_prepro_levels(rgi_version=None, rgi_reg=None, border=None,
add_millan_thickness=False, add_millan_velocity=False,
add_hugonnet_dhdt=False,
start_level=None, start_base_url=None, max_level=5,
logging_level='WORKFLOW', disable_dl_verify=False,
logging_level='WORKFLOW',
dynamic_spinup=False, err_dmdtda_scaling_factor=1,
dynamic_spinup_start_year=1979,
continue_on_error=True):
Expand Down Expand Up @@ -157,8 +157,6 @@ def run_prepro_levels(rgi_version=None, rgi_reg=None, border=None,
the logging level to use (DEBUG, INFO, WARNING, WORKFLOW)
override_params : dict
a dict of parameters to override.
disable_dl_verify : bool
disable the hash verification of OGGM downloads
dynamic_spinup : str
include a dynamic spinup matching 'area/dmdtda' OR 'volume/dmdtda' at
the RGI-date
Expand Down Expand Up @@ -218,11 +216,6 @@ def _time_log():
# Set to True for operational runs
override_params['continue_on_error'] = continue_on_error

# Check for the integrity of the files OGGM downloads at run time
# For large files (e.g. using a 1 tif DEM like ALASKA) calculating the hash
# takes a long time, so deactivating this can make sense
override_params['dl_verify'] = not disable_dl_verify

# Do not use bias file if user wants melt_temp only
if mb_calibration_strategy in ['melt_temp', 'temp_melt']:
override_params['use_temp_bias_from_file'] = False
Expand Down Expand Up @@ -834,10 +827,6 @@ def parse_args(args):
parser.add_argument('--test-ids', nargs='+',
help='if --test, specify the RGI ids to run separated '
'by a space (default: 4 randomly selected).')
parser.add_argument('--disable-dl-verify', nargs='?', const=True,
default=False,
help='if used OGGM downloads will not be verified '
'against a hash sum.')
parser.add_argument('--disable-mp', nargs='?', const=True, default=False,
help='if you want to disable multiprocessing.')
parser.add_argument('--dynamic-spinup', type=str, default='',
Expand Down Expand Up @@ -909,7 +898,6 @@ def parse_args(args):
add_itslive_velocity=args.add_itslive_velocity,
add_millan_velocity=args.add_millan_velocity,
add_hugonnet_dhdt=args.add_hugonnet_dhdt,
disable_dl_verify=args.disable_dl_verify,
dynamic_spinup=dynamic_spinup,
err_dmdtda_scaling_factor=args.err_dmdtda_scaling_factor,
dynamic_spinup_start_year=args.dynamic_spinup_start_year,
Expand Down
2 changes: 1 addition & 1 deletion oggm/params.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use_tar_shapefiles = True
mpi_recv_buf_size = 131072

# Check for the integrity of the files OGGM downloads at run time
dl_verify = True
dl_verify = False

# Default number of files to be cached in the temporary directory
lru_maxsize = 100
Expand Down
4 changes: 4 additions & 0 deletions oggm/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ def setUp(self):
# Init
cfg.initialize()
cfg.PATHS['dl_cache_dir'] = self.dldir
cfg.PARAMS['dl_verify'] = True

# Read in the RGI file
rgi_file = utils.get_demo_file('rgi_oetztal.shp')
Expand Down Expand Up @@ -1873,6 +1874,9 @@ def prepare_verify_test(self, valid_size=True, valid_crc32=True,
return 'https://test.com/test.txt'

def test_dl_verify(self):

cfg.PARAMS['dl_verify'] = True

def fake_down(dl_func, cache_path):
assert False

Expand Down
5 changes: 1 addition & 4 deletions oggm/utils/_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,7 @@ def _verified_download_helper(cache_obj_name, dl_func, reset=False):
"""
path = _cached_download_helper(cache_obj_name, dl_func, reset)

try:
dl_verify = cfg.PARAMS['dl_verify']
except KeyError:
dl_verify = True
dl_verify = cfg.PARAMS.get('dl_verify', False)

if dl_verify and path and cache_obj_name not in cfg.DL_VERIFIED:
cache_section, cache_path = cache_obj_name.split('/', 1)
Expand Down

0 comments on commit 2e381f9

Please sign in to comment.