|
|
|
|
|
|
|
|
|
|
|
|
| require(data.table)
|
| require(sf)
|
|
|
| gridsz <- 0.25
|
|
|
|
|
| grid <- readRDS('temp/SPsf2.rds')
|
| eez <- st_read('dataDL/marineregions/World_EEZ_v10_20180221/eez_v10.shp')
|
| coast <- st_read('dataDL/natcap/Marine/Land/global_polyline.shp')
|
|
|
|
|
| indsCAN <- st_intersects(eez[eez$Pol_type == '200NM' & eez$Territory1 == 'Canada',], grid, sparse = FALSE)
|
| grid$region <- NA
|
|
|
|
|
|
|
| grid$region[grid$lat > 35.6 & grid$lat < 45 & grid$lon > - 100 & grid$lon < -60 & !indsCAN] <- 'neus'
|
|
|
|
|
| grid$region[(indsCAN & grid$lon > -100 & (grid$lon > -53 | (grid$lat > 49 & grid$lon > -57) | (grid$lat > 52) | (grid$lat > 47.8 & grid$lon > -54) | (grid$lat > 47 & grid$lon > -53.5))) | (grid$lon > -53 & grid$lon < -40)] <- 'newf'
|
|
|
|
|
| grid$region[(indsCAN & is.na(grid$region) & grid$lon > -100) | (grid$lat > 44 & grid$lat < 48 & grid$lon > -57.2 & grid$lon < -55)] <- 'maritime'
|
|
|
|
|
| grid$region[(grid$lon > -80.6 | (grid$lon > -82.3 & grid$lat > 28)) & grid$lat <= 35.6] <- 'seus'
|
|
|
|
|
| grid$region[grid$lon > -100 & grid$lat < 31 & is.na(grid$region)] <- 'gmex'
|
|
|
|
|
| grid$region[grid$lon < -100 & grid$lat < 50 & !indsCAN] <- 'wc'
|
|
|
|
|
| grid$region[grid$lon < -100 & indsCAN] <- 'bc'
|
|
|
|
|
| grid$region[grid$lon < -100 & grid$lon > -156 & is.na(grid$region)] <- 'goa'
|
|
|
|
|
| grid$region[grid$lon <= -156 | grid$lon > 0] <- 'ebs'
|
|
|
|
|
| sum(is.na(grid$region))
|
| with(grid[is.na(grid$region), ], plot(lon, lat, cex=0.1))
|
|
|
|
|
| grid$latgrid <- floor(grid$lat/gridsz)*gridsz + gridsz/2
|
| grid$longrid <- floor(grid$lon/gridsz)*gridsz + gridsz/2
|
| gridcmsp <- as.data.table(grid)[, .(region = names(sort(table(region), decreasing = TRUE))[1], nregion = length(unique(region))), by = c('latgrid', 'longrid')]
|
|
|
|
|
| gridcmsp[region == 'newf', plot(longrid, latgrid, cex=0.1)]
|
| gridcmsp[region == 'maritime', plot(longrid, latgrid, cex=0.1)]
|
| gridcmsp[region == 'neus', plot(longrid, latgrid, cex=0.1)]
|
| gridcmsp[region == 'seus', plot(longrid, latgrid, cex=0.1)]
|
| gridcmsp[region == 'gmex', plot(longrid, latgrid, cex=0.1)]
|
| gridcmsp[region == 'wc', plot(longrid, latgrid, cex=0.1)]
|
| gridcmsp[region == 'bc', plot(longrid, latgrid, cex=0.1)]
|
| gridcmsp[region == 'goa', plot(longrid, latgrid, cex=0.1)]
|
|
|
| gridcmsp[region == 'ebs', plot(longrid, latgrid, cex=0.1)]
|
|
|
|
|
| write.csv(gridcmsp, gzfile('output/region_grid.csv.gz'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| require(data.table)
|
|
|
|
|
| files <- list.files(path = '/local/shared/pinsky_lab/projections_PlosOne2018/CEmodels_proj_Biomass_BCODMO', full.names = FALSE)
|
| projspps <- unique(gsub(paste0('/|_Atl|_Pac|_rcp26|_rcp85|_jas_prediction_AGG.RData'), '', files))
|
|
|
|
|
| ebs <- fread('dataDL/sau/SAU LME 1 v47-1.csv')
|
| ai <- fread('dataDL/sau/SAU LME 65 v47-1.csv')
|
| goa <- fread('dataDL/sau/SAU LME 2 v47-1.csv')
|
| bc <- goa
|
| wc <- fread('dataDL/sau/SAU LME 3 v47-1.csv')
|
| gmex <- fread('dataDL/sau/SAU LME 5 v47-1.csv')
|
| seus <- fread('dataDL/sau/SAU LME 6 v47-1.csv')
|
| neus <- fread('dataDL/sau/SAU LME 7 v47-1.csv')
|
| maritime <- fread('dataDL/sau/SAU LME 8 v47-1.csv')
|
| newf <- fread('dataDL/sau/SAU LME 9 v47-1.csv')
|
|
|
|
|
| ebs$region <- 'ebs'
|
| ai$region <- 'ebs'
|
| goa$region <- 'goa'
|
| bc$region <- 'bc'
|
| wc$region <- 'wc'
|
| gmex$region <- 'gmex'
|
| seus$region <- 'seus'
|
| neus$region <- 'neus'
|
| maritime$region <- 'maritime'
|
| newf$region <- 'newf'
|
|
|
|
|
| sau <- rbind(ebs, ai, goa, bc, wc, gmex, seus, neus, maritime, newf)
|
| sppston <- sau[year >= 1995 & fishing_sector == 'Industrial' & catch_type == 'Landings' & reporting_status == 'Reported', .(tonnes = sum(tonnes)), by = c('region', 'scientific_name')]
|
|
|
|
|
| sppston[, scientific_name := tolower(scientific_name)]
|
|
|
|
|
| sppston[, projname := as.character(NA)]
|
|
|
|
|
| for (j in 1:nrow(sppston)){
|
| ind <- agrep(sppston[j, scientific_name], projspps)
|
| if (length(ind) == 1) sppston[j, projname := projspps[ind]]
|
| }
|
|
|
|
|
| setkey(sppston, region, tonnes)
|
|
|
|
|
| sppston[scientific_name == 'clupea pallasii pallasii', projname := 'clupea pallasii']
|
| sppston[scientific_name == 'theragra chalcogramma', projname := 'gadus chalcogrammus']
|
| sppston[scientific_name == 'farfantepenaeus duorarum', projname := 'penaeus duorarum']
|
| sppston[scientific_name == 'litopenaeus setiferus', projname := 'penaeus setiferus']
|
| sppston[scientific_name == 'farfantepenaeus aztecus', projname := 'penaeus aztecus']
|
| sppston[scientific_name == 'doryteuthis pealeii', projname := 'doryteuthis pealeii']
|
| sppston[scientific_name == 'stomolophus', projname := NA]
|
| sppston[scientific_name == 'harengula', projname := NA]
|
|
|
|
|
|
|
| sppstontrim <- sppston[!is.na(projname), .(sau_name = scientific_name, projname = projname, tonnes = tonnes, rank = rank(tonnes)), by = 'region']
|
|
|
|
|
|
|
| sppstontrim[, maxrank := max(rank), by='region']
|
| sppstontrim <- sppstontrim[(maxrank - rank) < 10, ]
|
| sppstontrim[ , c('rank', 'maxrank') := NULL]
|
|
|
|
|
| sppstontrim[, .N, by='region']
|
|
|
|
|
| write.csv(sppstontrim, file='output/fishery_spps.csv')
|
|
|