ERDDAP / erddap

ERDDAP is a scientific data server that gives users a simple, consistent way to download subsets of gridded and tabular scientific datasets in common file formats and make graphs and maps. ERDDAP is a Free and Open Source (Apache and Apache-like) Java Servlet from NOAA NMFS SWFSC Environmental Research Division (ERD).
Creative Commons Zero v1.0 Universal
78 stars 57 forks source link

Time issue erddap cache vs on disk. #62

Closed thogar-computer closed 2 years ago

thogar-computer commented 2 years ago

Hiya all, not sure if this is my misuse of a feature or a bug?

Issue

The address https://linkedsystems.uk/erddap/tabledap/ea_sea_level_e72224_e229_390e_c509.htmlTable?&time=max(time) resulted in a error of;

{
    code=404;
    message="Not Found: Your query produced no matching results. (No data matches time=\"1.6341291E9\" because the String variable's source min=\"2020-10-30T13:15:00Z\", max=\"2021-10-13T12:30:00Z\", and hasNaN=false.)";
}

https://linkedsystems.uk/erddap/tabledap/ea_sea_level_e72224_e229_390e_c509.htmlTable?&time=max(time)+0minutes gave the same error.

interestingly the address https://linkedsystems.uk/erddap/tabledap/ea_sea_level_e72224_e229_390e_c509.htmlTable?&time=max(time)+1minutes shows an error with formatted time, and states that the requested time is outside of the range for this datatset.

{
    code=404;
    message="Not Found: Your query produced no matching results. (time=2021-10-13T12:46:00Z is outside of the variable's actual_range: 2020-10-30T13:15:00Z to 2021-10-13T12:45:00Z)";
}

The following address https://linkedsystems.uk/erddap/tabledap/ea_sea_level_e72224_e229_390e_c509.htmlTable?&time%3Cmax(time) shows all data.

and if i make time a variable like so https://linkedsystems.uk/erddap/tabledap/ea_sea_level_e72224_e229_390e_c509.htmlTable?time&time=max(time) the page worked.

Issue found

After some more digging it turns out that the erddap metadata was very slightly out of date with what was on disk. i.e the max time value was in fact 2021-10-13T12:45:00Z and as can be seen from the error reported the erddap max range was 2021-10-13T12:30:00Z. Resulting in the URL erroring out.

questions

BobSimons commented 2 years ago

The initial link in your request works for me right now. If I submit this similar request https://linkedsystems.uk/erddap/tabledap/ea_sea_level_e72224_e229_390e_c509.htmlTable?stationID%2CinstrumentID%2Ctime%2Clatitude%2Clongitude%2Csea_water_level_local_datum&time=max(time) it works.

Don't do "+0minutes". What's the point?

Don't do "+1minutes". What's the point? That is doomed to failure.

"if i make time a variable like so https://linkedsystems.uk/erddap/tabledap/ea_sea_level_e72224_e229_390e_c509.htmlTable?time&time=max(time) the page works." Huh? time is already a variable. Adding "time" to your original request just says that you only want time data in the response.

"Why isn't the time formatted in the first error message?" It is formatted as "seconds since 1970-01-01T00:00:00Z" which is how it is dealing with the request. You're using an older version of ERDDAP. I think newer versions of ERDDAP format it as an ISO 8601 String (at least in some error messages). It's never good to submit a bug report against an older version of ERDDAP.

"Should a request containing a + or > on a max variable be a 400 error?" "time=max(time)+1minute" is doomed to failure. "time>max(time)" is (generally) doomed to failure.

"I am not entirely sure why naming the variable (in this case time) changes the behaviour between requests?" "naming": Huh? But it could be that the first request leads to an updated "max(time)" so the second request succeeds (even if it had been identical to the first request).

Having said all that, there is the possibility that there is a problem. I'm not ruling it out. It would be nice to know

Please upgrade to the latest ERDDAP, try to reproduce the error, and tell me more details about the dataset.