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

Merging main branch into state level #95

Merged
merged 52 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2aefc4a
Initialized code for testing FrEDI
knoiva-indecon Oct 4, 2023
f10c196
Deleted createSystemData
knoiva-indecon Oct 4, 2023
4c9db3a
Renamed figure files and testing files in preparation to be included …
knoiva-indecon Oct 5, 2023
47464a3
Moved testing and report figure functions to main R folder (so that t…
knoiva-indecon Oct 5, 2023
e6debe0
Deleted functions for getting cowplot elements...no longer using pack…
knoiva-indecon Oct 5, 2023
a990542
Update utils_report_figures_scales.R
knoiva-indecon Oct 5, 2023
9cd2c3e
Update utils_plot_DOW_byModelType.R
knoiva-indecon Oct 5, 2023
f776c1a
Update utils_plot_DOW_byImpactTypes.R
knoiva-indecon Oct 5, 2023
50de078
Update utils_create_report_figures.R
knoiva-indecon Oct 5, 2023
564f520
Updated report figures
knoiva-indecon Oct 5, 2023
5dfee1e
Moved SLR scenarios figure
knoiva-indecon Oct 5, 2023
cc8a977
Update create_report_figures.R
knoiva-indecon Oct 5, 2023
11ade8d
Update DESCRIPTION
knoiva-indecon Oct 5, 2023
e0d0501
Renamed create_report_figures
knoiva-indecon Oct 5, 2023
cdeeb3e
Update create_DoW_results.R
knoiva-indecon Oct 5, 2023
066fb72
Update testing_general_fredi_test.R
knoiva-indecon Oct 5, 2023
9f1633a
Update create_DoW_results.R
knoiva-indecon Oct 5, 2023
a4a3165
Initialized build/test actions
knoiva-indecon Oct 5, 2023
056f4b6
Update DESCRIPTION
knoiva-indecon Oct 5, 2023
151b924
Merge pull request #87 from USEPA/initial_workflows_reportFigures_kmn
knoiva-indecon Oct 5, 2023
da4ca71
New function create_fig_scale_note
knoiva-indecon Oct 6, 2023
5db198f
Deleted figures for refYear = 2050
knoiva-indecon Oct 6, 2023
54859d4
Update utils_report_figures_scales.R
knoiva-indecon Oct 6, 2023
2908173
Update utils_report_figures_format_sector_names.R
knoiva-indecon Oct 6, 2023
6a9adf0
Update utils_report_figures_format_sector_names.R
knoiva-indecon Oct 6, 2023
7a8d5f8
Fixes to report figure code
knoiva-indecon Oct 6, 2023
ba4b571
Deleted old appendix figurs
knoiva-indecon Oct 6, 2023
4581b1a
add comment on line 113 and devtools load package
tonygard-indecon Oct 6, 2023
f8f494f
change artifact path
tonygard-indecon Oct 6, 2023
346b946
change artifact path
tonygard-indecon Oct 6, 2023
c7c109b
change artifact path with *
tonygard-indecon Oct 6, 2023
a06d366
take out conditionals of upload
tonygard-indecon Oct 6, 2023
392412a
change path back
tonygard-indecon Oct 6, 2023
632c15b
change path back
tonygard-indecon Oct 6, 2023
de1b7ff
true instead of yes
tonygard-indecon Oct 6, 2023
71717d9
add configTests.R
tonygard-indecon Oct 6, 2023
e350840
add configTests_utils.R
tonygard-indecon Oct 6, 2023
e98e8dd
load package first
tonygard-indecon Oct 6, 2023
e30d4b9
change data path
tonygard-indecon Oct 6, 2023
0d97a07
change path for figures
tonygard-indecon Oct 6, 2023
bd94ff8
Merge pull request #90 from tonygard-indecon/main
knoiva-indecon Oct 6, 2023
d129638
Improved figure code
knoiva-indecon Oct 7, 2023
95e2648
Deleted unused Fig 7 plots
knoiva-indecon Oct 7, 2023
d5886d9
Updated figures with new code
knoiva-indecon Oct 7, 2023
384722e
Merge pull request #91 from USEPA/initial_workflows_reportFigures
knoiva-indecon Oct 7, 2023
398dd50
Merge branch 'initial_workflows_reportFigures_kmn' into initial_workf…
knoiva-indecon Oct 7, 2023
03a0343
Merge branch 'initial_workflows' into initial_workflows_reportFigures
knoiva-indecon Oct 7, 2023
f9068ed
Update test_fredi.yml
knoiva-indecon Oct 7, 2023
b50aa3e
Merge pull request #92 from USEPA/initial_workflows_reportFigures
knoiva-indecon Oct 9, 2023
9c9cdb9
Merge pull request #93 from USEPA/initial_workflows
emcduffie Oct 10, 2023
b37ece4
github io updates
emcduffie Oct 10, 2023
6d3bf9d
github IO updates
emcduffie Oct 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/build_fredi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
### https://github.com/actions/upload-artifact
### https://github.blog/changelog/2021-11-10-github-actions-input-types-for-manual-workflows/
### https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
### https://github.com/r-lib/actions/tree/v2/setup-r-dependencies
### https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution
### For uploading artifacts:
### "path:" is the output path where Pandoc will write the compiled PDF.
### Note, this should be the same directory as the input paper.md
name: Build FrEDI Package

on: [workflow_dispatch]

jobs:
compile_data:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

name: Load Package Code
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup R
uses: r-lib/actions/setup-r@v2

- name: Setup R package dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache: true
cache-version: 1
packages: |
any::tidyverse
any::ggpubr
any::openxlsx
any::devtools

- name: Remove existing build
run: |
rm *.tar.gz


- name: Run create_DoW_results
run: |
Rscript -e '
### Main repo path, FrEDI project path, scripts path
rPath0 <- ".";
pPath0 <- rPath0 |> file.path("FrEDI")
oPath0 <- pPath0 |> file.path("data", "defaultResults.rda")

###### Create Default Results ######
pPath0 |> devtools::load_all()
defaultResults <- run_fredi()
save(defaultResults, file=oPath0))

###### Update Documentation ######
###### - Build Manual
###### - Add and build vignettes
###### - Generate Documentation
roxygen2::roxygenise(pPath0)
devtools::document(pkg = pPath0)
# devtools::build_manual(pkg = pPath0)
# devtools::build_vignettes(pkg = pPath0)

###### Build Package ######
###### - Build Package but don't include vignettes
devtools::build(pkg=pPath0, path=rPath0)
'


- name: Commit results
run: |
git config --local core.autocrlf false
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name "${{ github.actor }}"
git add *.tar.gz
git pull origin ${{ github.head_ref }} --autostash --rebase -X ours
git commit -a -m "New package build"
git push

168 changes: 168 additions & 0 deletions .github/workflows/test_fredi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
### https://github.com/actions/upload-artifact
### https://github.blog/changelog/2021-11-10-github-actions-input-types-for-manual-workflows/
### https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
### https://github.com/r-lib/actions/tree/v2/setup-r-dependencies
### https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution
### For uploading artifacts:
### "path:" is the output path where Pandoc will write the compiled PDF.
### Note, this should be the same directory as the input paper.md
name: Test FrEDI Package

# on: [workflow_dispatch]
on:
workflow_dispatch:
inputs:
run_tests:
type: choice
description: Run general tests
required: true
options:
- no
- yes
make_figures:
type: choice
description: Create report figures
required: true
options:
- no
- yes

jobs:
compile_data:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

name: Load Package Code
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Send input status
run: |
echo "${{ inputs.run_tests }} ${{ inputs.make_figures }}"

- name: Setup R
uses: r-lib/actions/setup-r@v2

- name: Setup R package dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache: true
cache-version: 1
packages: |
any::tidyverse
any::ggpubr
any::openxlsx
any::devtools

- name: Install FrEDI
run: |
Rscript -e '
devtools::install_github(
repo = "https://github.com/USEPA/FrEDI",
ref = "main",
subdir = "FrEDI",
dependencies = FALSE,
upgrade = "never",
force = TRUE,
type = "source"
)'

- name: Run create_DoW_results
run: |
Rscript -e '
### Which tests to do
do_tests <- "${{ inputs.run_tests }}" == "true"
do_figs <- "${{ inputs.make_figures }}" == "true"

### Main repo path, FrEDI project path, scripts path
rPath0 <- ".";
pPath0 <- rPath0 |> file.path("FrEDI")
sPath0 <- pPath0 |> file.path("scripts")
rPath0 |> list.files() |> print()
pPath0 |> list.files() |> print()
sPath0 |> list.files() |> print()

### Load FrEDI
pPath0 |> devtools::load_all()

### Where to save results
oPath0 <- pPath0 |> file.path("data_tests")
oPath1 <- oPath0 |> file.path("general")
oPath2 <- oPath0 |> file.path("report_figures")

