Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I used Amir's current answer to make a working script for doe22, v48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

I used Amir's current answer to make a working script for doe22, v48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT: ... and here is a more developed version I'm filing away where each simulation's outputs aren't written over the previous run. For each simulation, the input file is renamed to append the weather file name, so that the resulting outputs have identifiable and unique names.

import glob
import subprocess
import shutil
import os

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            # strip '.inp' from w for commandline execution
            weather = w.replace('.BIN','')

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            inputname = i.replace('.inp','')
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe22batlocation, doe22version, input, weather])

            # remove the renamedinp copy various non-SIM output files generated
            os.remove(renamedinp)

I used Amir's current answer to make a working script for doe22, v48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT: ... and here is a more developed version I'm filing away where each simulation's outputs aren't written over the previous run. For each simulation, the input file is renamed to append the weather file name, so that the resulting outputs have identifiable and unique names.

import glob
import subprocess
import shutil
import os

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            # strip '.inp' from w for commandline execution
            weather = w.replace('.BIN','')

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            inputname = i.replace('.inp','')
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe22batlocation, doe22version, input, weather])

            # remove the renamedinp copy various non-SIM output files generated
            os.remove(renamedinp)
weatherbatch():

I used Amir's current answer to make a working script for doe22, v48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT: ... and here is a more developed version I'm filing away where each simulation's outputs aren't written over the previous run. For each simulation, the input file is renamed to append the weather file name, so that the resulting outputs have identifiable and unique names.

import glob
import subprocess
import shutil
import os

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            # strip '.inp' from w for commandline execution
            weather = w.replace('.BIN','')

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            inputname = i.replace('.inp','')
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe22batlocation, doe22version, input, weather])

            # remove the renamedinp copy various non-SIM output files generated
            os.remove(renamedinp)
weatherbatch():

weatherbatch()

I used Amir's current answer to make a working script for doe22, v48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT: ... and here is a more developed version I'm filing away where each simulation's outputs aren't written over the previous run. For each simulation, the input file is renamed to append the weather file name, so that the resulting outputs have identifiable and unique names.

import glob
import subprocess
import shutil
import os

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            # strip '.inp' from w for commandline execution
            weather = w.replace('.BIN','')

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            inputname = i.replace('.inp','')
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe22batlocation, doe22version, input, weather])

            # remove the renamedinp copy various non-SIM output files generated
copy
            os.remove(renamedinp)

weatherbatch()

I used Amir's current answer to make a working script for doe22, v48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT: ... and here is a more developed version I'm filing away where each simulation's outputs aren't written over the previous run. For each simulation, the input file is renamed to append the weather file name, so that the resulting outputs have identifiable and unique names.

import glob
import subprocess
import shutil
import os

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            # strip '.inp' '.BIN' from w for commandline execution
            weather = w.replace('.BIN','')

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            inputname = i.replace('.inp','')
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe22batlocation, doe22version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

weatherbatch()

I used Amir's current answer to make a working script for doe22, v48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT: ... and here is a more developed version I'm filing away where each simulation's outputs aren't written over the previous run. For each simulation, the input file is renamed to append the weather file name, so that the resulting outputs have identifiable and unique names.

import glob
import subprocess
import shutil
import os

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            # strip '.BIN' from w for commandline execution
            weather = w.replace('.BIN','')

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            inputname = i.replace('.inp','')
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe22batlocation, doe22version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

weatherbatch()

EDIT (10/11/16): ... I was prompted by a request to make this compatible when run directly from notepad++ to share the current, more polished state of this script. I specifically tested this and found it working with the notepad++ plugin "PyNPP." It's much further developed now, and incorporates a habit I've picked up to set things up with a "testing files" subdirectory... hopefully the intended structure is self-evident enough!

import glob
import subprocess
import shutil
import os
import re

#this function 'weatherbatch()' is designed to be executed in a working directory to include any number of weatherfiles (*.bin) and input files (*.inp).  It will simulate each unique combination possible between those files via doe2 commandline.  SIM output files should remain alongside the targeted files when the loop is finished with self-descriptive names to indicate which input and weatherfile corresponds.

# Review these environment variables for running doe2 on command line
doe2_location = 'C:\doe22'
doe2_version = 'EXE48r' #<-- As would be entered for command line execution
doe2bat_location = doe2_location+'\DOE22.BAT'
doe2_weather_directory = doe2_location+'\weather'

