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

Multiple fixes and improvements on MAGICC for damages #1736

Merged
merged 5 commits into from
Jul 15, 2024

Conversation

gabriel-abrahao
Copy link
Contributor

@gabriel-abrahao gabriel-abrahao commented Jul 11, 2024

Purpose of this PR

Fixes some file paths in the climate_assessment python file to be more generic. We still want it to work outside the cluster @tonnrueter , but that will need some improvements in the interfacing. This change here is better than what we currently have.

Also @fpiontek , you proposed the quickfix with the epsilon value a while ago, but it really doesn't work without it. Should we merge this and make it semi-permanent for now? I found myself always having to stash and reapply this line when I change branches, which feels like a bad sign

Furthermore, this PR makes the standard, between-iteration MAGICC for non-internalized damages use the same Python script used for the TIRF. This allows us a lot more flexibility, and now all MAGICC-related GDXs have yearly data at least until 2200.

@fpiontek this leaves the matter of what emissions to assume after 2150. Right now it's basically assuming all emissions stop after that, but we can also assume them constant with 2150 or 2100 values. It probably won't make much of a difference given the discounting, but we should have a sensible assumption here anyway.

Type of change

(Make sure to delete from the Type-of-change list the items not relevant to your PR)

  • Bug fix
  • Refactoring
  • New feature
  • Minor change (default scenarios show only small differences)
  • Fundamental change
  • This change requires a documentation update

Checklist:

  • My code follows the coding etiquette
  • I performed a self-review of my own code
  • I explained my changes within the PR, particularly in hard-to-understand areas
  • I checked that the in-code documentation is up-to-date
  • I adjusted the reporting in remind2 where it was needed
  • I adjusted forbiddenColumnNames in readCheckScenarioConfig.R in case the PR leads to deprecated switches
  • All automated model tests pass (FAIL 0 in the output of make test)
  • The changelog CHANGELOG.md has been updated correctly

Further information (optional):

  • Test runs are here:
  • Comparison of results (what changes by this PR?):

@@ -18,8 +18,8 @@

# TONN REMOVE start
# If these are already set, it shouldn't override it. We actually may not want to have a default but just throw an error if not set
Copy link
Contributor

@tonnrueter tonnrueter Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the code in the following lines actually overwrites the environment variables MAGICC_EXECUTABLE_7 & MAGICC_WORKER_ROOT_DIR. If you want to achieve the behavior described in this comment, change it to

class EnvironmentError(Exception):
    pass

for env_var in ["MAGICC_EXECUTABLE_7", "MAGICC_WORKER_ROOT_DIR"]:
    if os.environ.get(env_var, '') == '':
        # If clause covers both cases in which the env var is not set at all 
        # as well as the case in which it is set to an empty string
        raise EnvironmentError(f"{env_var} does not exist")
    # Optional debug prints
    print(f"Found '{env_var}' = '{os.environ.get(env_var)}' ")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

Copy link
Contributor

@fpiontek fpiontek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem with adding this, under the assumption that it recovers from the infeasibility in the next iteration. The SCC for the region with the infeasibility would not be calculated properly so I don't know exactly what happens then with the further calculation.

@gabriel-abrahao gabriel-abrahao changed the title Add epsilon to KWlikeItr to avoid div by 0 Multiple fixes and improvements on MAGICC for damages Jul 12, 2024
@gabriel-abrahao
Copy link
Contributor Author

Test runs are still in progress, but I don't see a reason for them not to work. I won't have a chance to check this until late in the day on Monday, so if someone needs this on Monday morning just check if this one here worked and if so feel free to merge:

/p/projects/piam/abrahao/scratch/tirf_remind/output/R_SSP2EU-PkBudg500-internalize-ar6_2024-07-12_17.42.14

@gabriel-abrahao gabriel-abrahao removed the request for review from orichters July 15, 2024 15:54
@gabriel-abrahao gabriel-abrahao merged commit d5e13ab into remindmodel:develop Jul 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants