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

Error HTTP 404 not found #42

Open
elifrag opened this issue Apr 8, 2024 · 8 comments
Open

Error HTTP 404 not found #42

elifrag opened this issue Apr 8, 2024 · 8 comments

Comments

@elifrag
Copy link

elifrag commented Apr 8, 2024

Hello, I am trying to download a subset of data using the cms_download_subset() function but I keep getting the following error: "Failed to collect information from subset-job.
HTTP 404 Not Found."

I tried various datasets along with the one in your example but the error remains.

Can you suggest a fix?
Thank you
Eliza

@pepijn-devries
Copy link
Owner

Hi Eliza,

CopernicusMarine is transitioning to different services. It would seem that the cms_download_subset() is no longer available. The alternative service uses the ZARR format which is currently not well supported in R (see issue #34).

Unfortunately, I don't have a quick fix on short term. Alternatively, you can use cms_download_stac() to download full data sets. I'll try to report any progress in this area here

@elifrag
Copy link
Author

elifrag commented Apr 8, 2024

Thank you for your reply.
Much appreciated.

@sermomon
Copy link

I also got this error. Please report any progress....

@ruimgbarros
Copy link

ruimgbarros commented Apr 26, 2024

Hey! I did some workaround using the python version using reticulate. I'm leaving it here in case you want a solution.

library(reticulate)
install_python() 
virtualenv_create(envname = "something")
virtualenv_install("something", packages = c("copernicusmarine"))
use_virtualenv("something", required = TRUE)
py_install("copernicusmarine")

cm <- import("copernicusmarine")

result <- cm$subset(
  dataset_id = "cmems_mod_ibi_phy_anfc_0.027deg-2D_PT1H-m",
  start_datetime = start_date,
  end_datetime = end_date,
  variables = list("thetao"),
  minimum_longitude = -9.64671906997131,
  maximum_longitude = 7.364793639893833,
  minimum_latitude = 36.7143279919028,
  maximum_latitude = 41.884404655537004,
  force_download = TRUE,
)

It's not beautiful. But it will be the code I'll be using. I tried having a look at @pepijn-devries amazing work but I could't simply find a solution without using python this way.

@pepijn-devries
Copy link
Owner

Hey! I did some workaround using the python version using reticulate. I'm leaving it here in case you want a solution.

library(reticulate)
install_python() 
virtualenv_create(envname = "something")
virtualenv_install("something", packages = c("copernicusmarine"))
use_virtualenv("something", required = TRUE)
py_install("copernicusmarine")

cm <- import("copernicusmarine")

result <- cm$subset(
  dataset_id = "cmems_mod_ibi_phy_anfc_0.027deg-2D_PT1H-m",
  start_datetime = start_date,
  end_datetime = end_date,
  variables = list("thetao"),
  minimum_longitude = -9.64671906997131,
  maximum_longitude = 7.364793639893833,
  minimum_latitude = 36.7143279919028,
  maximum_latitude = 41.884404655537004,
  force_download = TRUE,
)

It's not beautiful. But it will be the code I'll be using. I tried having a look at @pepijn-devries amazing work but I could't simply find a solution without using python this way.

Thanks for sharing this workaround. For the time being I think this is the only way to get this to work in R. I'm still hopeful that this can be fixed in R in the future, without the need of Python. To be continued...

@linnetjessell
Copy link

Thanks for the workaround - I am trying to run it this way but getting the following error when it asks me for my Copernicus password:

password:Warning: Password input may be echoed.
Error in py_call_impl(callable, call_args$unnamed, call_args$named) :
RuntimeError: reentrant call inside <_io.BufferedReader name=''>

Can you please suggest a fix?
Thanks!

@pepijn-devries
Copy link
Owner

@linnetjessell The error you describe here seems to originate from the python package. I suggest you look for answers in that direction.

@ruimgbarros
Copy link

Hi @linnetjessell!

I'm sorry, on the code I posted I might have omitted the login process.

I've done it this way:


credentials_file <- os$path$expanduser("~/.copernicusmarine/.copernicusmarine-credentials")
if (os$path$exists(credentials_file)) {
  os$remove(credentials_file)
}

cm$login(user, pwd)

Obviously user and pwd are the login details. What I'm doing there is to check if the file where the credentials should be stored exists and, if it does, deletes them and create a new one. (Theoretically only the last line of code should work, but I think you have already tried).

I hope it helps! :)

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

No branches or pull requests

5 participants