Skip to content

Commit ede257e

Browse files
committed
Added haul midpoints to plotSurvey and checkTrawls, to fix issue where nav data were not present and trawl paths were not being presented.
1 parent 54efb64 commit ede257e

2 files changed

Lines changed: 59 additions & 6 deletions

File tree

Doc/checkTrawls.Rmd

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,18 @@ if (nrow(catch) > 0) {
282282
283283
# Prepare catch data for plotting ----------------------------------------------
284284
# Select and rename trawl data for pie charts
285-
catch.pie <- cluster.summ.wt %>%
285+
haul.pie <- haul.summ.wt %>%
286+
select(haul, long, lat, any_of(names(pie.spp))) %>%
287+
st_as_sf(coords = c("long","lat"), crs = crs.geog)
288+
289+
# Select and rename trawl data for pie charts
290+
cluster.pie <- cluster.summ.wt %>%
286291
select(cluster, long, lat, any_of(names(pie.spp))) %>%
287292
st_as_sf(coords = c("long","lat"), crs = crs.geog)
288293
289294
# Project pie data
290-
catch.pie <- project_sf(catch.pie, crs.proj)
295+
haul.pie <- project_sf(haul.pie, crs.proj)
296+
cluster.pie <- project_sf(cluster.pie, crs.proj)
291297
292298
# Convert haul data for plotting
293299
haul.catch <- haul.summ.wt %>%
@@ -347,7 +353,22 @@ cluster.locs.sf <- cluster.mid %>%
347353
st_as_sf(coords = c("long","lat"), crs = crs.geog)
348354
349355
# Convert haul catch to sf and create labels
350-
cluster.catch.sf <- catch.pie %>%
356+
haul.catch.sf <- haul.pie %>%
357+
st_as_sf(coords = c("X","Y"), crs = crs.proj) %>%
358+
st_transform(crs = crs.geog) %>%
359+
mutate(
360+
label = paste("Haul", haul),
361+
popup = paste('<b>Haul:', haul, '</b><br/>',
362+
'Anchovy:', Anchovy, 'kg<br/>',
363+
'P. Sardine:', Sardine, 'kg<br/>',
364+
'J. Sardine:', JapSardine, 'kg<br/>',
365+
'Jack Mackerel:', JackMack, 'kg<br/>',
366+
'P. herring:', PacHerring, 'kg<br/>',
367+
'P. mackerel:', PacMack, 'kg<br/>',
368+
'All CPS:', AllCPS, 'kg'))
369+
370+
# Convert cluster catch to sf and create labels
371+
cluster.catch.sf <- cluster.pie %>%
351372
st_as_sf(coords = c("X","Y"), crs = crs.proj) %>%
352373
st_transform(crs = crs.geog) %>%
353374
mutate(
@@ -1933,12 +1954,21 @@ if (exists("nav.paths.sf")) {
19331954
popup = ~popup, label = ~label,
19341955
group = "Trawls-Salmon")
19351956
1957+
# Add trawl cluster data
1958+
if (exists("haul.catch.sf"))
1959+
i.map <- i.map %>%
1960+
# Add trawl catch
1961+
addCircleMarkers(data = haul.catch.sf, radius = 5, color = "#000000", stroke = TRUE, weight = 2,
1962+
opacity = 0.8, fillOpacity = 1, fillColor = "white",
1963+
popup = ~popup, label = ~label,
1964+
group = "Trawls")
1965+
19361966
# Add trawl cluster data
19371967
if (exists("cluster.catch.sf"))
19381968
i.map <- i.map %>%
19391969
# Add trawl catch
19401970
addCircleMarkers(data = cluster.catch.sf, radius = 5, color = "#000000", stroke = TRUE, weight = 2,
1941-
opacity = 0.8, fillOpacity = 1, fillColor = "white",
1971+
opacity = 0.8, fillOpacity = 1, fillColor = "magenta",
19421972
popup = ~popup, label = ~label,
19431973
group = "Trawls")
19441974

Doc/plotSurvey.Rmd

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,21 @@ if (sampling.trawl) {
10961096
st_as_sf(coords = c("long","lat"), crs = crs.geog)
10971097
10981098
# Convert haul catch to sf and create labels
1099+
haul.catch.sf <- haul.pie %>%
1100+
st_as_sf(coords = c("X","Y"), crs = crs.proj) %>%
1101+
st_transform(crs = crs.geog) %>%
1102+
mutate(
1103+
label = paste("Haul", haul),
1104+
popup = paste('<b>Haul:', haul, '</b><br/>',
1105+
'Anchovy:', Anchovy, 'kg<br/>',
1106+
'P. Sardine:', Sardine, 'kg<br/>',
1107+
'J. Sardine:', JapSardine, 'kg<br/>',
1108+
'Jack Mackerel:', JackMack, 'kg<br/>',
1109+
'P. herring:', PacHerring, 'kg<br/>',
1110+
'P. mackerel:', PacMack, 'kg<br/>',
1111+
'All CPS:', AllCPS, 'kg'))
1112+
1113+
# Convert cluster catch to sf and create labels
10991114
cluster.catch.sf <- cluster.pie %>%
11001115
st_as_sf(coords = c("X","Y"), crs = crs.proj) %>%
11011116
st_transform(crs = crs.geog) %>%
@@ -1502,13 +1517,21 @@ if (sampling.trawl) {
15021517
popup = ~popup, label = ~label,
15031518
group = "Trawls")
15041519
1520+
if (exists("haul.catch.sf"))
1521+
i.map <- i.map %>%
1522+
# Add trawl catch
1523+
addCircleMarkers(data = haul.catch.sf, radius = 5, color = "#000000", stroke = TRUE, weight = 2,
1524+
opacity = 0.8, fillOpacity = 1, fillColor = "white",
1525+
popup = ~popup, label = ~label,
1526+
group = "Trawls")
1527+
15051528
if (exists("cluster.catch.sf"))
15061529
i.map <- i.map %>%
15071530
# Add trawl catch
15081531
addCircleMarkers(data = cluster.catch.sf, radius = 5, color = "#000000", stroke = TRUE, weight = 2,
1509-
opacity = 0.8, fillOpacity = 1, fillColor = "white",
1532+
opacity = 0.8, fillOpacity = 1, fillColor = "magenta",
15101533
popup = ~popup, label = ~label,
1511-
group = "Trawls")
1534+
group = "Trawls")
15121535
15131536
if (exists("haul.midwater"))
15141537
i.map <- i.map %>%

0 commit comments

Comments
 (0)