Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percent consumption calculation has many >100 observations #33

Open
5 of 12 tasks
theamarks opened this issue Nov 8, 2024 · 12 comments
Open
5 of 12 tasks

Percent consumption calculation has many >100 observations #33

theamarks opened this issue Nov 8, 2024 · 12 comments
Assignees
Labels
🐛 bug Something isn't working

Comments

@theamarks
Copy link
Member

theamarks commented Nov 8, 2024

Problem

Observed unusual percent_export values over 100%. Likely introduced by recent changes to calculate_consumption.R caf3076 or the most recent rerun of consumption.

Things to investigate 🔎 🐞

  • Local database snet table for values exceeding 100% (Jessica's local pgAdmin) - Not exceeding
  • create_snet.R - Jessica local ARTIS snet tables do not have exceeding values
  • calculate_consumption.R
  • Consumption rerun script consumption_FAO_v2_2024_09_19.R
    • paths list pulls files from different data files - could introduce mismatched intermediate files
      • snet --> KNB version
      • X_long & W_long --> FAO v2

Relevant test scripts

Script for rerunning consumption: artis-model/AM_local/consumption_FAO_v2_2024_09_19.R
(lives locally on Althea's machine - not tracked by git)

Percent consumption quick calculation:

percent_consumption <- consumption_result %>%
    #  filter(end_use == "direct human consumption") %>%
      group_by(year, source_country_iso3c, sciname, habitat, method) %>%
      summarise(consumption_t = sum(consumption_t)) %>%
      left_join(prod %>% 
                  rename(iso3c = country_iso3_alpha,
                         sciname = SciName,
                         method = prod_method,
                         live_weight_t = quantity) %>% 
                  group_by(year, iso3c, sciname, habitat, method) %>%
                  summarise(live_weight_t = sum(live_weight_t)), 
                by = c("year", "source_country_iso3c" = "iso3c", "sciname",
                             "habitat", "method")) %>%
      mutate(percent_export = 100*consumption_t/live_weight_t) %>%
      arrange(desc(percent_export))
    
    tmp <- percent_consumption %>%
      filter(percent_export > 100.01)
@theamarks theamarks added the 🐛 bug Something isn't working label Nov 8, 2024
@theamarks theamarks moved this to 🏗 In Progress in ARTIS Maintence & Analysis Nov 8, 2024
@theamarks
Copy link
Member Author

theamarks commented Nov 18, 2024

Bug Hunt Update 2024-11-15

When adding up back to BACI numbers we are not getting close numbers. This indicates that we may have introduced an error through transferring the product hs6 naming hs_original, hs6_processed, hs6_final

  • Trace through create_snet.R -- make sure column names are transferred correctly
# 2024-11-15
# script for testing create_snet() dataframe overall_foreign_exports
# goal is to carry both hs6_processed and hs6_original thought to
# overall_foreign_exports dataframe so conversion factors can be applied at
# this point rather than carrying conversions through consumption

library(dplyr)
library(tidyr)

envdir <- file.path(".", "AM_local", "env-images")
load(file.path(envdir, "2024_11_14_create_snet_line452.Rdata"))



foreign_prod_production <- overall_foreign_exports %>% 
  group_by(importer_iso3c, hs6_processed) %>%
  summarise(production_weight = sum(product_weight_t)) %>% 
  rename(hs6 = hs6_processed,
         iso3c = importer_iso3c)


foreign_prod_export <- overall_foreign_exports %>% 
  group_by(exporter_iso3c, hs6_original) %>% 
  summarise(export_weight = sum(product_weight_t)) %>% 
  rename(hs6 = hs6_original,
         iso3c = exporter_iso3c)
  
foreign_consumption <- foreign_prod_production %>% 
  full_join(foreign_prod_export,
            by = c("hs6", "iso3c")) %>% 
  replace_na(list(production_weight = 0, export_weight = 0)) %>% 
  mutate(consumption = production_weight - export_weight)


tmp <- overall_foreign_exports %>% 
  filter(exporter_iso3c == "CHN",
         hs6_processed == "030367") %>% 
  group_by(object) %>% 
  summarise(product_weight_t = sum(product_weight_t))

baci_tmp <- baci_data_analysis_year %>% 
  filter(exporter_iso3c == "CHN",
         hs6 == "030367") %>% 
  summarise(total = sum(product_weight_t))

@theamarks
Copy link
Member Author

theamarks commented Nov 19, 2024

Bug hunt Update 2024-11-18 🐛 🏹

  • Domestic exports exceed production in consumption NOT ARTIS.
  • Observed in association with foreign exports
  • At product code level
  • Right now trying to write out intermediate snet file with product codes while retaining imported and exported product forms. Use for consumption calculations that can use product conversion factors at end of consumption calculation rather than carrying through.
  • Note we may be misinterpreting the column names. Take a step back before changing too many things.
  • Branch consumption-fix is created from develop & create_snet-redevelop is created from consumption-fix. Currently working on create_snet-redevelop

Next Steps @theamarks

  • Schedule call with @rahulAgrBej
  • What questions do we have for @rahulAgrBej
  • Map create_snet() into a schematic that includes objects and their colnames -- to assist with conceptual inspection of code - build off of Rahul's lucid chart ARTIS Foregin Exports Resolution
  • Inspect hs6_[...] column names and if they are appropriately renamed for joins
  • Looking for what might be generating negative values in consumption

Questions for @rahulAgrBej

  1. ARTIS Foregin Exports Resolution - foreign exports is "immediate exporter" == "re-exporter"?
  2. Is country naming convention source country --> exporter --> re-exporter --> importer ?

@theamarks theamarks added the 📖 documentation Improvements or additions to documentation label Nov 19, 2024
@theamarks theamarks added this to the ARTIS v2.0 development milestone Nov 22, 2024
@theamarks
Copy link
Member Author

theamarks commented Nov 26, 2024

Bug Hunt Meeting 2024-11-26

create_snet() dataframe column alignment through transformation through exports

foreign exports definitions google sheet

@theamarks
Copy link
Member Author

theamarks commented Dec 6, 2024

Bug Hunt Meeting 2024-12-04

Summary notes generated with Fathom AI note taking and were edited by @theamarks

Consumption Calculation Improvement

  • Added code to replace NAs in live weight conversion factors with HS code averages
  • Reordered mutate statements to correctly calculate live weight consumption
  • Created a new data frame hs_cf_means to store mean live weight conversion factors by HS6 code
  • Joined hs_cf_means to populate missing values in the disaggregate_foreign_consumption_all data frame
  • See exact code chunk here

Data Checks and Debugging

  • Implemented a test to compare consumption totals by source country to production values
  • Discovered discrepancies where consumption is consistently lower than production
  • Verified that domestic consumption and exports add up correctly to production
  • Identified the foreign consumption calculation as the likely source of the volume loss

Next Steps

  • Systematically check each object in the foreign consumption calculation to ensure proper accounting of volume
  • Review and potentially update existing data checks in the code
  • Investigate the processed imports stage of the foreign consumption calculation

@theamarks
Copy link
Member Author

theamarks commented Dec 7, 2024

Bug Hunt Meeting 2024-12-06

  • Identified significant discrepancies in consumption calculations not matching production or export data from ARTIS database
  • Decided to involve Rahul for additional debugging support and fresh perspective, preparing a simplified test case for his review

Code Review and Debugging

  • Identified issue with products labeled as dom_source == "foreign" when source country was unknown; implemented fix to label these as "error" instead 145d358
  • Investigated the impact of habitat and method classifications on join operations in disaggregation steps
  • made explicit variable naming conventions (e.g., specifying live_weight vs product_weight) d2ea22b

@jagephart
Copy link
Contributor

The core issue in calculate_consumption appears to stem from artis_import_props. If the volumes are left on, then when grouped by source_country_iso3c, habitat and method, the volumes exceed production, which makes sense because it is based on ARTIS. But, it therefore makes sense that it is over-allocating volume to certain countries (specifically for products moving through intermediate countries). So the bad news is that it seems we need a more complicated handling of the sourcing proportions for the foreign consumption part.

@theamarks
Copy link
Member Author

theamarks commented Dec 20, 2024

Bug hunt 2024-12-20 meeting w/ Rahul, Jessica, Althea

Summary notes generated with Fathom AI note taking and were edited by @theamarks

Consumption Calculation Discrepancies

  • Total global foreign consumption exceeds production by approximately 3 million tons.
  • Specific issues identified with Alaska Pollock:
    ~200,000 tons extra Russian Pollock consumed globally
    ~56,000 tons of US Pollock not consumed
  • These discrepancies persist despite individual checks passing (e.g., ARTIS matching BACI data)

Potential Causes Explored

  • ARTIS props calculation: May be incorrectly assigning products to source countries
  • Product code assignments: Possibility of wrong product forms being linked
  • Live weight conversion factors: Checked but didn't seem to be the primary issue
  • Reexport handling: Concern about potential double-counting in multi-step trade flows

Debugging Approaches

  • Examined process-to-original product conversions using reweight_w function
  • Considered simplifying parts of the code using reweight_w for efficiency
  • Discussed need for potential rebalancing of proportions, similar to input-output models
  • Explored idea of adjusting proportions for multi-step trade (e.g., squaring for two steps back)

Next Steps

  • Consider implementing a matrix rebalancing step for ARTIS props
  • Double-check all proportion calculations step-by-step in the consumption function
  • Explore adjusting proportions for multi-step trade flows

Git & Code Info

# 2024-12-06 create_consumption negative value debug
# script sent to Rahul

library(devtools)

# Install artis package locally
devtools::install()

library(magrittr)
library(tidyverse)
library(data.table)
library(stringr)
library(data.table)

load(file.path("create_consumption-2024-11-26.Rdata"))

# create_consumption arguments
artis = s_net
prod = prod_data_analysis_year
curr_year = analysis_year
curr_hs_version = curr_hs
W_long = W_long
X_long = X_long
pop = pop
code_max_resolved = code_max_resolved
max_percap_consumption = 100
consumption_threshold = 1e-9

@theamarks theamarks removed the 📖 documentation Improvements or additions to documentation label Dec 20, 2024
@theamarks
Copy link
Member Author

theamarks commented Jan 13, 2025

2025-01-13 Meeting w/ Rahul, Jessica, Althea

Possible roots of the problems:

  1. difference in product form in which US vs. Russia sent. proportions would be correct - somehow rewieght_W_long needs adjustment
  2. The proportion is wrong and too much is going to the wrong country - Right now have volume of what stays in the country and then distribute it based on proportions.
  3. instead of using ARTIS flows, we could approach the problem by calculating production consumption and consumption from imports.

What we did

Conceptual change:

  • Calculate the artis volumes by the amount that stayed in the country vs just the amount imported we would let error stay, we would just say that origin is unknown
  • proportion of original hs6 that was retained in country from imports = consumption of that original hs6 divided by the imports of the original hs6

Next steps

  • Investigate how flows are allocated/traced through each country
Code from meeting:
calculate_consumption <- function(artis, prod, curr_year, curr_hs_version,
                                  W_long, X_long, pop,
                                  code_max_resolved,
                                  max_percap_consumption = 100,
                                  consumption_threshold = 1e-9) {
  
  # Formatting columns so that they match for joins
  artis <- artis %>%
    filter(!is.na(live_weight_t)) %>%
    mutate(hs6 = as.numeric(hs6),
           dom_source = case_when(
             source_country_iso3c == "unknown" ~ "error",
             TRUE ~ dom_source
           ))
  
  
  W_long <- W_long %>%
    mutate(hs6_original = as.numeric(hs6_original),
           hs6_processed = as.numeric(hs6_processed))
  
  X_long <- X_long %>%
    mutate(hs6 = as.numeric(hs6))
  
  prod <- prod %>%
    rename(sciname = SciName,
           method = prod_method,
           live_weight_t = quantity)
  
  # Calculating Domestic Consumption----------------------------------------------
  
  # calculating all products exported by countries
  country_exports <- artis %>%
    mutate(hs6 = as.numeric(hs6)) %>%
    group_by(exporter_iso3c, hs6) %>%
    summarize(live_weight_t = sum(live_weight_t, na.rm = TRUE)) %>%
    ungroup()
  
  # Note this will mean that all production under the error is now human consumable
  error_code <- 999999
  # change X long to account for when a country does not export a certain code
  # example COD with 230120
  X_long <- X_long %>%
    left_join(
      country_exports,
      by = c("iso3c"="exporter_iso3c", "hs6")
    ) %>%
    # if a country does not export the code in a given year, then change the code to placeholder error code
    mutate(
      hs6 = case_when(
        is.na(live_weight_t) ~ error_code,
        TRUE ~ hs6
      )
    ) %>%
    select(-live_weight_t) %>%
    # Re-summarize estimated X to account for multiple codes being turned into error code
    group_by(iso3c, hs6, sciname, habitat, method) %>%
    summarize(estimated_X = sum(estimated_X)) %>%
    ungroup()
  
  # Domestic consumption by hs6 code
  x_p <- prod %>%
    rename(iso3c = country_iso3_alpha) %>%
    # join in proportions to divide species resolution into hs6 products
    left_join(
      X_long,
      by = c("iso3c", "sciname", "habitat", "method")
    ) %>%
    # disaggregate species production to hs6 products
    mutate(production_live_t = live_weight_t * estimated_X) %>%
    group_by(iso3c, hs6, sciname, habitat, method) %>%
    summarize(production_live_t = sum(production_live_t, na.rm = TRUE)) %>%
    ungroup()
  
  
  # Domestic exports by hs6 and species
  exports_domestic <- artis %>%
    filter(dom_source == "domestic") %>%
    group_by(source_country_iso3c, hs6, sciname, habitat, method) %>%
    summarize(domestic_export_live_t = sum(live_weight_t, na.rm = TRUE),
              domestic_export_product_t = sum(product_weight_t, na.rm = TRUE)) %>%
    ungroup()
  
  # domestic consumption = domestic production - domestic exports
  consumption_domestic <- x_p %>%
    full_join(
      exports_domestic %>%
        mutate(hs6 = as.numeric(hs6)),
      by = c("iso3c"="source_country_iso3c", "hs6", "sciname", "habitat", "method")
    ) %>%
    # deals with cases where there is production but no exports
    replace_na(list(domestic_export_live_t = 0)) %>%
    mutate(consumption_live_t = production_live_t - domestic_export_live_t)
  
  # DATA CHECK: domestic exports should not exceed domestic production
  domestic_consumption_threshold <- -1e-3
  data_check_domestic <- consumption_domestic %>%
    filter(consumption_live_t < domestic_consumption_threshold)
  if (nrow(data_check_domestic) > 0) {
    warning(paste0("Domestic exports EXCEED domestic production", 
                   " for ", curr_year, " and ", curr_hs_version,
                   ", min difference between production and domestic export is ",
                   min(data_check_domestic$consumption_live_t)))
  }
  #-----------------------------------------------------------------------------
  
  # Calculating Foreign Consumption-----------------------------------------------
  
  # Wi is the pool of imported products that have been processed and are available 
  # for export or consumption as the final hs6 processed form
  
  exports_foreign <- artis %>%
    filter(dom_source == "foreign") %>%     
    group_by(exporter_iso3c, hs6) %>%
    summarize(foreign_export_product_t = sum(product_weight_t, na.rm = TRUE),
              foreign_export_live_t = sum(live_weight_t, na.rm = TRUE)) %>%
    ungroup()
  
  imports <- artis %>%
    # calculating all imports by hs6 code
    group_by(importer_iso3c, hs6) %>%
    summarize(import_product_t = sum(product_weight_t, na.rm = TRUE),
              import_live_t = sum(live_weight_t, na.rm = TRUE)) %>%
    ungroup()
  
  # Conceptual change:
  # Calculate the artis volumes by the amount that stayed in the country vs just the amount imported
  # we would let error stay, we would just say that origin is unknown
  
  # proportion of original hs6 that was retained in country from imports =
  # consumption of that original hs6 divided by the imports of the original hs6
  
  unprocessed_consumption <- exports_foreign %>%
    # processing imports into the product form that is available for consumption or re-export
    left_join(
      reweight_W_long %>%
        mutate(hs6_processed = as.numeric(hs6_processed)),
      by = c("exporter_iso3c", "hs6"= "hs6_processed")
    ) %>%
    mutate(unprocessed_product_t = foreign_export_product_t * reweighted_W) %>%
    # proportion of hs6 processed that can be disagregated into hs6 original
    # will be used to disagregate foreign consumption later on
    group_by(exporter_iso3c, hs6_original) %>%
    summarize(hs6_original_product_t = sum(unprocessed_product_t)) %>%
    ungroup() %>%
    # changing to numeric for join
    mutate(hs6_original = as.numeric(hs6_original)) %>%
    # get imports by original hs6 form
    left_join(
      imports %>%
        select(importer_iso3c, hs6, import_product_t),
      by = c("exporter_iso3c"="importer_iso3c",
             "hs6_original"="hs6")
    ) %>%
    # calculate foreign consumption of original hs6 form
    mutate(foreign_consumption_original_product_t = import_product_t - hs6_original_product_t) %>%
    # currently 16 negative consumption flows,
    # most problematic flows: ECU with 160419, IRL with 160530, HND with 160553
    arrange(desc(foreign_consumption_original_product_t)) %>%
    # FIXIT: removing negative flows for now but will revisit
    filter(foreign_consumption_original_product_t > 0) %>%
    # proportion of imports that were retained for unprocessed consumption
    mutate(prop_import_retained_product_t = foreign_consumption_original_product_t / import_product_t)
  
  unprocessed_consumption_props <- unprocessed_consumption %>%
    select(exporter_iso3c, hs6_original, prop_import_retained_product_t)
  
  # FIXIT: it is possible that the re-exports will not add back up after this disagregation
  
  tmp <- artis %>%
    left_join(
      unprocessed_consumption_props,
      by = c("importer_iso3c"="exporter_iso3c",
             "hs6"="hs6_original")
    ) %>%
    # Note: NAs represent flows where importer retained all imported product and did not re-export any
    replace_na(list(prop_import_retained_product_t = 1)) %>%
    mutate(consumption_foreign_product_t = product_weight_t * prop_import_retained_product_t)
  
  # live weight conversion factors for error exports
  hs_cf_means <- V1_long %>%
    group_by(hs6) %>% 
    summarise(live_weight_cf_mean = mean(live_weight_cf)) %>%
    ungroup() %>%
    mutate(hs6 = as.numeric(hs6))
  
  # disagregate foreign consumption across all intermediates and sciname habitat method
  disagregate_foreign_consumption_all <- tmp %>%
    mutate(SciName = paste(gsub(" ", "\\.", sciname), habitat, method, sep = "_")) %>%
    # FIXIT: need to add code to handle "unknown" habitat and method
    left_join(V1_long %>% 
                mutate(hs6 = as.numeric(hs6)),
              by = c("hs6", "SciName")) %>% 
    # Replace NA in live_weight_cf using hs_cf_means
    left_join(
      hs_cf_means %>% mutate(hs6 = as.numeric(hs6)), 
      by = c("hs6")) %>% 
    mutate(
      live_weight_cf = replace_na(live_weight_cf_mean),
      foreign_consumption_live_t = consumption_foreign_product_t * live_weight_cf) %>%
    # Remove the mean column if it's no longer needed
    select(-live_weight_cf_mean)  %>%
    # remove residual NAs rows with no data
    # FIXIT: Where are these NAs introduced - only importer and species 
    filter(!is.na(live_weight_cf))
  
  # add domestic and foreign consumption
  # DATA CHECK ONLY INCLUDE THIS DATA CHECK WHEN NO CODES ARE REMOVED FROM CONSUMPTION:
  # domestic consumption + foreign consumption = production + error exports
  total_consumption <- sum(consumption_domestic$consumption_live_t) + 
    sum(disagregate_foreign_consumption_all$foreign_consumption_live_t)
  
  data_check_consumption <- total_consumption / (sum(prod$live_weight_t) + sum(error_exports$live_weight_t))
  if (abs(1 - data_check_consumption) > 1e-3) {
    warning(paste0("(domestic consumption + foreign consumption) DOES NOT EQUAL (production + error exports)", 
                   " for ", curr_year, " and ", curr_hs_version, ". Test value should be 0. Test value is ", 
                   abs(1 - data_check_consumption) ))
  }
  
  # Test consumption by source country should not exceed production by source country
  consumption_source_check <- prod_data_analysis_year %>%
    group_by(source_country_iso3c = country_iso3_alpha,
             sciname = SciName,
             habitat,
             method = prod_method) %>%
    summarize(production_live_t = sum(quantity, na.rm = TRUE)) %>%
    ungroup() %>%
    full_join(
      # get domestic and foreign consumption
      consumption_domestic %>%
        group_by(source_country_iso3c = iso3c,
                 sciname,
                 habitat,
                 method) %>%
        summarize(domestic_consumption_live_t = sum(consumption_live_t, na.rm = TRUE)) %>%
        ungroup() %>%
        full_join(
          disagregate_foreign_consumption_all %>%
            group_by(source_country_iso3c,
                     sciname,
                     habitat,
                     method) %>%
            summarize(foreign_consumption_live_t = sum(foreign_consumption_live_t, na.rm = TRUE)) %>%
            ungroup()
        ) %>%
        replace_na(list(domestic_consumption_live_t = 0,
                        foreign_consumption_live_t = 0)) %>%
        mutate(total_consumption_live_t = domestic_consumption_live_t + foreign_consumption_live_t),
      by = c("source_country_iso3c",
             "sciname",
             "habitat",
             "method")
    ) %>%
    mutate(difference = production_live_t - total_consumption_live_t) %>%
    arrange(desc(difference))
  
  
}

@theamarks
Copy link
Member Author

2025-01-24 Meeting Notes w/ Jessica, Rahul, Althea

Rethinking the flow of consumption calculations

Calculate foreign consumption by source country

source country = production - domestic consumption

  • copying file consumption_debug_01122025.R to consumption_debug_01242025.R

@theamarks
Copy link
Member Author

theamarks commented Feb 7, 2025

2025-02-07 Notes

  • FIXIT / revisit: consumption line 26 artis change source_country_iso3c == "unknown" to "error"
  • all of a countries domestic exports are being attributed to a countries domestic imports and not allowing a proportion to be available for reexport. Need to fix foreign_consumption_dom .
    • After foreign_consumption_dom create new object reexport_processed that takes unprocessed_consumption and subtracts prop_import_retained_product_t from 1.
    • remove values that are 0, signifying no reexport
    • join on
    • label data as dom_source == "foreign" to explicitly label

Two forward paths:

  • Determine why the test is not working as expected
    • NAs could be associated intermediate product codes that are not recorded
  • Investigate if W_long assignments are not taking in account for intermediate product form that exists in reexport_processed. Would be find for products that remain and not reexported twice (two steps). Could go through reexport calculation process once more to get product form to final in order to use W_long. Sort out retained, so all trades link back to the correct dom_source
    • Proportions are constant for exports at both 1st and 2nd steps back (double checked that this assumption was what we want).

@theamarks
Copy link
Member Author

theamarks commented Feb 21, 2025

2025-02-21 Meeting

🥳 Jessica found solution! This meeting we are reviewing changes, cleaning up comments and code, and testing.

Notes for cleaning up new script

  • Make V1_long and V2_long explicit arguments in calculate_consumption()
  • Does prod group_by(sciname, commonname, etc.) need to happen sooner? There are multiple observations due to possibility of have multiple common names. Cleaned prod written out in 01-clean-input-data.R. Could multiple scinames be contained within prod_taxa_classification instead of prod_data?
  • unprocessed_consumption has negative values caused by processing cf's, needed?
  • consumption_export_1 joins on live_wieght conversions - not sure if this is used come back and check this.
  • per capita not included in this script at the moment
  • prod has multiple rows for a single flow because of multiple common names. 01-clean-input-data.R writes out standardized_fao_prod right after it is cleaned by standardize_countries() standardize_countries.r looks like the place to group_by() contains CommonName thus retaining multiple observations. I think it would make sense to concatenate multiple CommonName for a single observation. clean_fao_taxa.csv will have a record of SciName and multiple CommonNames. We might need to change some instances where common name is used to a str_detect() from == but otherwise seems likely to work without breaking anything

@theamarks
Copy link
Member Author

2025-02-28 Notes

  • v2_long needed restructuring - to join
  • reweight_W_long pulled out from function that originally created it
    • processing_cf was not used in calculating reweight_W_long - matters because reweight_w_long gets used in snet (not just consumption)
    • possible the checks that were not passing is because the snet that we were comparing to did not have processing_cf used to calculate
  • must remove filter consumption_t on domestic_consumption(is this the right object)` removes fishmeal

Persistent issues

  • Negatives still exist, but order of magnitude is much more appropriate. Probably caused by processing losses. Want to write out to keep track of.
  • Theoretically should be able to carry proportions and product weight through consumption calculations, but not working. We have shifted to carrying live_weight_t through to make it work

To-do

  1. take this script clean to make new consumption.R add per capita
  2. Make sure it still works within the pipeline (function arguments added )
  3. Integrate changed rewieght_W_long into the create_reweight_W_long.R that originally creates this object
    a) Rerun with new consumption and rewieght_W_long
  4. With new inputs into consumption - stop changing calculations - line-by-line cleaning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
Status: 🏗 In Progress
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants