Gmtwich should allow me to download this url?

I run the following command to download data from and it didnt’t work. If a copy the URL in a browser it works. Am I doing something wrong? Is it a bug?

gmt which -G > file.txt ""

I get the error:

gmtwhich [ERROR]: Libcurl Error: HTTP response code said error

With the following URL gmtwhich works
gmt which -G > file.txt ""

I am using GMT 6.1.1 in Win64.

& has special meanings on Linux, so I have to enclose the URL using single quotes on Linux:

gmt which -G ''

The above command can download the file correctly, but it also gives me an error:

gmtwhich [ERROR]: File query.csv?starttime=2017-09-01%2000:00:00&endtime=2017-10-01%2000:00:00&minmagnitude=3&orderby=magnitude not found

Looks like a bug to me.

Thanks. @pwessel @Joaquim what do you think?

Ping @pwessel and @Joaquim to check if it’s a bug.

Yes, while the download works as intended (query.cvs saved in current directory) I do get the same error message. Sigh, will look - too many incoming errors on the same day that I have faculty meeting to prep for…

If I paste the URL in the browser, I get an error

Error 400: Bad Request

Bad orderby value "magnitude'". Valid values are: "time", "time-asc", "magnitude", "magnitude-asc".

so this must be solved first to download the file.

EDIT: Sorry, I had an extra quote at the end of string. Correcting that, the file is downloadable.

The error message explains what is happening

gmtwhich [ERROR]: File query.csv?starttime=2017-09-01%2000:00:00&endtime=2017-10-01%2000:00:00&minmagnitude=3&orderby=magnitude

I didn’t investigate how it finds the beginning of the file name (probably, starts looking after last /) but it clearly does not know where it ends (how could it generically know it?). It worked silently for the cpt case because the file name was the last thing in the URL string.

I have made some changes in that code the last months(s) and this is a regression of sorts. The ? is used by both URLS and netCDF layers and once I have time to debug I will fix this.

By the way, Is there any way (within GMT) to define the name of the file downloaded?