Skip to content

Commit

Permalink
removed redundant copernicusmarine functions
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Jan 15, 2025
1 parent bc31d1b commit 971021a
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions dfm_tools/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def download_CMEMS(varkey,
"""
https://help.marine.copernicus.eu/en/articles/8283072-copernicus-marine-toolbox-api-subset
"""
copernicusmarine_remove_manual_credentials_file()
copernicusmarine_credentials()

# We floor/ceil the input timestamps to make sure we
Expand Down Expand Up @@ -370,12 +369,6 @@ def copernicusmarine_get_buffer(dataset_id):
return buffer


def copernicusmarine_remove_manual_credentials_file():
cmems_file_old = os.path.expanduser("~/CMEMS_credentials.txt")
if os.path.isfile(cmems_file_old):
os.remove(cmems_file_old)


def copernicusmarine_credentials():
"""
Login at copernicusmarine if user not logged in yet.
Expand All @@ -394,19 +387,6 @@ def copernicusmarine_credentials():
raise InvalidUsernameOrPassword("Invalid credentials, please try again")


def copernicusmarine_reset(update_package=False, remove_folder=False, overwrite_cache=True):
if update_package:
print("reset copernicusmarine: updating copernicusmarine")
subprocess.check_call(f"{sys.executable} -m pip install copernicusmarine -U")
if remove_folder:
dir_copernicusmarine = os.path.expanduser("~/.copernicusmarine")
print(f"reset copernicusmarine: removing {dir_copernicusmarine}, you will have to login again.")
shutil.rmtree(dir_copernicusmarine, ignore_errors=True)
if overwrite_cache:
print("reset copernicusmarine: overwriting copernicusmarine metadata cache (takes some time)")
subprocess.run("copernicusmarine describe --overwrite-metadata-cache")


def copernicusmarine_dataset_timerange(dataset_id):
ds = copernicusmarine.open_dataset(
dataset_id=dataset_id,
Expand Down

0 comments on commit 971021a

Please sign in to comment.