Skip to content

Commit

Permalink
update task order in dfmt.download.copernicusmarine_reset() (#833)
Browse files Browse the repository at this point in the history
* update task order in dfmt.download.copernicusmarine_reset()

* updated whatsnew.md
  • Loading branch information
veenstrajelmer authored May 1, 2024
1 parent e3b8952 commit c5bf9e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 4 additions & 4 deletions dfm_tools/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,17 +327,17 @@ def copernicusmarine_credentials():
raise InvalidUsernameOrPassword("Invalid credentials, please try again")


def copernicusmarine_reset(remove_folder=False, overwrite_cache=True, update_package=False):
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")
if update_package:
print("reset copernicusmarine: updating copernicusmarine")
subprocess.check_call(f"{sys.executable} -m pip install copernicusmarine -U")


def copernicusmarine_dataset_timerange(dataset_id):
Expand Down
10 changes: 8 additions & 2 deletions docs/whats-new.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## UNRELEASED

### Fix
- improved `dfmt.download.copernicusmarine_reset()` by changing order of tasks in [#833](https://github.com/Deltares/dfm_tools/pull/833)


## 0.22.0 (2024-04-09)

### Feat
Expand All @@ -15,8 +21,8 @@
## 0.21.0 (2024-03-14)

### Feat
- added ddl/rws insitu data to `dfmt.ssh_catalog_subset()` and `dfmt.ssh_retrieve_data()` by [@veenstrajelmer](https://github.com/veenstrajelmer) in [#791](https://github.com/Deltares/dfm_tools/pull/791) and [#796](https://github.com/Deltares/dfm_tools/pull/796)
- added cmems nrt insitu data to `dfmt.ssh_catalog_subset()` and `dfmt.ssh_retrieve_data()` by [@veenstrajelmer](https://github.com/veenstrajelmer) in [#791](https://github.com/Deltares/dfm_tools/pull/791) and [#793](https://github.com/Deltares/dfm_tools/pull/793)
- added ddl/rws insitu data to `dfmt.ssh_catalog_subset()` and `dfmt.ssh_retrieve_data()` in [#791](https://github.com/Deltares/dfm_tools/pull/791) and [#796](https://github.com/Deltares/dfm_tools/pull/796)
- added cmems nrt insitu data to `dfmt.ssh_catalog_subset()` and `dfmt.ssh_retrieve_data()` in [#791](https://github.com/Deltares/dfm_tools/pull/791) and [#793](https://github.com/Deltares/dfm_tools/pull/793)
- support for meshkernel>=4.1.0 in [#801](https://github.com/Deltares/dfm_tools/pull/801)


Expand Down

0 comments on commit c5bf9e9

Please sign in to comment.