Converting time zone to Mountain Time
This page shows how to convert time zone from original UTC to Mountain Standard Time.
Merge multiple datasets
When you run the program (here) that reads the original CSV data and generates a timestamp, the original data placed in the yearly directory is redistributed into each station’s directory, as shown below.
Now, we will merge multiple files in each directory and create one file at each station directory.
$ cd beaver
$ awk 1 *.csv > UCSRN_Hr_TBL.csv
Conversion of local time from UTC
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