PlanktonTeam / planktonr

r Package for the analysis and visualisation of plankton data
https://planktonteam.github.io/planktonr/
Other
4 stars 1 forks source link

`pr_match_Altimetry` crashes when data not found #170

Closed jaseeverett closed 1 year ago

jaseeverett commented 2 years ago

When running the example for pr_match_Altimetry using 100 observations, it crashes. I suspect it is related to one of the date/lat/lon combinations not being found. When I run the code using only 10 obs, it works correctly.

df <- head(pr_get_DataLocs("NRS"), 10)
res_spat <- 10
altout <- pr_match_Altimetry(df, pr = "GSLA")

The error is:

oc_open: server error retrieving url: code=400 message="Unrecognized request"oc_open: server error retrieving url: code=400 message="Unrecognized request"
 Error in UseMethod("xml_find_all") : 
no applicable method for 'xml_find_all' applied to an object of class "NULL"
jaseeverett commented 1 year ago

The crash has been fixed however there are 3 additional things which should be addressed

jaseeverett commented 1 year ago

I'm happy to work on these issues if you prefer @clairedavies

jaseeverett commented 1 year ago

Also noted that the examples now fail, even using head(df, 5) because the first 5 are after 2019. Need to add a catch for when no data is prior to 2020

clairedavies commented 1 year ago

Done - caused because no data was returned, now all records are returned with NaN where necessary, trycatch and if statement combination used to prevent error message appearing in trycatch function even though the function was actually working.