Mercurial > hg > nsaunier > traffic-intelligence
comparison trafficintelligence/pavement.py @ 1112:956a66096e91
removed code now available in simulation project, and issue with deprecated find function in matplotlib
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 05 Jun 2019 13:12:10 -0400 |
| parents | c6cf75a2ed08 |
| children | 785c86013d2c |
comparison
equal
deleted
inserted
replaced
| 1111:345cd9cd62d8 | 1112:956a66096e91 |
|---|---|
| 141 (loaded as a recarray using csv2rec in data), | 141 (loaded as a recarray using csv2rec in data), |
| 142 between start and end dates (datetime.datetime objects) | 142 between start and end dates (datetime.datetime objects) |
| 143 | 143 |
| 144 weatherDataType is to indicate Environnement Canada data ('ec') or else MTQ | 144 weatherDataType is to indicate Environnement Canada data ('ec') or else MTQ |
| 145 minProportionMeasures is proportion of measures necessary to consider the indicators''' | 145 minProportionMeasures is proportion of measures necessary to consider the indicators''' |
| 146 from matplotlib.mlab import find | |
| 147 nbre_jours_T_negatif,nbre_jours_gel_degel,pluie_tot,neige_tot,ecart_type_T = 0,0,0,0,0 | 146 nbre_jours_T_negatif,nbre_jours_gel_degel,pluie_tot,neige_tot,ecart_type_T = 0,0,0,0,0 |
| 148 compteur,nbre_jours_gel_consecutifs=0,0 | 147 compteur,nbre_jours_gel_consecutifs=0,0 |
| 149 tmoys = [] | 148 tmoys = [] |
| 150 seuils_T = [20,15,10,5] | 149 seuils_T = [20,15,10,5] |
| 151 deltas_T = [0,0,0,0] | 150 deltas_T = [0,0,0,0] |
| 152 startIndex = find(data['date'] == startDate) | 151 startIndex = np.nonzero(data['date'] == startDate) |
| 153 nDays = int((endDate - startDate).days)+1 | 152 nDays = int((endDate - startDate).days)+1 |
| 154 if len(startIndex) > 0 and startIndex+nDays <= len(data): | 153 if len(startIndex) > 0 and startIndex+nDays <= len(data): |
| 155 startIndex = startIndex[0] | 154 startIndex = startIndex[0] |
| 156 for i in range(startIndex, startIndex+nDays): | 155 for i in range(startIndex, startIndex+nDays): |
| 157 if not np.isnan(data['tmax'][i]): | 156 if not np.isnan(data['tmax'][i]): |
| 200 else: | 199 else: |
| 201 return [None]*2+[[None]*len(seuils_T)]+[None]*5 | 200 return [None]*2+[[None]*len(seuils_T)]+[None]*5 |
| 202 | 201 |
| 203 def mtqWeatherIndicators(data, startDate, endDate,tmax,tmin,tmoy): | 202 def mtqWeatherIndicators(data, startDate, endDate,tmax,tmin,tmoy): |
| 204 print("Deprecated, use weatherIndicators") | 203 print("Deprecated, use weatherIndicators") |
| 205 from matplotlib.mlab import find | |
| 206 nbre_jours_T_negatif,nbre_jours_gel_degel,ecart_type_T = 0,0,0 | 204 nbre_jours_T_negatif,nbre_jours_gel_degel,ecart_type_T = 0,0,0 |
| 207 compteur,nbre_jours_gel_consecutifs=0,0 | 205 compteur,nbre_jours_gel_consecutifs=0,0 |
| 208 tmoys = [] | 206 tmoys = [] |
| 209 seuils_T = [20,15,10,5] | 207 seuils_T = [20,15,10,5] |
| 210 deltas_T = [0,0,0,0] | 208 deltas_T = [0,0,0,0] |
| 211 startIndex = find(data['date'] == startDate) | 209 startIndex = np.nonzero(data['date'] == startDate) |
| 212 nDays = (endDate - startDate).days+1 | 210 nDays = (endDate - startDate).days+1 |
| 213 for i in range(startIndex, startIndex+nDays): | 211 for i in range(startIndex, startIndex+nDays): |
| 214 if tmax[i] < 0: | 212 if tmax[i] < 0: |
| 215 nbre_jours_T_negatif += 1 | 213 nbre_jours_T_negatif += 1 |
| 216 if tmax[i] > 0 and tmin[i] < 0: | 214 if tmax[i] > 0 and tmin[i] < 0: |
