Skip to content

Commit

Permalink
fix: check if dataset id set for subset
Browse files Browse the repository at this point in the history
  • Loading branch information
renaudjester committed Jul 15, 2024
1 parent 606d05a commit 785d7df
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions copernicusmarine/core_functions/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ def subset_function(
subset_request = SubsetRequest(dataset_id=dataset_id or "")
if request_file:
subset_request.from_file(request_file)
if not subset_request.dataset_id:
raise ValueError("Please provide a dataset id for a subset request.")
if motu_api_request:
motu_api_subset_request = convert_motu_api_request_to_structure(
motu_api_request
Expand Down Expand Up @@ -118,6 +116,8 @@ def subset_function(
"netcdf3_compatible": netcdf3_compatible,
}
subset_request.update(request_update_dict)
if not subset_request.dataset_id:
raise ValueError("Please provide a dataset id for a subset request.")
username, password = get_and_check_username_password(
username,
password,
Expand All @@ -137,8 +137,6 @@ def subset_function(
subset_request.end_datetime,
]
):
if not subset_request.dataset_id:
raise SyntaxError("Must specify 'dataset_id' option")
logger.info(
"To retrieve a complete dataset, please use instead: "
f"copernicusmarine get --dataset-id {subset_request.dataset_id}"
Expand Down

0 comments on commit 785d7df

Please sign in to comment.