Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest jupyter nbconvert
pip install black
- name: Check code formatting with black
run: |
black --check ./tests ./fluxie
- name: Install the package
run: |
pip install pytest jupyter nbconvert
pip install -e .
- name: Test with pytest
run: |
Expand Down
9 changes: 5 additions & 4 deletions fluxie/cli/annex_plot_generator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@
"%load_ext autoreload\n",
"%autoreload 2\n",
"import logging\n",
"\n",
"logging.basicConfig(level=logging.WARNING)\n",
"\n",
"import annex_plot_generator as pg\n",
"\n",
"### Define region of interest\n",
"regions = 'UK' # Focus countries: UK, SWITZERLAND, GERMANY, ITALY, NETHERLANDS, IRELAND, HUNGARY, NORWAY\n",
"regions = \"UK\" # Focus countries: UK, SWITZERLAND, GERMANY, ITALY, NETHERLANDS, IRELAND, HUNGARY, NORWAY\n",
"\n",
"### Choose inventory year\n",
"inventory_years = ['2024','2025']\n",
"inventory_years = [\"2024\", \"2025\"]\n",
"\n",
"### Set output path\n",
"output_path = '/path/to/save/figures/'\n",
"output_path = \"/path/to/save/figures/\"\n",
"\n",
"### Produce plots\n",
"pg.produce_plots(regions, output_path, inventory_years)\n"
"pg.produce_plots(regions, output_path, inventory_years)"
]
}
],
Expand Down
19 changes: 12 additions & 7 deletions fluxie/cli/annex_plot_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,21 @@ def produce_plots(
annual_res = pd.concat(annual_res_list, ignore_index=True)

hfcs_list = [s for s in annual_res.species.unique() if s[:3].lower() == "hfc"]
pfcs_list = [s for s in annual_res.species.unique() if s[:3].lower() in ["pfc","cf4"]]
pfcs_list = [
s for s in annual_res.species.unique() if s[:3].lower() in ["pfc", "cf4"]
]
main_gases_list = ["ch4", "n2o", "sf6", "nf3", "all_pfc", "all_hfc"]

for name, species_list in zip(["hfc", "pfc", "main_gases"],
[hfcs_list, pfcs_list, main_gases_list]):
for name, species_list in zip(
["hfc", "pfc", "main_gases"], [hfcs_list, pfcs_list, main_gases_list]
):
print(f"\nTABLE {name.upper().replace('_',' ')}")
sp_res = create_str_dataframe(annual_res,
inventory_years,
species_list,
table_start_date=annex_config_data.start_date_table)
sp_res = create_str_dataframe(
annual_res,
inventory_years,
species_list,
table_start_date=annex_config_data.start_date_table,
)
make_table(sp_res, output_path / f"{name}_res_{region}.tex", inventory_years)
sp_res.to_csv(output_path / f"{name}_res_{region}.csv", index=False)

Expand Down
63 changes: 32 additions & 31 deletions fluxie/cli/config_annex_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,53 +35,54 @@

# Lat/Lon limits in spatial maps
map_limits = {
"UK": [-12,6,47,65],
"SWITZERLAND": [4,12,44.5,50],
"GERMANY": [2.5,15.5,46,57], #NOTE: equal to automatic GERMANY country mask, but needed for proper ITMS comparison
"ITALY": [5,20,35,49],
"UK": [-12, 6, 47, 65],
"SWITZERLAND": [4, 12, 44.5, 50],
# NOTE: equal to automatic GERMANY country mask, but needed for proper ITMS comparison
"GERMANY": [2.5, 15.5, 46, 57],
"ITALY": [5, 20, 35, 49],
"NETHERLANDS": "BENELUX",
"BELGIUM": "BENELUX",
"BENELUX": "BENELUX",
"IRELAND": [-12,-2,50,58],
"HUNGARY": [14,25,44.5,50.5],
"NORWAY": [3,33,55,79],
"IRELAND": [-12, -2, 50, 58],
"HUNGARY": [14, 25, 44.5, 50.5],
"NORWAY": [3, 33, 55, 79],
}

# Limits in posterior spatial map color scale (in units flux_units_print)
# default = "auto"
fluxlim = {
"UK": {
"pfc116": [0,0.16],
"pfc318": [0,0.1],
"nf3": [0,0.04],
"pfc116": [0, 0.16],
"pfc318": [0, 0.1],
"nf3": [0, 0.04],
},
"IRELAND": {
"cf4": [0,0.5],
"pfc218": [0,0.4],
"pfc318": [0,0.1],
"sf6": [0,0.4],
"nf3": [0,0.04],
"cf4": [0, 0.5],
"pfc218": [0, 0.4],
"pfc318": [0, 0.1],
"sf6": [0, 0.4],
"nf3": [0, 0.04],
},
"NETHERLANDS": {
"ch4": [0,40000],
"cf4": [0,1],
"pfc218": [0,0.2],
"sf6": [0,1],
"ch4": [0, 40000],
"cf4": [0, 1],
"pfc218": [0, 0.2],
"sf6": [0, 1],
},
"BELGIUM": {
"ch4": [0,40000],
"cf4": [0,1],
"pfc218": [0,0.2],
"sf6": [0,1],
"ch4": [0, 40000],
"cf4": [0, 1],
"pfc218": [0, 0.2],
"sf6": [0, 1],
},
"BENELUX": {
"ch4": [0,40000],
"cf4": [0,1],
"pfc218": [0,0.2],
"sf6": [0,1],
"ch4": [0, 40000],
"cf4": [0, 1],
"pfc218": [0, 0.2],
"sf6": [0, 1],
},
"ITALY": {
"hfc23": [0,1],
"hfc23": [0, 1],
},
}

Expand Down Expand Up @@ -112,7 +113,7 @@
"hfc23": 0.95,
"hfc236fa": 0.98,
"hfc245fa": 0.95,
"hfc365mfc": 0.985,
"hfc365mfc": 0.985,
"cf4": 0.97,
"sf6": 0.96,
},
Expand Down Expand Up @@ -205,7 +206,7 @@
"hfc236fa": 0.985,
"hfc245fa": 0.96,
"hfc365mfc": 0.96,
"hfc4310mee": 0.98,
"hfc4310mee": 0.98,
"pfc116": 0.9999,
},
"HUNGARY": {
Expand All @@ -215,7 +216,7 @@
"hfc134a": 0.95,
"hfc143a": 0.999,
"hfc227ea": 0.97,
"hfc23":0.98,
"hfc23": 0.98,
"cf4": 0.98,
"pfc116": 0.995,
"pfc218": 1,
Expand Down
Loading
Loading