James-Thorson/FishData

Error with WCGBTS

AquaAuma opened this issue · 4 comments

I get an error when I run the following line (only for the WCGBTS survey):
WCGBTS = download_catch_rates( survey="WCGBTS", species_set=Sci_name, localdir=DataFile )

Data are downloaded and then I get this error message:
Error in Data_tmp[, year_column] : incorrect number of dimensions

Any idea where this might come from?
Thanks

I'm sorry but I don't really have time to maintain this code. Looking at the issue, I'm guessing that I accepted a pull request from someone changing the code for subfunction remove_header_rows, to fix an issue with another region, and it broke funcitonality for West Coast data.

I'd love for someone to volunteer to make an "integrated test" that loops through regions and confirms its working for each, to use periodically and/or when checking pull requests. Until that's in place, I doubt I will spend time fixing issues except for my own personal uses.

Hopefully its still useful for showing where data live online.

Here's what's going on, I think. In download_catch_rates.R, the West Coast annual survey has been updated to:

    files = 2003:2019

However the 2019 data does not exist in the data source yet, so it returns an empty object when trying to fetch that year's dataset, and throws an error. @James-Thorson-NOAA can I submit a PR to change it back to 2003:2018 for now (or do you just want to make the change)?

UPDATE: there's also a minor issue with add_missing_zeros and WCGBTS where using if_multiple_records="Combine" some of the summed differences exceed the default error_tol, e.g., Merluccius productus:

Species to include: Merluccius productus
Number of samples to include for each species: 10520
Finished processing for Merluccius productus
Error: missing rows in new data frame
>         message("Total count in original: ", formatC(sum(data_frame[Which,sample_colname], na.rm=TRUE),format="f",digits=2) )
Total count in original: 92874.02
>         message("Total count in new: ", formatC(sum(new_data_frame[,sample_colname], na.rm=TRUE),format="f",digits=2) )
Total count in new: 92874.00

Users can resolve this issue by running download_catch_rates(survey='West_coast_groundfish_bottom_trawl_survey', error_tol=0.1).

@AquaAuma let me know if this resolves your issue, happy to help troubleshoot further.

Thank you Alexa for finding out the problem
I modified the function 'download_catch_rates' but hand on R, and changed files=2003:2019 to files=2003:2018 and it worked!