James-Thorson-NOAA / FishStatsUtils

Shared resources for spatio-temporal models
GNU General Public License v3.0
10 stars 16 forks source link

multiple regions in make_extrapolation_info #4

Closed mkapur closed 5 years ago

mkapur commented 5 years ago

Hi Jim Regarding the make_extrapolation_info() funtion, I'm wondering if there is a simple-ish syntax for creating an extent for the entire NE Pacific. (All of AK, BC and the California Current) -- can these be concactenated? It looks like there is a user-specified one as well, but I am fairly new to working with these type of lists. Thanks! MK

James-Thorson commented 5 years ago

Yes its very easy. Please use e.g.

EBS_extrap = make_extrapolation_info( Region="Eastern_Bering_Sea", strata.limits=strata.limits )
NBS_extrap = make_extrapolation_info( Region="Northern_Bering_Sea", strata.limits=strata.limits, zone=32, flip_around_dateline=TRUE )
Extrapolation_List = combine_extrapolation_info( "EBS"=EBS_extrap, "NBS"=NBS_extrap )

where instead you can include as many entries as you want in combine_extrapolation_info.

mkapur commented 5 years ago

Thanks for the quick reply. A couple simple issues, which may be specific to me but I wanted to note: The Area_km2_x column is getting saved outside but not within the main data_extrap frame for BC and Cal Current extrapolation objects, which yielded this when when I tried to use the combine funciton: Error in [.data.frame(Tmp, , c("E_km", "N_km", "Lon", "Lat", "Include", : undefined columns selected. The likely cause is Line 33 on the combine function). I worked around this by manually pasting the column into the right spot.

Similarly for the BC data, the a_el vector is named STRATA whereas on others it's called All_areas, obtaining a names do not match previous names error during the rbind step.

It didn't like mixing and matching the dateline flip, which I will investigate if I can fix this post hoc. Thanks!

Here's my code that worked. EBS_extrap = make_extrapolation_info( Region = "Eastern_Bering_Sea", strata.limits = strata.limits, zone = 32, flip_around_dateline = F ) NBS_extrap = make_extrapolation_info( Region = "Northern_Bering_Sea", strata.limits = strata.limits, zone = 32, flip_around_dateline = F )
GOA_extrap = make_extrapolation_info( Region = "gulf_of_alaska", strata.limits = strata.limits, zone = 32, flip_around_dateline = T ) BC_extrap = make_extrapolation_info( Region = "british_columbia", strata.limits = strata.limits, zone = 32, flip_around_dateline = F ) BC_extrap$Data_Extrap$Area_km2 <- BC_extrap$Area_km2_x names(BC_extrap$a_el) <- "All_areas" CC_extrap = make_extrapolation_info( Region = "california_current", strata.limits = strata.limits, zone = 32, flip_around_dateline = TRUE ) CC_extrap$Data_Extrap$Area_km2 <- CC_extrap$Area_km2_x

Extrapolation_List = combine_extrapolation_info("EBS" = EBS_extrap, "NBS" = NBS_extrap, "GOA" = GOA_extrap, "BC" = BC_extrap, "CC" = CC_extrap)