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

Improvements to input methods and initial documentation for methane functions #192

Merged
merged 23 commits into from
Sep 10, 2024

Conversation

knoiva-indecon
Copy link
Collaborator

@knoiva-indecon knoiva-indecon commented Aug 23, 2024

Improvements/fixes to methods for inputs:

  • Added step in "utils_import_inputs.R" functions to standardize special characters (e.g., "\." or "_") to spaces (i.e., " ") in inputs with region names. Also converted dots in region names in input population scenario to spaces.
  • Added steps to clear memory: Added gc() statement to free up unused memory between steps
  • Fixed issues with formatting input scenarios for SV module:
    • Added helper function to "utils.R" to zero out temperature or SLR scenarios based on a reference year. New helper function adds a step where non-ID and value columns are joined to the zeroed tibble (with a single point with both the ID and value columns set to zero) to correct issue with mismatch between column numbers during row bind stage. This issue was found for SV, since the SV scenarios have a scenario column that is neither an ID column nor a value column.
  • Deleted "defaultResults.rda" (and also deleted step in YML creating the default results) since this dataframe is now quite large and the results are easy to recreate with run_fredi()
  • Updated YML to create default scenarios for methane
  • Initialized methane documentation
  • Updated coefficients and method for calculating mortality. New method uses the natural log of population instead of the relative difference between population and RFF population
  • Updated default methane scenario to scenario from FAIR (documentation not yet updated)
  • Moved a line standardizing region for driver values to an earlier step, since this only needs to be done for ozone inputs

Added driver values, units to outputs
- Edited region names in population scenario (had dots instead of spaces)
- Added step to `check_regions()` function in "utils_import_inputs.R" to standardize region in user inputs
- Moved step to check regions for pop, o3 inputs before calculation of population
Added steps wtih `gc()` to free up memory
Added lines with `gc()` to free up unused memory
- Step where temps, SLR were zero out was causing issues with scenario ID for SV
- Added step to keep scenario ID
Fixed issue with columns in step to format input scenarios:

- Added helper function to "utils.R" to help zero out temp and SLR scenarios
- Tested functions
Deleted default results (too large now)
Updated build YML to update GDP, Population default scenarios
- Deleted references to default results in "data.R" and "run_fredi.R".
- Updated examples in "run_fredi.R" and "run_fredi_sv.R" with new scenario data and file names
Added steps to save ozone, methane, and nox default scenarios
- Added comments to some argument definitions
- Deleted deprecated comments
Added steps to make columns more robust to FrEDI methane. Can't aggregate on FrEDI methane, however, unless driver scenario is dropped
Added additional steps to standardize the columns and model names in the ozone scenario
Deleted the default scenario from the data description and renamed `gdpScenario` and `popScenario` to `gdpDefault` and `popDefault`, respectively
Reorganized order of inputList item descriptions and corrected typos
Added additional information about regions in `import_inputs`
Initialized function documentation for `run_fredi_methane`
Changed formula for `calc_methane_mortality` in "utils_methane.R" to use the natural log of population, rather than the relative population.  The rationale for the change from using relative population to population is that we only have one mortality rate for 2020, so we can’t take into account the fact that there are multiple different 2020 mortality rates in the original RFF data (despite constant population). The new formula uses coefficients for the “poplograw” (i.e., log of population) regression for all years.
Updated methane data with:
- New coefficients for a different approach to calculating mortality for methane (new method using a log of population instead of a relative population)
- Standardized region and model labels in default ozone scenario with labels for presentation
- Updated default methane scenario with new scenario and default ozone scenario values
Updated `calc_methane_mortality` with method to calculate mortality using log of population instead of population relative to RFF population
Added steps to standardize region and model in methane steps. Removed step in "build_fredi.yml" to standardize model name in O3 default (now done in pre-processing)
Fixed line mutating region for drivers...moved to earlier step, for O3 inputs only
Corrected which columns get printed out if columns are missing in checks for `import_input` utilities
@cahartin
Copy link
Collaborator

@knoiva-indecon are you still waiting to merge this in? i tagged @emcduffie as a code reviewer

@knoiva-indecon
Copy link
Collaborator Author

@knoiva-indecon are you still waiting to merge this in? i tagged @emcduffie as a code reviewer

There are some additional edits on this branch so I was adding some additional small edits here before merging.

@knoiva-indecon knoiva-indecon merged commit 4708091 into fredi_methane_dev Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants