Index: wflow-py/wflow/sphy/reporting.py =================================================================== diff -u -re59169d4b535e077a267eba3d2ba75f73803fbc8 -r36b469410a4a5af24c3902cbebb595e9da83c7bb --- wflow-py/wflow/sphy/reporting.py (.../reporting.py) (revision e59169d4b535e077a267eba3d2ba75f73803fbc8) +++ wflow-py/wflow/sphy/reporting.py (.../reporting.py) (revision 36b469410a4a5af24c3902cbebb595e9da83c7bb) @@ -1,25 +1,25 @@ -#-Function to report the output +# -Function to report the output def REPM(self, pcr, tot, var, fname, outops, TSS=False, MAP=False): - if outops == 'Day': + if outops == "Day": if TSS: TSS.sample(var) if MAP: self.report(var, self.outpath + fname) tot = 0 - elif outops == 'Month': + elif outops == "Month": dim = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] if self.calendar.isleap(self.curdate.year): dim[1] = 29 else: dim[1] = 28 tot = tot + var - if self.curdate.day == dim[self.curdate.month-1]: + if self.curdate.day == dim[self.curdate.month - 1]: if TSS: TSS.sample(tot) if MAP: - self.report(tot, self.outpath + fname + 'M') + self.report(tot, self.outpath + fname + "M") tot = 0 - elif outops == 'Year': + elif outops == "Year": if self.calendar.isleap(self.curdate.year): ydays = 366 else: @@ -29,29 +29,67 @@ if TSS: TSS.sample(tot) if MAP: - self.report(tot, self.outpath + fname + 'Y') + self.report(tot, self.outpath + fname + "Y") tot = 0 else: tot = tot + var if self.curdate == self.enddate: - pcr.report(tot, self.outpath + fname + '.map') + pcr.report(tot, self.outpath + fname + ".map") tot = 0 return tot - -#-Function to initialise the reporting + + +# -Function to initialise the reporting def reporting(self, pcr, tot, var): - for outops in ['Day','Month','Year','Final']: + for outops in ["Day", "Month", "Year", "Final"]: try: - TSS = eval('self.' + tot + '_' + outops + 'TS') + TSS = eval("self." + tot + "_" + outops + "TS") try: - MAP = eval('self.' + tot + '_' + outops + '_map') - setattr(self, tot + '_'+outops, REPM(self, pcr, eval('self.'+tot+'_'+outops), var, eval('self.'+tot+'_fname'), outops, TSS, MAP)) + MAP = eval("self." + tot + "_" + outops + "_map") + setattr( + self, + tot + "_" + outops, + REPM( + self, + pcr, + eval("self." + tot + "_" + outops), + var, + eval("self." + tot + "_fname"), + outops, + TSS, + MAP, + ), + ) except: - setattr(self, tot + '_'+outops, REPM(self, pcr, eval('self.'+tot+'_'+outops), var, eval('self.'+tot+'_fname'), outops, TSS)) + setattr( + self, + tot + "_" + outops, + REPM( + self, + pcr, + eval("self." + tot + "_" + outops), + var, + eval("self." + tot + "_fname"), + outops, + TSS, + ), + ) except: try: - MAP = eval('self.' + tot + '_' + outops + '_map') - setattr(self, tot + '_'+outops, REPM(self, pcr, eval('self.'+tot+'_'+outops), var, eval('self.'+tot+'_fname'), outops, False, MAP)) + MAP = eval("self." + tot + "_" + outops + "_map") + setattr( + self, + tot + "_" + outops, + REPM( + self, + pcr, + eval("self." + tot + "_" + outops), + var, + eval("self." + tot + "_fname"), + outops, + False, + MAP, + ), + ) except: - pass - + pass