def main():
    if len(sys.argv) == 3 or len(sys.argv) == 4:
        calsimdss=sys.argv[1]
        outdss=sys.argv[2]
        #config=0
        if len(sys.argv) == 4:
            fpart=sys.argv[3]
        else:            
            fpart=""   # will match anything, so duplicates will give unexpected behavior
        fpart_modified=fpart
        if not(calsimdss.endswith(".dss") and outdss.endswith("dss")):
            raise SystemExit(use)
    elif len(sys.argv) == 2:
        configfile=sys.argv[1]
        config.setConfigVars(configfile)
        calsimdss=config.getAttr("CALSIMFILE")
        sjr_process=config.getAttr("SJR_PROCESS")
        outdss=config.getAttr("CALSIM_VAMP")
        fpart=calsim_study_fpart(modify=0)
        fpart_modified=calsim_study_fpart(modify=1)
    else:
	    raise "wrong number of arguments in script prep_vamp"
	
    prep_vamp_vernalis(calsimdss,outdss,fpart,fpart_modified) 
    prep_vamp_exports(calsimdss,outdss,fpart,fpart_modified,sjr_process)
    sys.exit()
Exemple #2
0
def main():
    if len(sys.argv) == 3 or len(sys.argv) == 4:
        calsimdss = sys.argv[1]
        outdss = sys.argv[2]
        #config=0
        if len(sys.argv) == 4:
            fpart = sys.argv[3]
        else:
            fpart = ""  # will match anything, so duplicates will give unexpected behavior
        fpart_modified = fpart
        if not (calsimdss.endswith(".dss") and outdss.endswith("dss")):
            raise SystemExit(use)
    elif len(sys.argv) == 2:
        configfile = sys.argv[1]
        config.setConfigVars(configfile)
        calsimdss = config.getAttr("CALSIMFILE")
        sjr_process = config.getAttr("SJR_PROCESS")
        outdss = config.getAttr("CALSIM_VAMP")
        fpart = calsim_study_fpart(modify=0)
        fpart_modified = calsim_study_fpart(modify=1)
    else:
        raise "wrong number of arguments in script prep_vamp"

    prep_vamp_vernalis(calsimdss, outdss, fpart, fpart_modified)
    prep_vamp_exports(calsimdss, outdss, fpart, fpart_modified, sjr_process)
    sys.exit()
Exemple #3
0
def main():
    if len(sys.argv) != 2:
        raise SystemExit("""
        Usage: vscript prep_ec.py configfile
        where configfile is the input file for configuration variables
        (give full path if not in current running shell)
        """)
    else:
        print "prep NDO for Martinez EC"
        infile = sys.argv[1]
        config.setConfigVars(infile)
        calsimdss = config.getAttr("CALSIMFILE")
        fpart = calsim_study_fpart(modify=0)

    startyr = int(config.getAttr('START_DATE')[5:])
    endyr = int(config.getAttr('END_DATE')[5:])
    if (startyr < 1974 and endyr > 1991):
        twstr = "01NOV1921 0000 - 01OCT2003 0000"
    else:
        twstr = "01OCT1974 0000 - 01OCT1991 0000"
    STEP = string.lower(config.getAttr('CALSIMSTEP'))

    prep_ndo(calsimdss, STEP, fpart, twstr)
    sys.exit()
Exemple #4
0
        print len(sys.argv),sys.argv[1],sys.argv[2],sys.argv[3]
        raise SystemExit("""
        Usage: vscript dsm2.py [both|hydro|qual] [configurationfile]
        where  configurationfile  is the input file for env variables
        (give full path if not in current running shell)
        and  both|hydro|qual indicates which DSM2 module
        to run, default is both
        """)
    else:
        dsm2module = sys.argv[1]
        infile = sys.argv[2]
    if dsm2module != "both" and dsm2module != "hydro" and dsm2module != "qual" and dsm2module != "ptm" and dsm2module != "qual_do" and dsm2module != "qual_ec":
        print 'Inputs: ' + sys.argv[1] + ' ' + sys.argv[2]
        raise SystemExit("""Must specify both, hydro, qual or ptm""")
    print 'Loading configuration file'
    setConfigVars(infile)

if dsm2module == "both" or dsm2module == "hydro":
    print 'Running Hydro'
################some change  made by Jon#####################    
    hydroexe=getAttr('hydroexe')
    hydroinp=getAttr('hydroinp')

    if hydroexe:
        command=getAttr('hydroexe')
        from os.path import exists
        if not exists(command):
            raise command+' is not a valid path'

    else:
        command='hydro.exe'
import config
import interpolate
from vtimeseries import timewindow
from vista.set import DataReference
import config
from planning_time_window import prepro_window

#
if __name__ == '__main__':
    if len(sys.argv) != 2:
        raise SystemExit("""
        Usage: vscript prep_ec.py configfile
        where configfile is the input file for configuration variables
        (give full path if not in current running shell)
        """)
    else:
        print "IN prep EC"
        infile = sys.argv[1]
        config.setConfigVars(infile)
        tw=prepro_window()
        print "Expanding seasonal DICU WQ drainage values"
        expand_seasonal.prep_dicu(
            config.getAttr('DICUFILE_EC'),        # original DICU DSS file for EC
            config.getAttr('DICUFILE_ECE'),       # processed DICU DSS file (will be input for DSM2)
            tw)
        planning_ec_mtz.planning_ec_mtz()
        planning_ec_vernalis.transfer_ec()  #direct copy of planning ec, no vamp
        sys.exit()


import sys
import config
import time
import jarray,math
import vutils
from vista.time import TimeFactory, TimeInterval,Time
from vista.set import DataReference, Units, Pathname
from vdss import opendss,findpath,writedss,find
from vtimeseries import timewindow,timeinterval
from config import getAttr,setConfigVars
from calsim_study_fpart import calsim_study_fpart
from planning_time_window import prepro_window
from jarray import zeros,array
from vista.set import RegularTimeSeries,DataSetAttr,DataType,Constants
from vdisplay import plot,tabulate
from vmath import per_avg, per_max, mov_avg, godin, per_min
from vutils import Constants, RegularTimeSeries
from transfer import transfer
configfile = sys.argv[1]      # configuration file
param = sys.argv[2]       # param is the second argument and can be "VOL_FP","EC_FP","200nodes_FP"
sind = int(sys.argv[3])   # start index of DSS Records
eind = int(sys.argv[4])   # end index of DSS Records
setConfigVars(configfile)
DSSENVVAR = "QUAL_OUTDSS_%s" % param
infile  = getAttr(DSSENVVAR)
g = opendss(infile)
outfile = "%s_PostPro.DSS"% infile[:-4]
print "Processing Results for..."
for n in range(sind-1,eind,1):
	ref = g[n]
Exemple #7
0
import config
from planning_time_window import prepro_window
from vdss import opendss, find, writedss

#
if __name__ == '__main__':
    if len(sys.argv) != 2:
        raise SystemExit("""
        Usage: vscript prep_doc.py configfile
        where configfile is the input file for configuration variables
        (give full path if not in current running shell)
        """)
    else:
        print "IN prep DOC"
        infile = sys.argv[1]
        config.setConfigVars(infile)
        tw = prepro_window()
        print "Expanding seasonal DICU DOC drainage values"
        expand_seasonal_bst.prep_dicu(
            config.getAttr('DICUFILE_DOC'),  # original DICU DSS file for EC
            config.getAttr(
                'DICUFILE_DOCE'
            ),  # processed DICU DSS file (will be input for DSM2)
            "DRAIN-DOC",
            tw)
        print "Expanding seasonal boundary DOC values"
#        expand_seasonal_bst.prep_dicu(
#            config.getAttr('TSFILE_DOC'),        # original DICU DSS file for EC
#            config.getAttr('DICUFILE_DOCE'),       # processed DICU DSS file (will be input for DSM2)
#            "DOC",tw)
Exemple #8
0
import sys
import config
import calendar
import time
import jarray,math
import vutils
import interpolator.ConservativeSpline
import conserve
from vista.time import TimeFactory, TimeInterval,Time
from vista.set import DataReference, Units
from vdss import opendss,findpath,writedss,find
from vtimeseries import timewindow,timeinterval
from config import getAttr,setConfigVars
from calsim_study_fpart import calsim_study_fpart
from planning_time_window import prepro_window
from jarray import zeros,array
from vista.set import RegularTimeSeries,DataSetAttr,DataType,Constants
from vdisplay import plot,tabulate
from vmath import per_avg, per_max, mov_avg
from vutils import Constants, RegularTimeSeries
def path_check(f,dsspath):
	paths = findpath(f,dsspath)
	if not paths or len(paths)>1:
		print "File: %s" % calsimfile
		raise "Path %s not found or not unique" % dsspath
	return paths[0]
def transpose_day(var_list):
# reads an array of bparts of 31 calsim monnthly timeseries and tranposes data in to single daily timeseries
# returns array of transposed daily timeseries data
# "varlist" => array of bparts of 31 CALSIM monthly timeseries data (e.g QSAC169_1DV, QSAC169_2DV etc)
Exemple #9
0
import sys
import config
import time
import jarray, math
import vutils
from vista.time import TimeFactory, TimeInterval, Time
from vista.set import DataReference, Units, Pathname
from vdss import opendss, findpath, writedss, find
from vtimeseries import timewindow, timeinterval
from config import getAttr, setConfigVars
from calsim_study_fpart import calsim_study_fpart
from planning_time_window import prepro_window
from jarray import zeros, array
from vista.set import RegularTimeSeries, DataSetAttr, DataType, Constants
from vdisplay import plot, tabulate
from vmath import per_avg, per_max, mov_avg, godin, per_min
from vutils import Constants, RegularTimeSeries
from transfer import transfer
configfile = sys.argv[1]  # configuration file
param = sys.argv[
    2]  # param is the second argument and can be "VOL_FP","EC_FP","200nodes_FP"
sind = int(sys.argv[3])  # start index of DSS Records
eind = int(sys.argv[4])  # end index of DSS Records
setConfigVars(configfile)
DSSENVVAR = "QUAL_OUTDSS_%s" % param
infile = getAttr(DSSENVVAR)
g = opendss(infile)
outfile = "%s_PostPro.DSS" % infile[:-4]
print "Processing Results for..."
for n in range(sind - 1, eind, 1):