Skip to content

Commit 73ebc8f

Browse files
authored
Merge pull request #76 from arfc/abstract
Add abstract
2 parents 458298a + c8d8756 commit 73ebc8f

33 files changed

+29011
-723
lines changed

analysis/Snakefile

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ch5_log = "ch5.log"
1717
ch4_log = "ch4.log"
1818
ch3_log = "ch3.log"
1919
ch2_log = "ch2.log"
20+
ch1_log = "ch1.log"
2021

2122
with open(f"{docs_path}Makefile", "r") as file:
2223
lines = file.readlines()
@@ -453,6 +454,70 @@ rule interview_chapter:
453454
echo $file >> {output}
454455
done
455456
"""
457+
#============================INTRODUCTION================================
458+
459+
rule retrieve_mauna_loa_data:
460+
output:
461+
mauna_loa_data = f"{data_path}co2_mlo_surface-insitu_1_ccgg_DailyData.txt"
462+
shell: f"""
463+
(cd {data_path} && curl -O https://gml.noaa.gov/aftp/data/trace_gases/co2/in-situ/surface/txt/co2_mlo_surface-insitu_1_ccgg_DailyData.txt)
464+
"""
465+
466+
rule retrieve_epa_inventory:
467+
output:
468+
epa_inventory = f"{data_path}us-ghg-inventory-2024-chapter-executive-summary_04-16-2024.pdf"
469+
shell:
470+
f"""
471+
(cd {data_path} && curl -O https://www.epa.gov/system/files/documents/2024-04/us-ghg-inventory-2024-chapter-executive-summary_04-16-2024.pdf)
472+
"""
473+
474+
rule plot_mauna_loa:
475+
input:
476+
mauna_loa_data = f"{data_path}co2_mlo_surface-insitu_1_ccgg_DailyData.txt"
477+
output:
478+
mauna_loa_plot = f"{docs_path}figures/01_introduction/mauna-loa-co2.pgf"
479+
script:
480+
"scripts/01-introduction-scripts/plot_mauna_loa.py"
481+
482+
rule plot_source_emissions:
483+
output:
484+
source_emissions_plot = f"{docs_path}figures/01_introduction/emissions-by-source.pgf"
485+
script:
486+
"scripts/01-introduction-scripts/plot_source_emissions.py"
487+
488+
rule plot_sector_emissions:
489+
input:
490+
epa_inventory = f"{data_path}us-ghg-inventory-2024-chapter-executive-summary_04-16-2024.pdf"
491+
output:
492+
sector_emissions_plot = f"{docs_path}figures/01_introduction/emissions-by-sector.pgf"
493+
script:
494+
"scripts/01-introduction-scripts/plot_sector_emissions.py"
495+
496+
497+
rule build_example_dag:
498+
params:
499+
chapter = "introduction_chapter"
500+
input: "Snakefile"
501+
output: "introduction_chapter_dag.png"
502+
shell:
503+
"snakemake {params.chapter} --dag | dot -Tpng > {output}"
504+
505+
506+
rule introduction_chapter:
507+
input:
508+
dag = "dag.png",
509+
example_dag = "introduction_chapter_dag.png",
510+
mauna_loa_plot = f"{docs_path}figures/01_introduction/mauna-loa-co2.pgf",
511+
source_emissions_plot = f"{docs_path}figures/01_introduction/emissions-by-source.pgf",
512+
sector_emissions_plot = f"{docs_path}figures/01_introduction/emissions-by-sector.pgf"
513+
output:
514+
ch1_log
515+
shell:
516+
"""
517+
for file in {input}; do
518+
echo $file >> {output}
519+
done
520+
"""
456521

457522

458523
#============================BUILD RULE================================
@@ -466,7 +531,7 @@ if sys.platform == 'Windows':
466531
ch4_log=ch4_log,
467532
ch3_log=ch3_log,
468533
ch2_log=ch2_log,
469-
dag = "dag.png"
534+
ch1_log=ch1_log,
470535
output: f"{docs_path}{output_name}.pdf"
471536
shell:
472537
f"""
@@ -485,7 +550,7 @@ elif sys.platform in ['darwin', 'linux']:
485550
ch4_log=ch4_log,
486551
ch3_log=ch3_log,
487552
ch2_log=ch2_log,
488-
dag = "dag.png"
553+
ch1_log=ch1_log,
489554
output: f"{docs_path}{output_name}.pdf"
490555
shell:
491556
f"""
@@ -497,4 +562,4 @@ rule build_dag:
497562
output:
498563
"dag.png"
499564
shell:
500-
"snakemake --dag | dot -Tpng > {output}"
565+
"snakemake --rulegraph | dot -Tpng > {output}"

analysis/dag.png

45.4 KB
Loading
23.8 KB
Loading

analysis/pres-plots/emissions-by-sector.ipynb

Lines changed: 84 additions & 43 deletions
Large diffs are not rendered by default.

analysis/pres-plots/emissions-by-source.ipynb

Lines changed: 53 additions & 67 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)