Пример #1
0
    def readUserDefinedFilesYear(self, _nameFile, year, skypedLines=0):

        self.clean()

        self.userDefinedFileIsReaded = True

        nameUserDefinedFile = "%s\%s" % (self.path, _nameFile)

        self.load = load.loadBaseNumpy(nameUserDefinedFile)
        self.load.loadFileYear(year, splitArgument=None, verbose=True)

        self.name = self.load.namesVariables

        time = self.get("TIME")
        self.initialTime = time[0]
        self.timeStepUsed = (time[2] - time[1]) * 3600  # In seconds

        k = 0

        self.timeInHours = time[k:]
        myVar = self.load.variables.T
        myVarWithoutFirstTimes = myVar[k:][:]

        self.variables = myVarWithoutFirstTimes.T
        self.load.variables = myVarWithoutFirstTimes.T
Пример #2
0
    def readItProblemsFile(self, name):

        nameWithPath = os.path.join(self.outputPath, name)

        itFile = load.loadBaseNumpy(nameWithPath)
        itFile.loadFile(skypChar="!", splitArgument="\t")
        self.hourWhereItProblems = itFile.getByIndex(1)
Пример #3
0
    def readUserDefinedFiles(self,_nameFile,skypedLines=0,firstConsideredTime=8760,useOnlyOneYear=False):

        self.clean()

        self.userDefinedFileIsReaded=True
 
        nameUserDefinedFile = os.path.join(self.path,_nameFile)        

        self.load = load.loadBaseNumpy(nameUserDefinedFile)                
        self.load.loadFile(skypedLines=skypedLines,readLabels=True,verbose=True)
        
        self.name     = self.load.namesVariables

        time = self.get("TIME")
        
        self.initialTime  = time[0]
        self.timeStepUsed = (time[2]-time[1])*3600 # In seconds
        
        if(firstConsideredTime==None):
            yearsSimulated = time[len(time)-1]/8760
            if(utils.isWhole(yearsSimulated)):
                firstConsideredTime = time[len(time)-1] - 8760.
                print ("Number of years simulated : %d. First time considered is:%f. Last Time is :%f" % (yearsSimulated,firstConsideredTime,time[len(time)-1]))
                self.initialTime = firstConsideredTime
            else:    
                firstConsideredTime = self.initialTime
                print ("readUserDefinedFiles. First considered Time is initialTime:%f" % firstConsideredTime)
            
        k = 0
        for i in range(len(time)):
            if(time[i]>=firstConsideredTime):
#                raise ValueError("i:",i," time: ",time[i]," fistConsideredTime:",firstConsideredTime)
                k=i
                break
        
  
        print ("time[i-1]:%f time[i]:%f k:%d" % (time[k-1],time[k],k))

        if(useOnlyOneYear==True):
            
            last = 0
            for i in range(k,len(time)):
                if(time[i]>=(firstConsideredTime+8760)):
                    last=i
                    break
            
            print ("INDEX FOR ONE YEAR begin:%d last:%d"%(k,last))
            
            self.timeInHours = time[k:last]             
            myVar                  =  self.load.variables.T
            myVarWithoutFirstTimes = myVar[k:last][:]
        else:
            self.timeInHours = time[k:]             
            myVar                  =  self.load.variables.T
            myVarWithoutFirstTimes = myVar[k:][:]
            
        self.variables = myVarWithoutFirstTimes.T        
        self.load.variables = myVarWithoutFirstTimes.T
Пример #4
0
    def __init__(self, _path, _name):

        self.name = _name.split(".")[0]
        self.path = _path
        self.fileNameWithPath = "%s\\%s" % (_path, _name)

        self.load = load.loadBaseNumpy(self.fileNameWithPath)

        self.modifyFirstColumTime = False

        self.doubleLine = "==========DownSizeExp======================="
Пример #5
0
    def loadHourly(self):

        self.loadFile = load.loadBaseNumpy(self.fileNameRead)

        self.loadFile.loadFile(skypChar="#", skypedLines=0, splitArgument="\t")