Created
July 29, 2016 18:40
-
-
Save mikshila/f520e96d40a2109d354e0ea5069c9bcf to your computer and use it in GitHub Desktop.
Code for managing soil moisture data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import * | |
import numpy as np | |
import pandas as pd | |
import matplotlib | |
import matplotlib.pyplot as plt | |
matplotlib.style.use('ggplot') | |
#read in the .dat file | |
DataIn = np.genfromtxt('CZC\czc13may.dat', delimiter=',', skip_header=1, ) | |
#create column names | |
my_columns =['Year', 'JulianDay','HRMin', 'TmpC', 'RelHum', 'BattV', 'PPTmm', 'Temp5cm', 'Temp10cm', 'Temp15cm', | |
'Temp20cm', 'Temp50cm','Temp100cm','SM5cm','SM10cm', 'SM15cm', 'SM20cm', 'SM50cm','SM100cm'] | |
#create data frame with data | |
df = pd.DataFrame(DataIn) | |
#assign column names to data frame | |
df.columns = my_columns | |
#make Julian Day the index | |
df.index = df.JulianDay | |
#plot the soil moisture data | |
plt.figure() | |
df.plot(x=df.index, y=['SM5cm','SM10cm', 'SM15cm', 'SM20cm', 'SM50cm','SM100cm']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment