Skip to content

Commit

Permalink
fix: update logger errors
Browse files Browse the repository at this point in the history
  • Loading branch information
energyLS committed Aug 8, 2023
1 parent 5c32e31 commit ed5ede2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/add_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,20 @@ def create_export_profile():

if np.abs(export_profile.sum() - export_h2) > 1: # Threshold of 1 MWh
logger.error(
f"Sum of ship profile ({export_profile.sum().values[0]/1e6} TWh) does not match export demand ({export_h2} TWh)"
f"Sum of ship profile ({export_profile.sum()/1e6} TWh) does not match export demand ({export_h2} TWh)"
)
raise ValueError(
f"Sum of ship profile ({export_profile.sum().values[0]/1e6} TWh) does not match export demand ({export_h2} TWh)"
f"Sum of ship profile ({export_profile.sum()/1e6} TWh) does not match export demand ({export_h2} TWh)"
)

# Resample to temporal resolution defined in wildcard "sopts" with pandas resample
sopts = snakemake.wildcards.sopts.split("-")
export_profile = export_profile.resample(sopts[0]).mean()

# revise logger msg
export_type = snakemake.config["export"]["export_profile"]
logger.info(
f"The yearly export demand is {export_h2/1e6} TWh and resampled to {sopts[0]}"
f"The yearly export demand is {export_h2/1e6} TWh, profile generated based on {export_type} method and resampled to {sopts[0]}"
)

return export_profile
Expand Down

0 comments on commit ed5ede2

Please sign in to comment.