def weatherbatch():
    for w in glob.glob('*.BIN'):
        # get a copy of the weather file into the doe2 weather directory
        shutil.copy(w, doe2_weather_directory)

        for i in glob.glob('*.inp'):            
            # strip '.BIN' from w for commandline execution 
            # (done via regex to make this case-insensitive)
            weather = re.sub('\.bin', '', w, flags=re.IGNORECASE)

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            # (done via regex to make this case-insensitive)
            inputname = re.sub('\.inp', '', i, flags=re.IGNORECASE)
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe2bat_location, doe2_version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

# for testing purposes:
if __name__ == '__main__':
    import sys
    here = sys.path[0]

    # change the working directory to a subdirectory "testing files"  
    # where I've collected some .inp and .bin files
    os.chdir('./testing files')

    weatherbatch()

I used Amir's current answer to make a working script for doe22, v48r:v48r: import glob import subprocess

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT: ... and here is a more developed version I'm filing away where each simulation's outputs aren't written over the previous run. For each simulation, the input file is renamed to append the weather file name, so that the resulting outputs have identifiable and unique names.names. import glob import subprocess import shutil import os

import glob
import subprocess
import shutil
import os

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            # strip '.BIN' from w for commandline execution
            weather = w.replace('.BIN','')

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            inputname = i.replace('.inp','')
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe22batlocation, doe22version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

weatherbatch()

EDIT (10/11/16): ... I was prompted by a request to make this compatible when run directly from notepad++ to share the current, more polished state of this script. I specifically tested this and found it working with the notepad++ plugin "PyNPP." It's much further developed now, and incorporates a habit I've picked up to set things up with a "testing files" subdirectory... hopefully the intended structure is self-evident enough!enough! import glob import subprocess import shutil import os import re

import glob
import subprocess
import shutil
import os
import re

#this function 'weatherbatch()' is designed to be executed in a working directory to include any number of weatherfiles (*.bin) and input files (*.inp).  It will simulate each unique combination possible between those files via doe2 commandline.  SIM output files should remain alongside the targeted files when the loop is finished with self-descriptive names to indicate which input and weatherfile corresponds.

# Review these environment variables for running doe2 on command line
doe2_location = 'C:\doe22'
doe2_version = 'EXE48r' #<-- As would be entered for command line execution
doe2bat_location = doe2_location+'\DOE22.BAT'
doe2_weather_directory = doe2_location+'\weather'

def weatherbatch():
    for w in glob.glob('*.BIN'):
        # get a copy of the weather file into the doe2 weather directory
        shutil.copy(w, doe2_weather_directory)

        for i in glob.glob('*.inp'):            
            # strip '.BIN' from w for commandline execution 
            # (done via regex to make this case-insensitive)
            weather = re.sub('\.bin', '', w, flags=re.IGNORECASE)

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            # (done via regex to make this case-insensitive)
            inputname = re.sub('\.inp', '', i, flags=re.IGNORECASE)
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe2bat_location, doe2_version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

# for testing purposes:
if __name__ == '__main__':
    import sys
    here = sys.path[0]

    # change the working directory to a subdirectory "testing files"  
    # where I've collected some .inp and .bin files
    os.chdir('./testing files')

    weatherbatch()

I used Amir's current answer to make a working script for doe22, v48r: import glob import subprocessv48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT: ... and here is a more developed version where each simulation's outputs aren't written over the previous run. For each simulation, the input file is renamed to append the weather file name, so that the resulting outputs have identifiable and unique names. import glob import subprocess import shutil import osnames.

import glob
import subprocess
import shutil
import os

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            # strip '.BIN' from w for commandline execution
            weather = w.replace('.BIN','')

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            inputname = i.replace('.inp','')
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe22batlocation, doe22version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

weatherbatch()

EDIT (10/11/16): ... I was prompted by a request to make this compatible when run directly from notepad++ to share the current, more polished state of this script. I specifically tested this and found it working with the notepad++ plugin "PyNPP." It's much further developed now, and incorporates a habit I've picked up to set things up with a "testing files" subdirectory... hopefully the intended structure is self-evident enough! import glob import subprocess import shutil import os import re

import glob
import subprocess
import shutil
import os
import re

#this function 'weatherbatch()' is designed to be executed in a working directory to include any number of weatherfiles (*.bin) and input files (*.inp).  It will simulate each unique combination possible between those files via doe2 commandline.  SIM output files should remain alongside the targeted files when the loop is finished with self-descriptive names to indicate which input and weatherfile corresponds.

