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

remove cmems registration message #997

Closed
veenstrajelmer opened this issue Sep 18, 2024 · 0 comments · Fixed by #1046
Closed

remove cmems registration message #997

veenstrajelmer opened this issue Sep 18, 2024 · 0 comments · Fixed by #1046

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Sep 18, 2024

After simplifications of copernicusmarine_credentials(), it always displays a register text, even if the user is already logged in. This is slightly inconvenient, since it is called every time a single station is downloaded by dfmt.ssh_retrieve_data():

To reproduce:

import dfm_tools as dfmt
import matplotlib.pyplot as plt
plt.close("all")

lon_min, lon_max, lat_min, lat_max = 5, 20, 25, 50 # europe
subset_kwargs = dict(lon_min=lon_min, lon_max=lon_max, lat_min=lat_min, lat_max=lat_max, 
                     # time_min=time_min, time_max=time_max
                     )

subset_gpd = dfmt.ssh_catalog_subset(source="cmems-nrt", **subset_kwargs)
bool_rmn = subset_gpd["station_id"].str.startswith("RMN-")
subset_gpd = subset_gpd.loc[bool_rmn]

fig,ax = plt.subplots(figsize=(12,7))
source = subset_gpd.iloc[0]["source"]
nstations = len(subset_gpd)
subset_gpd.geometry.plot(ax=ax, marker="x", label=f"{source} ({nstations} obs)")
dfmt.plot_coastlines()

dfmt.ssh_retrieve_data(subset_gpd, dir_output=r"c:\Users\veenstra\Downloads\cmems-nrt_insitu")

Prints:

Downloading CMEMS data requires a Copernicus Marine username and password, sign up for free at: https://data.marine.copernicus.eu/register.
INFO - 2024-09-18T09:19:51Z - You are already logged in. Skipping login.
INFO - 2024-09-18T09:19:52Z - Dataset version was not specified, the latest one was selected: "202311"
INFO - 2024-09-18T09:19:52Z - Dataset part was not specified, the first one was selected: "latest"
INFO - 2024-09-18T09:19:52Z - You forced selection of service: original-files
INFO - 2024-09-18T09:19:52Z - Downloading using service original-files...
100%|██████████| 4/4 [00:27<00:00,  6.97s/it]
>> reading coastlines: 3.07 sec
retrieving data for 36 cmems-nrt stations: 1 Downloading CMEMS data requires a Copernicus Marine username and password, sign up for free at: https://data.marine.copernicus.eu/register.
INFO - 2024-09-18T09:20:26Z - You are already logged in. Skipping login.
2 Downloading CMEMS data requires a Copernicus Marine username and password, sign up for free at: https://data.marine.copernicus.eu/register.
3 Downloading CMEMS data requires a Copernicus Marine username and password, sign up for free at: https://data.marine.copernicus.eu/register.
4 Downloading CMEMS data requires a Copernicus Marine username and password, sign up for free at: https://data.marine.copernicus.eu/register.
5 Downloading CMEMS data requires a Copernicus Marine username and password, sign up for free at: https://data.marine.copernicus.eu/register.
6 Downloading CMEMS data requires a Copernicus Marine username and password, sign up for free at: https://data.marine.copernicus.eu/register.
7 Downloading CMEMS data requires a Copernicus Marine username and password, sign up for free at: https://data.marine.copernicus.eu/register.
8 Downloading CMEMS data requires a Copernicus Marine username and password, sign up for free at: https://data.marine.copernicus.eu/register.

If copernicusmarine would include a registration link in their login function (mercator-ocean/copernicus-marine-toolbox#139), we could remove the print from dfm_tools. This will be available from copernicusmarine>=2.0.0 onwards.

@veenstrajelmer veenstrajelmer changed the title suppress cmems registering message suppress cmems registration message Sep 18, 2024
@veenstrajelmer veenstrajelmer changed the title suppress cmems registration message remove cmems registration message Sep 20, 2024
This was referenced Sep 20, 2024
@veenstrajelmer veenstrajelmer linked a pull request Jan 8, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant