diff --git a/globalprep/fis/readme.md b/globalprep/fis/readme.md index 4fdccc9d..5b79cd70 100644 --- a/globalprep/fis/readme.md +++ b/globalprep/fis/readme.md @@ -4,10 +4,10 @@ This folder describes the methods used to prepare data for the Fisheries subgoal More information about this goal is available [here](http://ohi-science.org/goals/#food-provision). -The folders in this file include the metadata, R scripts, and data for each assessement year (i.e., the year the assessment was conducted). The most current year represents the best available data and methods, and previous years are maintained for archival purposes. +The folders in this file include the metadata, R scripts, and data for each assessment year (i.e., the year the assessment was conducted). The most current year represents the best available data and methods, and previous years are maintained for archival purposes. Our [data managment SOP](https://rawgit.com/OHI-Science/ohiprep/master/src/dataOrganization_SOP.html) describes how we manage OHI global data, including a description of the file structure. -Please see our [citation policy](http://ohi-science.org/citation-policy/) if you use OHI data or methods. +Please see our [citation policy](https://oceanhealthindex.org/global-scores/data-download/) if you use OHI data or methods. Thank you! diff --git a/globalprep/fis/v2023/STEP1_download_saup_match_fao_data_fix.html b/globalprep/fis/v2023/STEP1_download_saup_match_fao_data_fix.html index 3f6f2529..08c871df 100644 --- a/globalprep/fis/v2023/STEP1_download_saup_match_fao_data_fix.html +++ b/globalprep/fis/v2023/STEP1_download_saup_match_fao_data_fix.html @@ -9,7 +9,7 @@ - +
+
OHI Science | Citation policy
+
This script combines the fisheries catch data with the mariculture +production data to create the weights for how much of each score will +affect the entire food provision score.
+## load libraries
+library(dplyr)
+library(tidyr)
+library(here)
+
+scen_year <- 2023 # change to latest year
+prev_scen_year <- scen_year - 1
+
+setwd(here::here("globalprep","fp", paste0("v", scen_year)))
+
+## Load FAO-specific user-defined functions
+source('http://ohi-science.org/ohiprep_v2021/workflow/R/common.R')
Mariculture production in tonnes.
+mar <- read.csv(file.path("..", "..", "mar", paste0("v", scen_year), "output", "MAR_FP_data.csv")) # see metadata in its prep
Fisheries data.
+ +Adjust years so they are equivalent.
+adjust <- max(mar_tidy$year) - max(fis_tidy$year)
+
+mar_adjust <- mar_tidy %>%
+ mutate(year = year - adjust)
+
+tmp <- full_join(fis_tidy, mar_adjust, by = c('rgn_id', 'year')) # v2023: removed all = TRUE because was not a valid argument, did not see an equivalent
+
+## If NA, turn it into a 0 before weighting
+tmp_weights <- tmp %>%
+ mutate(fis_t = ifelse(is.na(fis_t), 0, fis_t)) %>%
+ mutate(mar_t = ifelse(is.na(mar_t), 0, mar_t)) %>%
+ mutate(w_fis = fis_t/(fis_t + mar_t)) %>%
+ mutate(w_fis = ifelse(mar_t == 0 & fis_t == 0, NA, w_fis)) %>%
+ filter(year >= 2005) %>%
+ dplyr::select(rgn_id, year, w_fis)
+
+hist(tmp_weights$w_fis,
+ main = "Weights",
+ xlab = "Value")
Compare to previous year data
+compare <- read.csv(paste0("../../fp/v", prev_scen_year, "/output/wildcaught_weight.csv")) %>%
+ rename(w_fis_old = w_fis) %>%
+ left_join(tmp_weights, by = c('rgn_id', 'year'))
+plot(compare$w_fis_old, compare$w_fis,
+ xlab = paste0("Old data (v", prev_scen_year, ")"),
+ ylab = paste0("New data (v", scen_year, ")"))
+abline(0, 1, col="red")