### Test results
if(do_tests){
### Run FrEDI
results0 <- run_fredi()
### Run tests
tests0 <- results0 |> general_fredi_test(
outPath = oPath1,
save = TRUE,
return = TRUE,
overwrite = TRUE
)

### Create plot totals
listResults <- create_default_tablePlot()
save0 <- listResults |> save(file= oPath1 |> file.path("defaultScenarioTotals.rda")) |> try()

### Remove results
rm(results0, test0, listResults)
}

### Create report results
if(do_figs){
### Load source
sPath0 |> file.path("create_DoW_results.R") |> source()

### Create report figures
reports0 <- create_DoW_results(
outPath = oPath2,
saveFile = TRUE,
loadCode = "project",
silent = FALSE,
testing = TRUE,
return = FALSE,
fpath = pPath0
)

### Figure H results
results0 <- run_fredi(aggLevels=c("modelaverage", "national"))
results0 <- results0 |> filter(year %in% seq(2010, 2090, by=5))
save0 <- write.csv(results0, file=oPath1 |> file.path("FigH_results.csv", row.names=F)) |> try()
}
'

- name: Upload Tests
if: |
inputs.run_tests == 'yes'
uses: actions/upload-artifact@v3
with:
name: Test Data
path: |
./FrEDI/data_tests/general/defaultScenarioTotals.rda
./FrEDI/data_tests/general/testResults_fredi_general.xlsx

- name: Upload Report Figures
if: |
inputs.make_figures == 'yes'
uses: actions/upload-artifact@v3
with:
name: Report Data
path: |
./FrEDI/data_tests/report_figures/
./FrEDI/data_tests/general/FigH_results.csv
# #
# - name: Commit results
# run: |
# git config --local core.autocrlf false
# git config --local user.email "${{ github.actor }}@users.noreply.github.com"
# git config --local user.name "${{ github.actor }}"
# git add data/tmp_sysdata.rda
# git add data_tests/**.xlsx
# git pull origin ${{ github.head_ref }} --autostash --rebase -X ours
# git commit -a -m "Updated temporary system data and tests"
# git push

File renamed without changes.
45 changes: 23 additions & 22 deletions FrEDI/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@ Package: FrEDI
Title: The Framework for Evaluating Damages and Impacts (FrEDI)
Version: 3.4
Authors@R: c(person("Corinne", "Hartin",
email = "[email protected]",
role = c("aut","cre"),
email = "[email protected]",
role = c("aut","cre"),
comment = c(ORCID = "0000-0003-1834-6539",
github = "cahartin")),
person("Erin","McDuffie",
email = "[email protected]",
role = c("aut","ctb"),
comment = c(ORCID = "0000-0002-6845-6077",
github = "emcduffie")),
person("Karen","Noiva",
role = c("aut","ctb"),
comment = c(github = "knoiva-indecon")),
person("Will","Maddock",
role = "ctb",
comment = c(github = "maddockw")),
person("Tony","Gardella",
role = "ctb",
comment = c(github = "tonygard-indecon"))
)
github = "cahartin")),
person("Erin","McDuffie",
email = "[email protected]",
role = c("aut","ctb"),
comment = c(ORCID = "0000-0002-6845-6077",
github = "emcduffie")),
person("Karen","Noiva",
role = c("aut","ctb"),
comment = c(ORCID = "0000-0002-4412-5302",
github = "knoiva-indecon")),
person("Will","Maddock",
role = "ctb",
comment = c(ORCID = "0000-0002-6107-0315",
github = "maddockw")),
person("Tony","Gardella",
role = "ctb",
comment = c(ORCID = "0000-0003-4380-3412",
github = "tonygard-indecon"))
)
URL: https://usepa.github.io/FrEDI, https://epa.gov/cira/FrEDI/, https://github.com/USEPA/FrEDI/
Description: This R package models damages and impacts from climate change in the contiguous United States (CONUS)
using the Framework for Evaluating Damages and Impacts (FrEDI) developed as part of the Climate Change Impacts and
Expand All @@ -33,13 +36,11 @@ License: file LICENSE
Encoding: UTF-8
Depends: R (>= 3.5.0),
tidyverse,
dplyr,
ggplot2,
tidyr,
ggpubr,
openxlsx
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
LazyData: TRUE
Suggests: knitr, rmarkdown, prettydoc
Suggests: knitr, rmarkdown, prettydoc, devtools
VignetteBuilder: knitr
Language: en-US
Loading