GlobalFishingWatch / gfwr

R package for accessing data from Global Fishing Watch APIs

Home Page:https://globalfishingwatch.github.io/gfwr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get_raster returns error for region_source 'user_json' and 'mpa'

jflowernet opened this issue · comments

Hey,
First up, thanks for making gfwr, I'm excited to try it out!

I've been trying to run get_raster for a custom region using region_source = 'user_json', but get the following error:

Error in `abort()`:
! `message` must be a character vector, not a list.

I get this even using the example directly copied from the readme, and @gmcdonald-sfg found that the error also occurs for the region_source = 'mpa' example. Using region_source = 'eez' and region_source = 'trfmo' works fine though. Seems like there was a similar problem previously in #68

@jflowernet Thanks for the feedback. There was just an update to the API that restricts the time range of requests the using get_raster function to one year or less and we haven't had a chance to update the README or uncover why an informative error from the API is not being returned to the gfwr user.

Can you try the same example query but restrict the time range to less than 1 year (see example below) and see if that fixes your issue?

get_raster(spatial_resolution = 'low',
           temporal_resolution = 'yearly',
           group_by = 'flag',
           date_range = '2021-01-01,2021-10-01',
           region = region_json,
           region_source = 'user_json',
           key = key)

Thanks @natemiller , restricting the time range to <1 year works. I tried incrementing and sure enough it returns the error once I go above the 1 year mark.

I appreciate the speedy feedback. Happy to close this now unless you want to leave it open as a prompt to dig into the lack of informative error message?

Thanks @jflowernet ! We still need to figure out the informative error source and fix it, but now we updated the README to explain that a time range of less than a year should be specified.

The issue appears to still come up when using region_source = 'trfmo' even if using a short time frame. I am guessing this is due to the larger spatial range.