@@ -175,6 +175,7 @@ class ParserError(Exception):
175175 [NSEW][EW]? (-[NSEW][EW]?)* )+))?
176176 ( \s+MOV\s+(?P<dir>[NSEW][EW]?) )?\s+""" ,
177177 re .VERBOSE )
178+ SNOWDEPTH_RE = re .compile (r"""^4/(?P<snowdepth>\d\d\d)\s+""" )
178179
179180## translation of weather location codes
180181
@@ -342,6 +343,7 @@ def __init__( self, metarcode, month=None, year=None, utcdelta=None):
342343 self .precip_3hr = None # precipitation over the last 3 hours
343344 self .precip_6hr = None # precipitation over the last 6 hours
344345 self .precip_24hr = None # precipitation over the last 24 hours
346+ self .snowdepth = None # snow depth (distance)
345347 self ._trend = False # trend groups present (bool)
346348 self ._trend_groups = [] # trend forecast groups
347349 self ._remarks = [] # remarks (list of strings)
@@ -879,6 +881,13 @@ def _handleAutoRemark( self, d ):
879881 self ._remarks .append ("Automated station" )
880882 elif d ['type' ] == "2" :
881883 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 , ))
882891
883892 def _unparsedRemark ( self , d ):
884893 """
@@ -928,6 +937,7 @@ def _unparsedRemark( self, d ):
928937 (PRESS_3HR_RE , _handlePress3hrRemark ),
929938 (TEMP_6HR_RE , _handleTemp6hrRemark ),
930939 (TEMP_24HR_RE , _handleTemp24hrRemark ),
940+ (SNOWDEPTH_RE , _handleSnowDepthRemark ),
931941 (UNPARSED_RE , _unparsedRemark ) ]
932942
933943 ## functions that return text representations of conditions for output
0 commit comments