afsc-gap-products / gap_bs_data_report Goto Github PK
View Code? Open in Web Editor NEWReproducible and annotated code for developing the EBS and NBS Annual Data report and presentation.
Reproducible and annotated code for developing the EBS and NBS Annual Data report and presentation.
gap_products.taxonomic_classification
...
Notes from reviewers that we'll need to address next round:
Update plot_temps_facet() for community data report.
Change L700 of plot_temps_facet() to show survey strata instead of default bathymetry.
Code for combining temperature from EBS-only years with temperature from EBS+NBS years in the same rasterbrick. Would slot-in around here:
https://github.com/EmilyMarkowitz-NOAA/gap_bs_data_report/blob/861560b2bba6def981309652ba1c64c9a4effa35/code/figtab.Rmd#L579-L593
# Setup for working example
library(coldpool)
library(akgfmaps)
reg_dat <- akgfmaps::get_base_layers(select.region = "ebs", set.crs = "EPSG:3338")
maxyr <- 2022
yrs <- (maxyr-19):maxyr
# CODE STARTS HERE #
# Names of EBS layers for years without NBS data
sebs_only <- names(coldpool::ebs_bottom_temperature)[which(!(names(coldpool::ebs_bottom_temperature) %in% paste0("s", names(coldpool::nbs_ebs_bottom_temperature))))]
# Select EBS years to include in rasterbrick and reproject EBS years to the extent and resolution of the EBS+NBS grid
sebs_temp <- raster::subset(coldpool::ebs_bottom_temperature,
subset = sebs_only) %>%
raster::projectRaster(coldpool::nbs_ebs_bottom_temperature)
# Combine EBS and NBS layers into the same rasterbrick
rasterbrick <- raster::addLayer(sebs_temp, coldpool::nbs_ebs_bottom_temperature)
# Remove non-numeric characters from layer names to simplify subsetting based on the year range
names(rasterbrick) <- gsub("[^0-9.-]", "", names(rasterbrick))
# Subset layers for the selected years
rasterbrick <- raster::subset(rasterbrick, subset = paste0("X", yrs))
In the plotting function, remove NA values from the reprojected extent:
https://github.com/EmilyMarkowitz-NOAA/gap_bs_data_report/blob/861560b2bba6def981309652ba1c64c9a4effa35/code/functions.R#L2372-L2375
with:
temp_df <- temp_df %>%
tidyr::pivot_longer(values_to = "value",
names_to = "year",
cols = dplyr::all_of(temp1)) %>%
tidyr::drop_na(value)
r fig_dist
).@EmilyMarkowitz-NOAAthis bit is
googledrive::drive_download(file = googledrive::as_id("10Pn3fWkB-Jjcsz4iG7UlR-LXbIVYofy1yHhKkYZhv2M"),
type = "csv",
overwrite = TRUE,
path = paste0(dir_out_rawdata, "/0_species_local_names"))
error below
source('./code/data.R')
[1] "Load data"
Error inmap()
:
โน In index: 1.
Caused by error in.f()
:
! Client error: (404) Not Found
File not found: 10Pn3fWkB-Jjcsz4iG7UlR-LXbIVYofy1yHhKkYZhv2M.
โข message: File not found: 10Pn3fWkB-Jjcsz4iG7UlR-LXbIVYofy1yHhKkYZhv2M.
โข domain: global
โข reason: notFound
โข location: fileId
โข locationType: parameter
Runrlang::last_trace()
to see where the error occurred.
Warning messages:
1: attribute variables are assumed to be spatially constant throughout all geometries
2: attribute variables are assumed to be spatially constant throughout all geometries
3: attribute variables are assumed to be spatially constant throughout all geometries
Formatting @EmilyMarkowitz-NOAA
Temperature figures @EmilyMarkowitz-NOAA
Species Narratives
EDIT: Accidentally pasted my code twice instead of code + link.
Here's an option for adding a 'No Survey' label for a 2020 multi-panel plot.
Proposed replacement:
panel_extent <- data.frame(reg_dat$plot.boundary)
panel_extent <- data.frame(x = panel_extent$x[c(1,2,2,1,1)],
y = panel_extent$y[c(1,1,2,2,1)],
year = 2020)
label_2020 <- data.frame(x = mean(panel_extent$x),
y = mean(panel_extent$y),
label = "No\nSurvey",
year = 2020)
figure <- ggplot() +
ggplot2::geom_sf(data = reg_dat$akland,
color = NA,
fill = "grey50")+
ggplot2::geom_sf(data = reg_dat$graticule,
color = "grey80",
alpha = 0.2) +
ggplot2::geom_tile(data = temp_df,
mapping = aes(x=x, y=y,
fill=cut(value, breaks = colorbar_breaks))) +
geom_polygon(data = panel_extent,
aes(x = x,
y = y),
fill = "white") +
geom_label(data = label_2020,
aes(x = x,
y = y,
label = label),
label.size = NA) +
ggplot2::facet_wrap( ~ year,
nrow = row0) +
# coord_equal() +
ggplot2::scale_fill_manual(values = fig_palette) +
# ggplot2::geom_sf(data = reg_dat$survey.strata,
# color = "grey50",
# size = 0.1,
# # alpha = 0,
# fill = NA) +
ggplot2::scale_y_continuous(name = "", #"Latitude",
limits = reg_dat$plot.boundary$y, # c(557292.9, 1744114.2), #1804888.0), #reg_dat$plot.boundary$y,
breaks = reg_dat$lat.breaks) +
ggplot2::scale_x_continuous(name = "", #"Longitude",
limits = reg_dat$plot.boundary$x,
breaks = reg_dat$lon.breaks)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.