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

set default buffer to 0.5 including test #1009

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dfm_tools/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
9 changes: 9 additions & 0 deletions tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
Loading