# Review these environment variables for running doe2 on command line
doe2_location = 'C:\doe22'
doe2_version = 'EXE48r' #<-- As would be entered for command line execution
doe2bat_location = doe2_location+'\DOE22.BAT'
doe2_weather_directory = doe2_location+'\weather'

def weatherbatch():
    for w in glob.glob('*.BIN'):
        # get a copy of the weather file into the doe2 weather directory
        shutil.copy(w, doe2_weather_directory)

        for i in glob.glob('*.inp'):            
            # strip '.BIN' from w for commandline execution 
            # (done via regex to make this case-insensitive)
            weather = re.sub('\.bin', '', w, flags=re.IGNORECASE)

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            # (done via regex to make this case-insensitive)
            inputname = re.sub('\.inp', '', i, flags=re.IGNORECASE)
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe2bat_location, doe2_version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

# for testing purposes:
if __name__ == '__main__':
    # change the working directory to a subdirectory "testing files"  
    # where I've collected some .inp and .bin files
    os.chdir('./testing files')

    weatherbatch()

Observe: 1. This is set up to work with a "testing files" subdirectory, hopefully the intended structure is self-evident! 2. string.replace() actions on the working filenames have been replaced by regular expression re.sub() equivalents to be case-insensitive

I used Amir's current answer to make a working script for doe22, v48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT: ... and here is a more developed version where each simulation's outputs aren't written over the previous run. For each simulation, the input file is renamed to append the weather file name, so that the resulting outputs have identifiable and unique names.

import glob
import subprocess
import shutil
import os

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            # strip '.BIN' from w for commandline execution
            weather = w.replace('.BIN','')

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            inputname = i.replace('.inp','')
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe22batlocation, doe22version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

weatherbatch()

EDIT (10/11/16): ... I was prompted by a request to make this compatible when run directly from notepad++ to share the current, more polished state of this script. I specifically tested this and found it working with the notepad++ plugin "PyNPP."

import glob
import subprocess
import shutil
import os
import re

#this function 'weatherbatch()' is designed to be executed in a working directory to include any number of weatherfiles (*.bin) and input files (*.inp).  It will simulate each unique combination possible between those files via doe2 commandline.  SIM output files should remain alongside the targeted files when the loop is finished with self-descriptive names to indicate which input and weatherfile corresponds.

# Review these environment variables for running doe2 on command line
doe2_location = 'C:\doe22'
doe2_version = 'EXE48r' #<-- As would be entered for command line execution
doe2bat_location = doe2_location+'\DOE22.BAT'
doe2_weather_directory = doe2_location+'\weather'

def weatherbatch():
    for w in glob.glob('*.BIN'):
        # get a copy of the weather file into the doe2 weather directory
        shutil.copy(w, doe2_weather_directory)

        for i in glob.glob('*.inp'):            
            # strip '.BIN' from w for commandline execution 
            # (done via regex to make this case-insensitive)
            weather = re.sub('\.bin', '', w, flags=re.IGNORECASE)

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            # (done via regex to make this case-insensitive)
            inputname = re.sub('\.inp', '', i, flags=re.IGNORECASE)
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe2bat_location, doe2_version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

# for testing purposes:
if __name__ == '__main__':
    # change the working directory to a subdirectory "testing files"  
    # where I've collected some .inp and .bin files
    os.chdir('./testing files')

    weatherbatch()

Observe: 1. Observe:

  1. This is set up to work with a a "testing files" subdirectory, subdirectory, hopefully the intended structure is self-evident! 2. is self-evident!
  2. string.replace() actions on the working filenames have been replaced by regular regular expression re.sub() equivalents to be case-insensitive

  3. I gather there are a few different ways you could be trying to execute this from notepad++... it might help in some instances to add shell = True to the end of the subprocess.call:
subprocess.call([doe2bat_location, doe2_version, input, weather], shell =True)

I used Amir's current answer to make a working script for doe22, v48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT: EDIT (10/12/2016): ... and here following is a more developed developed, current version where each simulation's outputs aren't written over the of the same script. I am retaining the relatively simplified example above in this answer to facilitate comparison and clarity of concept for others traversing the bridges between python, doe2, and e+. Previous iterations available in past edits to this answer for anyone interested.

