@classmethod<EOL><INDENT>def from_string(cls, analysis_period_string):<DEDENT>
<EOL>is_leap_year = True if analysis_period_string.strip()[-<NUM_LIT:1>] == '<STR_LIT:*>' else False<EOL>ap = analysis_period_string.lower().replace('<STR_LIT:U+0020>', '<STR_LIT>').replace('<STR_LIT:to>', '<STR_LIT:U+0020>').replace('<STR_LIT>', '<STR_LIT:U+0020>').replace('<STR_LIT:/>', '<STR_LIT:U+0020>').replace('<STR_LIT>', '<STR_LIT:U+0020>').replace('<STR_LIT:@>', '<STR_LIT:U+0020>').replace('<STR_LIT:*>', '<STR_LIT>')<EOL>try:<EOL><INDENT>st_month, st_day, end_month, end_day,st_hour, end_hour, timestep = ap.split('<STR_LIT:U+0020>')<EOL>return cls(st_month, st_day, st_hour, end_month,<EOL>end_day, end_hour, int(timestep), is_leap_year)<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise ValueError(str(e))<EOL><DEDENT>
Create an Analysis Period object from an analysis period string.

            %s/%s to %s/%s between %s and %s @%s