diff --git a/dfm_tools/download.py b/dfm_tools/download.py index 699d9235..979f7476 100644 --- a/dfm_tools/download.py +++ b/dfm_tools/download.py @@ -351,8 +351,8 @@ def copernicusmarine_get_buffer(dataset_id): resolution = ds.latitude.attrs["step"] buffer = 2 * resolution except (AttributeError, KeyError, TypeError): - print("failed to automatically derive a buffer from the dataset, using buffer=0") - buffer = 0 + print("failed to automatically derive a buffer from the dataset, using buffer=0.5") + buffer = 0.5 return buffer diff --git a/tests/test_download.py b/tests/test_download.py index 9283641e..7785616d 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -14,6 +14,7 @@ cds_set_credentials_rcfile, cds_remove_credentials_raise, copernicusmarine_credentials, + copernicusmarine_get_buffer, ) import dfm_tools as dfmt import xarray as xr @@ -165,6 +166,14 @@ def test_copernicusmarine_credentials(): copernicusmarine_credentials() +@pytest.mark.requiressecrets +@pytest.mark.unittest +def test_copernicusmarine_get_buffer_notfound(): + dataset_id = 'cmems_obs-oc_glo_bgc-transp_my_l3-multi-4km_P1D' + buffer = copernicusmarine_get_buffer(dataset_id) + assert buffer == 0.5 + + @pytest.mark.requiressecrets @pytest.mark.unittest def test_download_cmems_my(tmp_path):