changeset 475:819eef979d3f

clarified argument name and made it available in a calling function
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 23 Mar 2014 23:49:37 -0400
parents 59903d14d244
children ed4166b0ba9d
files python/pavement.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/python/pavement.py	Thu Mar 13 01:48:04 2014 -0400
+++ b/python/pavement.py	Sun Mar 23 23:49:37 2014 -0400
@@ -133,12 +133,12 @@
 
     return (somme_eau, somme_neige, neigeMTQ_sup_seuil, somme_abrasif, somme_sel, somme_lc, somme_lrg, somme_lrd, premiere_neige, autres_abrasifs)
 
-def ecWeatherIndicators(data, startDate, endDate, snowThreshold, datatype, minProportionMeasures = 0.):
+def ecWeatherIndicators(data, startDate, endDate, snowThreshold, weatherDatatype, minProportionMeasures = 0.):
     '''Computes the indicators from Environment Canada files
     (loaded as a recarray using csv2rec in data),
     between start and end dates (datetime.datetime objects)
 
-    dataType is to indicate Environnement Canada data ('ec') or else MTQ
+    weatherDataType is to indicate Environnement Canada data ('ec') or else MTQ
     minProportionMeasures is proportion of measures necessary to consider the indicators'''
     from matplotlib.mlab import find
     nbre_jours_T_negatif,nbre_jours_gel_degel,pluie_tot,neige_tot,ecart_type_T = 0,0,0,0,0
@@ -158,7 +158,7 @@
                 tmin = data['tmin'][i]
             else:
                 tmin = None
-            if datatype == 'ec':
+            if weatherDatatype == 'ec':
                 if data['pluie_tot'][i] != None and not np.isnan(data['pluie_tot'][i]):
                     pluie_tot  += data['pluie_tot'][i]
                 if data['neige_tot'][i] != None and not np.isnan(data['neige_tot'][i]):
@@ -279,7 +279,7 @@
         for i in range(1,7):
             self.plot('{}_{}'.format(measure, i), options, dayRatio, **kwargs)
 
-    def computeMarkingMeasureVariations(self, dataLabel, lanePositions, weatherData, snowThreshold, minProportionMeasures = 0.):
+    def computeMarkingMeasureVariations(self, dataLabel, lanePositions, weatherData, snowThreshold, weatherDataType = 'ec', minProportionMeasures = 0.):
         '''Computes for each successive measurement
         lanePositions = None
         measure variation, initial measure, time duration, weather indicators
@@ -296,7 +296,7 @@
             dates = self.data[nonZeroIndices]['date_mesure']
             measures = self.data[nonZeroIndices][dataLabel]
             for i in range(1, len(dates)):
-                nDaysTNegative, nDaysThawFreeze, deltaTemp, nConsecutiveFrozenDays, totalRain, totalSnow, snowAboveThreshold, stdevTemp = ecWeatherIndicators(weatherData, dates[i-1], dates[i], snowThreshold, minProportionMeasures)
+                nDaysTNegative, nDaysThawFreeze, deltaTemp, nConsecutiveFrozenDays, totalRain, totalSnow, snowAboveThreshold, stdevTemp = ecWeatherIndicators(weatherData, dates[i-1], dates[i], snowThreshold, weatherDataType, minProportionMeasures)
                 if dates[i-1].year+1 == dates[i].year:
                     winter = 1
                     if days[i-1]<365: