@@ -175,6 +175,7 @@ class ParserError(Exception):
175
175
[NSEW][EW]? (-[NSEW][EW]?)* )+))?
176
176
( \s+MOV\s+(?P<dir>[NSEW][EW]?) )?\s+""" ,
177
177
re .VERBOSE )
178
+ SNOWDEPTH_RE = re .compile (r"""^4/(?P<snowdepth>\d\d\d)\s+""" )
178
179
179
180
## translation of weather location codes
180
181
@@ -342,6 +343,7 @@ def __init__( self, metarcode, month=None, year=None, utcdelta=None):
342
343
self .precip_3hr = None # precipitation over the last 3 hours
343
344
self .precip_6hr = None # precipitation over the last 6 hours
344
345
self .precip_24hr = None # precipitation over the last 24 hours
346
+ self .snowdepth = None # snow depth (distance)
345
347
self ._trend = False # trend groups present (bool)
346
348
self ._trend_groups = [] # trend forecast groups
347
349
self ._remarks = [] # remarks (list of strings)
@@ -879,6 +881,13 @@ def _handleAutoRemark( self, d ):
879
881
self ._remarks .append ("Automated station" )
880
882
elif d ['type' ] == "2" :
881
883
self ._remarks .append ("Automated station (type 2)" )
884
+
885
+ def _handleSnowDepthRemark (self , d ):
886
+ """
887
+ Parse the 4/ group snowdepth report
888
+ """
889
+ self .snowdepth = distance (float (d ['snowdepth' ]), 'IN' )
890
+ self ._remarks .append (" snowdepth %s" % (self .snowdepth , ))
882
891
883
892
def _unparsedRemark ( self , d ):
884
893
"""
@@ -928,6 +937,7 @@ def _unparsedRemark( self, d ):
928
937
(PRESS_3HR_RE , _handlePress3hrRemark ),
929
938
(TEMP_6HR_RE , _handleTemp6hrRemark ),
930
939
(TEMP_24HR_RE , _handleTemp24hrRemark ),
940
+ (SNOWDEPTH_RE , _handleSnowDepthRemark ),
931
941
(UNPARSED_RE , _unparsedRemark ) ]
932
942
933
943
## functions that return text representations of conditions for output
0 commit comments