Converting time zone to Mountain Time

This page shows how to convert time zone from original UTC to Mountain Standard Time.

Conversion of local time from UTC

Read CSV data

Check here for how to read the data.

Time conversion

Specify a time lag (-6 hours) in the subroutine that generates the date and time format from the original “days of the year” and “hour” information.

        timestamp = dayofY_toTimeStamp(df,-6) 
def dayofY_toTimeStamp(df,deltt):

    newdate = pd.to_datetime(df.loc[:,'Year'].values*10000000+df.loc[:,'Day_of_Year'].values*10000+df.loc[:,'HrMin'], format='%Y%j%H%M') \
            + pd.Timedelta(hours=deltt)

    return newdate

Note

The time conversion does not include daylight savings time adjustment.

Sample program for creating a new MT dated data set

This program gets a filename under multiple directories (station names) and reads the data in one file in each directory.

Source file: convert.MTtime.py