EarthScope / portable-fdsnws-dataselect

A portable fdsnws-dataselect server implementation
https://earthscope.github.io/portable-fdsnws-dataselect/
Apache License 2.0
8 stars 7 forks source link

Query error with start=YYYY-MM-DDT00:00:00 #32

Open arandrieu opened 1 year ago

arandrieu commented 1 year ago

Queries with starting time parameter at YYYY-MM-DDT00:00:00.000000 do not work and return a ms_readms_r error -2. With a starting time at YYYY-MM-DDT00:00:00.000001, it works as expected.

This issue could be reproduced with different Python versions:

Below, the corresponding entries found in the log files.

2023-03-02 16:05:38 - INFO - 127.0.0.1 "GET /fdsnws/dataselect/1/query?start=2023-01-31T00:00:00.000000&end=2023-01-31T00:01:00.000000 HTTP/1.1" 500 - 2023-03-02 16:05:38 - ERROR - Code:500 Error:Error -2 in ms_readmsr_r Request:/fdsnws/dataselect/1/query?start=2023-01-31T00:00:00.000000&end=2023-01-31T00:01:00.000000

2023-03-02 16:08:15 - INFO - 127.0.0.1 "GET /fdsnws/dataselect/1/query?start=2023-01-31T00:00:00.000001&end=2023-01-31T00:01:00.000000 HTTP/1.1" 200 - 2023-03-02 16:08:19 - INFO - shipped 68612096 bytes for request /fdsnws/dataselect/1/query?start=2023-01-31T00:00:00.000001&end=2023-01-31T00:01:00.000000 in 4 seconds

chad-earthscope commented 1 year ago

Thanks for your report @arandrieu.

Unfortunately I could not duplicate your observation. I created a small data set including that time range and submitted a query using your exact time specification resulting in the following query:

2023-03-10 19:19:25 - DEBUG - GET: /fdsnws/dataselect/1/query?nodata=404&net=IU&starttime=2023-01-31T00:00:00.000000&endtime=2023-01-31T00:01:00.000000

This resulted in no errors and data returned to the client. I tried many variations.

Oddly, the return value of -2 from ms_readmsr_r() indicates that the data read by libmseed were not identified as miniSEED. Certainly unexpected, since presumably mseedindex read and indexed these data.

I am using ObsPy 1.3.0. Can you provide more details of your setup, such as the data organizations, ObsPy version. If you could enable DEBUG level logging and provide the server log file that may help as well.

arandrieu commented 1 year ago

Thank you for your answer @chad-earthscope.

I think I understood the cause of the query error.

I have 2 data samples corresponding to my starting time YYYY-MM-DDT00:00:00.000000

When I remove the last sample of the first file, the query works fine and I get the data without getting any error.

The error is only returned setting the starting time at that particular time, with 1 µs more (or less) the query works well.