`get_dataset` returns error when gpid is a vector
andydawson opened this issue · 5 comments
When I run
GPID = c(7383, 7467, 9227)
meta = get_dataset(datasettype='pollen', gpid=GPID, ageold=2000)
I get
Error: Server returned an error message:
Arithmetic operation resulted in an overflow.
Stack Trace:
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(Object Value)
at SpatialIT.CEI.Neotoma.GetRequestHandler.Datasets(HttpRequest& request, DB& myDb, String id, HttpApplicationState Application) in C:\Users\mikea\Documents\Visual Studio 2012\Projects\CEI\Neotoma\APIs\NeotomaDataAPI\GetRequestHandler.vb:line 745
at SpatialIT.CEI.Neotoma.GetRequestHandler.ProcessRequest(HttpContext context) in C:\Users\mikea\Documents\Visual Studio 2012\Projects\CEI\Neotoma\APIs\NeotomaDataAPI\GetRequestHandler.vb:line 80
But when I called get_dataset()
with gpid=GPID[1]
it works as expected.
Not a big deal, but thought I'd make a note regardless so we can catch and warn when we get around to it.
We ought to think about handling errors from the server more generally too.
Is this particular issue an error on our end (i.e. how we are using the API), or is this a bug in the API/server code? "Arithmetic operation resulted in an overflow
" sounds like something that shouldn't happen at all on the server end.
Right now the default is to exit the function and return the server
message, which is exactly what's happening. I think we can add an extra
message that points to the neotoma bitbucket repository and issues page to
raise the problem.
The problem in this particular case is that it appears that the gpid
can
accept one or two values but not three. I'm not sure why.
I've raised the issue in the neotomaapi account:
https://bitbucket.org/neotomadb/neotomaapi/issue/1/dataset-gpid-error-with-three-gpids
Simon
On Mon, Jul 6, 2015 at 1:10 PM, Gavin Simpson notifications@github.com
wrote:
We ought to think about handling errors from the server more generally too.
Is this particular issue an error on our end (i.e. how we are using the
API), or is this a bug in the API/server code? "Arithmetic operation
resulted in an overflow" sounds like something that shouldn't happen at
all on the server end.—
Reply to this email directly or view it on GitHub
#195 (comment).
Perhaps related, if I try
get_geochron(get_site(gpid=130)) I get an error message:
Error: Server returned an error message:
Object reference not set to an instance of an object.
Stack Trace:
at SpatialIT.CEI.Neotoma.GetRequestHandler.Sites(HttpRequest& request, DB& myDb, HttpApplicationState& Application) in C:\Users\mikea\Documents\Visual Studio 2012\Projects\CEI\Neotoma\APIs\NeotomaDataAPI\GetRequestHandler.vb:line 635
at SpatialIT.CEI.Neotoma.GetRequestHandler.ProcessRequest(HttpContext context) in C:\Users\mikea\Documents\Visual Studio 2012\Projects\CEI\Neotoma\APIs\NeotomaDataAPI\GetRequestHandler.vb:line 77
This happens with most country gpids. Belgium does OK: get_geochron(get_site(gpid=513))
I am pretty sure that's the error that gets thrown when a gpid has no
sites. That's why Belgium does okay. @Maarten14C Are there any gpids
where you know that there are pollen sites but you get that error?
On Mon, Aug 24, 2015 at 5:51 AM, Maarten14C notifications@github.com
wrote:
Perhaps related, if I try
get_geochron(get_site(gpid=130)) I get an error message:
Error: Server returned an error message:Object reference not set to an instance of an object.
Stack Trace:
at SpatialIT.CEI.Neotoma.GetRequestHandler.Sites(HttpRequest& request, DB&
myDb, HttpApplicationState& Application) in C:\Users\mikea\Documents\Visual
Studio
2012\Projects\CEI\Neotoma\APIs\NeotomaDataAPI\GetRequestHandler.vb:line 635at SpatialIT.CEI.Neotoma.GetRequestHandler.ProcessRequest(HttpContext
context) in C:\Users\mikea\Documents\Visual Studio
2012\Projects\CEI\Neotoma\APIs\NeotomaDataAPI\GetRequestHandler.vb:line 77This happens with most country gpids. Belgium does OK:
get_geochron(get_site(gpid=513))—
Reply to this email directly or view it on GitHub
#195 (comment).
The latest version of neotoma
appears to solve the problem @andydawson raised originally (or at least her code returns 252 sites now:
> GPID = c(7383, 7467, 9227)
> meta = get_dataset(datasettype='pollen', gpid=GPID, ageold=2000)
The API call was successful, you have returned 252 records.
For @Maarten14C 's bug, where an error is raised for empty datasets, the function appears to work now. The inner search returns zero sites (as expected) and provides a message that indicates no sites were returned (see below), and then errors because it can't provide a datasetid
.
> get_geochron(get_site(gpid=130))
The API call was successful, but no records were returned.
Error in get_geochron.default(get_site(gpid = 130)) :
datasetid must be numeric.
Closing this issue.