Skip to content

Commit

Permalink
Merge pull request #25 from afredston/master
Browse files Browse the repository at this point in the history
fixing NWFSC URLs
  • Loading branch information
James-Thorson-NOAA authored Aug 22, 2020
2 parents d3d5031 + f6159c7 commit ee40132
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/download_catch_rates.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ download_catch_rates = function( survey="Eastern_Bering_Sea", add_zeros=TRUE, sp
"latitude_dd", "longitude_dd", "centroid_id", "area_swept_ha_der",
"cpue_kg_per_ha_der", "cpue_numbers_per_ha_der",
"vessel_id", "project", "actual_station_design_dim$mean_depth_m", "blank")
URLbase <- "https://www.nwfsc.noaa.gov/data/api/v1/source/trawl.catch_fact/selection.json?filters=project=Groundfish%20Slope%20and%20Shelf%20Combination%20Survey,performance=Satisfactory,"
URLbase <- "https://www.webapps.nwfsc.noaa.gov/data/api/v1/source/trawl.catch_fact/selection.json?filters=project=Groundfish%20Slope%20and%20Shelf%20Combination%20Survey,performance=Satisfactory,"

# Loop through download pieces
Downloaded_data = NULL
if( is.null(localdir) | !file.exists(paste0(localdir,"/WCGBTS_download.RData")) ){
for(i in 1:length(files)){
# Download and unzip
Url_text = paste0(URLbase,"date_dim$year=",files[i],"&variables=",paste0(Vars,collapse=","))
message("Downloading all WCGBTS catch-rate data for ",files[i]," from NWFSC database: https://www.nwfsc.noaa.gov/data/")
message("Downloading all WCGBTS catch-rate data for ",files[i]," from NWFSC database: https://www.webapps.nwfsc.noaa.gov/data/")
Data_tmp = jsonlite::fromJSON( Url_text )

Data_tmp <- remove_header_rows(Data_tmp)
Expand Down Expand Up @@ -145,15 +145,15 @@ download_catch_rates = function( survey="Eastern_Bering_Sea", add_zeros=TRUE, sp
"latitude_dd", "longitude_dd", "area_swept_ha_der",
"cpue_kg_per_ha_der", "cpue_numbers_per_ha_der",
"vessel_id", "project", "actual_station_design_dim$mean_depth_m", "blank")
URLbase <- "https://www.nwfsc.noaa.gov/data/api/v1/source/trawl.catch_fact/selection.json?filters=project=Groundfish%20Triennial%20Shelf%20Survey,performance=Satisfactory,"
URLbase <- "https://www.webapps.nwfsc.noaa.gov/data/api/v1/source/trawl.catch_fact/selection.json?filters=project=Groundfish%20Triennial%20Shelf%20Survey,performance=Satisfactory,"

# Loop through download pieces
Downloaded_data = NULL
if( is.null(localdir) | !file.exists(paste0(localdir,"/WCT_download.RData")) ){
for(i in 1:length(files)){
# Download and unzip
Url_text = paste0(URLbase,"date_dim$year=",files[i],"&variables=",paste0(Vars,collapse=","))
message("Downloading all WCT catch-rate data for ",files[i]," from NWFSC database: https://www.nwfsc.noaa.gov/data/")
message("Downloading all WCT catch-rate data for ",files[i]," from NWFSC database: https://www.webapps.nwfsc.noaa.gov/data/")
Data_tmp = jsonlite::fromJSON( Url_text )

Data_tmp <- remove_header_rows(Data_tmp)
Expand Down Expand Up @@ -193,8 +193,8 @@ download_catch_rates = function( survey="Eastern_Bering_Sea", add_zeros=TRUE, sp
Downloaded_data = NULL
if( is.null(localdir) | !file.exists(paste0(localdir,"/WCGHL_download.RData")) ){
# Download and unzip
Url_text = paste0("https://www.nwfsc.noaa.gov/data/api/v1/source/hooknline.catch_hooknline_view/selection.json?variables=",paste0(Vars,collapse=","))
message("Downloading all WCGHL catch-rate data from NWFSC database: https://www.nwfsc.noaa.gov/data/")
Url_text = paste0("https://www.webapps.nwfsc.noaa.gov/data/api/v1/source/hooknline.catch_hooknline_view/selection.json?variables=",paste0(Vars,collapse=","))
message("Downloading all WCGHL catch-rate data from NWFSC database: https://www.webapps.nwfsc.noaa.gov/data/")


Downloaded_data = jsonlite::fromJSON( Url_text )
Expand Down

0 comments on commit ee40132

Please sign in to comment.