Skip to content

Commit

Permalink
adding script plot for joss
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel42 committed Dec 18, 2024
1 parent 5d054d0 commit 524d18d
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions scripts/plots/plot_for_joss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""Script to produce the plot in the emiproc paper in the joss."""

# %%
from pathlib import Path
import matplotlib.pyplot as plt
from emiproc.plots import plot_inventory
from emiproc.inventories.edgar import EDGARv8, download_edgar_files
from emiproc.inventories.utils import group_categories
from emiproc.regrid import remap_inventory
from emiproc.grids import RegularGrid

plt.style.use("default")
# %%
# path to input inventory
local_dir = Path("./edgar")
local_dir.mkdir(exist_ok=True)
download_edgar_files(local_dir, year=2022, substances=["CO2"])
inv = EDGARv8(local_dir / "v8.0_*.nc")
# output path and filename
output_dir = local_dir

# %% remap on a regular grid over Europe
grid = RegularGrid(
name="Europe",
xmin=-30,
xmax=60,
ymin=30,
ymax=74,
dx=0.1,
dy=0.1,
)
# %% Rempa the point sources
remapped = remap_inventory(inv, grid)

# %%
grouped = group_categories(remapped, {"total": remapped.categories})


# %%
plot_inventory(
grouped,
cmap="magma_r",
total_only=True,
figsize=(14, 7),
vmin=1e-8,
vmax=1e2,
out_dir=output_dir,
)

# %%

0 comments on commit 524d18d

Please sign in to comment.