Skip to content

Updating the d00_pickle_prep.py script - #3

Open
prateek-joshi-31 wants to merge 1 commit into
mainfrom
updates-d00script
Open

Updating the d00_pickle_prep.py script#3
prateek-joshi-31 wants to merge 1 commit into
mainfrom
updates-d00script

Conversation

@prateek-joshi-31

Copy link
Copy Markdown
Collaborator

Summary

A slight change to the d00_pickle_prep.py script was made. Previously, the variable "weather_year" was hard-coded in the script. This feature did not allow for parallel model runs using different values for "weather_year". Now, the script dynamically sets the "weather_year" variable based on the particular scenario name and details, allowing for parallel model runs using different values for "weather_year".

Technical Details

Implementation notes

Additional changes (if any)

Switches added/removed/changed (if any)

Issues resolved (if any)

Known incompatibilities (if any)

Relevant sources or documentation (if any)

Is the model cleaner/better/faster/smaller than before? If so, how?

Validation / Comparison Report

Link to report and/or example plots

(if pertinent) How big is the default run folder before and after the change?

(if pertinent) What is the run time for a basic run (5 years) on the same machine before and after the change?

Review

Was anything relevant to the ReEDS-to-PCM conversion changed?

No.

…iable is not hard-coded but rather dynamically set based on the scenario

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Augur pickle-prep script to remove the hard-coded weather_year and instead infer it dynamically from the scenario/case name, enabling parallel runs across different weather years.

Changes:

  • Derives weather_year by parsing a 4-digit suffix from the scenario string and validates it is within 2014–2024.
  • Switches RECF input loading to use India_8760_recf_{weather_year}.pkl rather than a single fixed file.
  • Adds an existence check with a clearer error if the weather-year-specific RECF pickle is missing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +38 to 55
# -------- Determine the weather_year from the scenario name --------
# Every scenario name ends with its 4-digit weather year (e.g. BaseCase2015),
# matching the 'WeatherYear' switch in cases.csv. This allows multiple
# weather-year scenarios to run in parallel without a hard-coded year.
weather_year_match = re.search(r'(\d{4})$', scenario)
if weather_year_match is None:
raise ValueError(
"Could not determine the weather year from scenario '{}'. "
"Scenario names must end with a 4-digit weather year "
"(e.g. 'BaseCase2015').".format(scenario))
weather_year = int(weather_year_match.group(1))
if not 2014 <= weather_year <= 2024:
raise ValueError(
"Weather year {} parsed from scenario '{}' is outside the "
"supported range (2014 - 2024).".format(weather_year, scenario))

# -------- Define the file paths --------
user, runname = scenario.split('_')[0], scenario.split('_')[0] + '_' + scenario.split('_')[1]
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.

2 participants