changeset 450:c0786fe4ad94

small additions
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 11 Feb 2014 02:55:02 -0500
parents 1e4c1b6b0e0b
children cd342a774806
files python/pavement.py
diffstat 1 files changed, 31 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/python/pavement.py	Mon Feb 10 18:32:43 2014 -0500
+++ b/python/pavement.py	Tue Feb 11 02:55:02 2014 -0500
@@ -5,6 +5,13 @@
 
 __metaclass__ = type
 
+durabilities = {1: 98, #96 to 100
+                2: 85, #75 to 96
+                3: 72, #50 to 75
+                4: 32, #15 to 50
+                5: 7 #0 to 15
+                }
+
 def occ_max(a):
     if a != []:
         s = set(a)
@@ -174,22 +181,32 @@
     else:
         return [None]*2+[[None]*len(seuils_T)]+[None]*5
 
+
 class RTSS:
-    'class for data related to a RTSS:
+    '''class for data related to a RTSS:
     - agregating pavement marking measurements
     - RTSS characteristics from FMR: pavement type, age, AADT, truck AADT
-    - winter maintenance level from V155'
+    - winter maintenance level from V155
 
-    def __init__(self, id):
-        self.id = id
+    If divided highway, the RTSS ends with G or D and are distinct: there is no ambiguity
+    - retroreflectivity types: there are CB, RJ and RB
+    If undivided, ending with C
+    - durability is fine: ETAT_MARQG_RG ETAT_MARQG_CL ETAT_MARQG_RD (+SG/SD, but recent)
+    - retroreflectivity: CJ is center line, RB and SB are left/right if DEBUT-FIN>0 or <0
+    '''
+
+    def __init__(self, _id, name, data):
+        self.id = _id
+        self.name = name
+        self.data = data
 
 class MarkingTest:
     '''class for a test site for a given product
 
     including the series of measurements over the years'''
 
-    def __init__(self, id, paintingDate, paintingType, color, data):
-        self.id = id
+    def __init__(self, _id, paintingDate, paintingType, color, data):
+        self.id = _id
         self.paintingDate = paintingDate
         self.paintingType = paintingType
         self.color = color
@@ -233,5 +250,12 @@
             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)
-                variationData.append([measures[i-1]-measures[i], measures[i-1], days[i]-days[i-1], days[i-1], nDaysTNegative, nDaysThawFreeze] + deltaTemp + [nConsecutiveFrozenDays, totalRain, totalSnow, snowAboveThreshold, stdevTemp])
+                if dates[i-1].year+1 == dates[i].year:
+                    winter = 1
+                    if days[i-1]<365:
+                        firstWinter = 1
+                else:
+                    winter = 0
+                    firstWinter = 0
+                variationData.append([measures[i-1]-measures[i], measures[i-1], days[i]-days[i-1], days[i-1], winter, firstWinter, nDaysTNegative, nDaysThawFreeze] + deltaTemp + [nConsecutiveFrozenDays, totalRain, totalSnow, snowAboveThreshold, stdevTemp])
         return variationData