I was prompted in the answer commentary to try and make this script compatible when executed directly from notepad++.
While I've pushed the module further in form/function, I confess I'm not certain what made previous run. For each simulation, the input file versions incompatible with notepad++ execution, and I only recently picked up the realization that was possible (I've been used to executing all python efforts from powershell). This is renamed to append the weather file name, so that the resulting outputs have identifiable and unique names.tested and working using Python 2.7 and the notepad++ plugin called "PyNPP" using the default shortcut Alt+Shift+F5.

I was also prompted to get my act together with respect to docstrings. Hopefully this is a little easier on our French friends' sensibilities now =)!

"""Automate batch simulation for any number of doe2 input & weather files."""

import os
import glob
import subprocess
import shutil
import os

# Check re

# Review these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'
doe2_location = 'C:\doe22'
doe2_version = 'EXE48r' #<-- As would be entered for command line execution
doe2bat_location = doe2_location+'\DOE22.BAT' 
doe2_weather_directory = doe2_location+'\weather'

def weatherbatch():
    for i weatherbatch(target_path):
    """This function will simulate every unique combination possible between a 
    group of co-located weather files (*.bin) and input files (*.inp) via doe2 
    commandline. 

    The argument 'target_path' is the directory containing the weather (*.bin) 
    and input (*.inp) files.

    When finished, BDL files and SIM output files with self-descriptive names 
    to indicate the associated weather / input combination should remain 
    alongside the targeted files.

    Be mindful limits to doe2 command line execution apply to this script as 
    well.  Excessive characters and the presence of any spaces in glob.glob('*.inp'):
    the input or
    weather file names will result in errors.
    """

    # store current working directory
    start_dir = os.getcwd()

    # move to the target directory containing the weather/input files
    os.chdir(target_path)

    for w in glob.glob('*.BIN'):
        # ensure a copy of the weatherfile exists in the doe2 weather directory
        shutil.copy(w, doe2_weather_directory)

        # strip '.BIN' from w for commandline execution
    execution 
        # (done via regex to make this case-insensitive)
        weather = w.replace('.BIN','')
re.sub('\.bin', '', w, flags=re.IGNORECASE)       

        for i in glob.glob('*.inp'):            
            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            # (done via regex to make this case-insensitive)
            inputname = i.replace('.inp','')
re.sub('\.inp', '', i, flags=re.IGNORECASE)
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            subprocess.call([doe22batlocation, doe22version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

weatherbatch()

EDIT (10/11/16): ... I was prompted by a request to make # execute commandline doe2 for this compatible when run directly from notepad++ to share the current, more polished state of this script. I specifically tested this and found it working with the notepad++ plugin "PyNPP."

import glob
import subprocess
import shutil
import os
import re

#this function 'weatherbatch()' is designed to be executed in a working directory to include any number of weatherfiles (*.bin) and input files (*.inp).  It will simulate each unique combination possible between those files via doe2 commandline.  SIM output files should remain alongside the targeted files when the loop is finished with self-descriptive names to indicate which input and weatherfile corresponds.

# Review these environment variables for running doe2 on command line
doe2_location = 'C:\doe22'
doe2_version = 'EXE48r' #<-- As would be entered for command line execution
doe2bat_location = doe2_location+'\DOE22.BAT'
doe2_weather_directory = doe2_location+'\weather'

def weatherbatch():
    for w in glob.glob('*.BIN'):
        # get a copy of the weather file into the doe2 weather directory
        shutil.copy(w, doe2_weather_directory)

        for i in glob.glob('*.inp'):            
            # strip '.BIN' from w for commandline execution 
            # (done via regex to make this case-insensitive)
            weather = re.sub('\.bin', '', w, flags=re.IGNORECASE)

            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            # (done via regex to make this case-insensitive)
            inputname = re.sub('\.inp', '', i, flags=re.IGNORECASE)
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

combination
            subprocess.call([doe2bat_location, doe2_version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

    # return to the original working directory
    os.chdir(start_dir)

# for testing purposes:
if __name__ == '__main__':
    # change the working directory to """A subdirectory '/testing files' is kept alongside this module, 
    containing a subdirectory "testing files"  
    # where I've collected some plurality of .inp and .bin files
    os.chdir('./testing files')

    weatherbatch()
files.
    """
    #establish the target directory
    testing_path = os.getcwd()+'/testing files'

    #execute weatherbatch on the target directory
    weatherbatch(testing_path)

Observe:Closing Observations:

  1. This is set up to work with a "testing files" subdirectory, hopefully the intended structure is self-evident!subdirectory. If you want to run this directly with minimal effort, you could remove +'/testing files' on line 71 to simply plop this into the same directory containing your *.INP and *.BIN files.
  2. string.replace() actions on the working filenames have been file names are replaced by regular expression re.sub() equivalents to be case-insensitivecase-insensitive (this is a little more robust).
  3. I gather there are a few different ways you one could be trying to execute this from notepad++... it might help in some instances to add shell = True to the end of the subprocess.call: like this:
subprocess.call([doe2bat_location, doe2_version, input, weather], shell =True)

I used Amir's current answer to make a working script for doe22, v48r:

import glob
import subprocess

# Check these environment variables for running doe2 on command line
doe22batlocation = 'C:\doe22\DOE22.BAT'
doe22version = 'EXE48r'

def weatherbatch():
    for i in glob.glob('*.inp'):
        for w in glob.glob('*.BIN'):
            input = i.replace('.inp','')
            weather = w.replace('.BIN','')
            subprocess.call([doe22batlocation, doe22version, input, weather])

weatherbatch()

EDIT (10/12/2016): ... and following is a more developed, current version of the same script. I am retaining the relatively simplified simple example above in this answer to facilitate comparison and clarity of concept for others traversing the bridges between python, doe2, and e+. Previous iterations available in past edits to this answer for anyone interested.

I was prompted in the answer commentary to try and make this script compatible when executed directly from notepad++.
While I've pushed the module further in form/function, I confess I'm not certain what made previous versions incompatible with notepad++ execution, and I only recently picked up the realization that was possible (I've been used to executing all python efforts to-date from powershell). This The following is tested and working using Python 2.7 and the notepad++ plugin called "PyNPP" using the default with the shortcut Alt+Shift+F5.

I was also prompted to get my act together with respect to docstrings. Hopefully docstring styling. As a self-learner I appreciate the encouragement, and hopefully this is a little easier on our French friends' sensibilities now =)!

"""Automate batch simulation for any number of doe2 input & weather files."""

import os
import glob
import subprocess
import shutil
import re

# Review these environment variables for running doe2 on command line
doe2_location = 'C:\doe22'
doe2_version = 'EXE48r' #<-- As would be entered for command line execution
doe2bat_location = doe2_location+'\DOE22.BAT' 
doe2_weather_directory = doe2_location+'\weather'

def weatherbatch(target_path):
    """This function will simulate every unique combination possible between a 
    group of co-located weather files (*.bin) and input files (*.inp) via doe2 
    commandline. 

    The argument 'target_path' is the directory containing the weather (*.bin) 
    and input (*.inp) files.

    When finished, BDL files and SIM output files with self-descriptive names 
    to indicate the associated weather / input combination should remain 
    alongside the targeted files.

    Be mindful limits to doe2 command line execution apply to this script as 
    well.  Excessive characters and the presence of any spaces in the input or
    weather file names will result in errors.
    """

    # store current working directory
    start_dir = os.getcwd()

    # move to the target directory containing the weather/input files
    os.chdir(target_path)

    for w in glob.glob('*.BIN'):
        # ensure a copy of the weatherfile exists in the doe2 weather directory
        shutil.copy(w, doe2_weather_directory)

        # strip '.BIN' from w for commandline execution 
        # (done via regex to make this case-insensitive)
        weather = re.sub('\.bin', '', w, flags=re.IGNORECASE)       

        for i in glob.glob('*.inp'):            
            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            # (done via regex to make this case-insensitive)
            inputname = re.sub('\.inp', '', i, flags=re.IGNORECASE)
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            # execute commandline doe2 for this weather + input combination
            subprocess.call([doe2bat_location, doe2_version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

    # return to the original working directory
    os.chdir(start_dir)

# for testing purposes:
if __name__ == '__main__':
    """A subdirectory '/testing files' is kept alongside this module, 
    containing a plurality of .inp and .bin files.
    """
    #establish the target directory
    testing_path = os.getcwd()+'/testing files'

    #execute weatherbatch on the target directory
    weatherbatch(testing_path)

Closing Observations:

  1. This is set up to work with a "testing files" subdirectory. subdirectory alongside the module. If you want to run this directly with minimal effort, you could remove +'/testing files' on line 71 to simply plop drop this into the same directory containing your *.INP and *.BIN files.
  2. string.replace() actions on the working file names are replaced by regular expression re.sub() equivalents to be case-insensitive (this is a little more robust).
  3. I gather there are a few different ways one could be trying approaches to execute this Python from notepad++... it might help in some instances to add shell = True to the end of the subprocess.call like this:
subprocess.call([doe2bat_location, doe2_version, input, weather], shell =True)