I have dataset called 'data.rei' and another called 'gages.txt'. The 'data.rei' contains data and 'gages.txt' contains location ID information and date/times that i want to link with data. I want to plot these, 1 graph per location to include date on x-axis and measured and modeled values on y-axis.
data.rei is formatted as follows:
MODEL OUTPUTS AT END OF OPTIMISATION ITERATION NO. 0:-
Note that weights have been adjusted in accordance with regularisation target objective function.
Name Group Measured Modelled Residual Weight
pdwl1 pdwls 2083.620 2089.673 -6.052805 9.4067000E-04
pdwl2 pdwls 2186.748 2199.771 -13.02284 8.9630800E-04
pdwl3 pdwls 2150.983 2160.259 -9.275730 9.1121100E-04
pdwl4 pdwls 2133.283 2142.970 -9.686504 9.1877100E-04
pdwl5 pdwls 2241.741 1769.331 472.4097 8.7432100E-04
pst_1 devwls 2191.200 2094.658 96.54200 1.000000
pst_2 devwls 2194.160 2094.070 100.0900 1.000000
pst_3 devwls 2190.790 2093.375 97.41500 1.000000
pst_4 devwls 2191.700 2092.671 99.02900 1.000000
pst_5 devwls 2188.260 2092.739 95.52100 1.000000
devfl1 devflux 1.2788475E+07 1.2199410E+07 589064.6 1.4030900E-06
devfl2 devflux 1.2208086E+07 1.2044727E+07 163359.4 1.4030900E-06
devfl3 devflux 1.3559062E+07 1.1423958E+07 2135104. 1.4030900E-06
devfl4 devflux 1.2419465E+07 1.1141419E+07 1278046. 1.4030900E-06
devfl5 devflux 1.2070242E+07 1.0925833E+07 1144409. 1.4030900E-06
gages.txt is as follows:
gage date pestID Measurement(cfd) weight group
06459175 10/1/1993 devfl1 12788474.59 1.40309E-06 devflux
06459175 11/1/1993 devfl2 12208086.39 1.40309E-06 devflux
06459175 12/1/1993 devfl3 13559062.49 1.40309E-06 devflux
06459175 1/1/1994 devfl4 12419465.45 1.40309E-06 devflux
06459175 2/1/1994 devfl5 12070242.32 1.40309E-06 devflux
06459200 5/1/1968 devfl272 17295163.25 1.20897E-06 devflux
06459200 6/1/1968 devfl273 17266053.57 1.20897E-06 devflux
06459200 7/1/1968 devfl274 16519279.99 1.20897E-06 devflux
06459200 8/1/1968 devfl275 15647156.65 1.20897E-06 devflux
06459200 9/1/1968 devfl276 17767727.81 1.20897E-06 devflux
Here is my script so far:
import numpy as np
import matplotlib.pyplot as plt
data = np.genfromtxt('elm3_1-4 - Copy.rei', dtype=None, names=True, skip_header=6)
gages = np.genfromtxt('elmph3_dev_gages_28may2013.txt', dtype=None, names=True)
font = {'size' : 10,}
#-----Dev BFs__________________________________
#plt.rc('axes', color_cycle=['r'])
for gages['gage'] in gages:
if gages['pestID'] == data['Name']:
plt.scatter(gages['date'], data['Measured'],gages['date'], data['Modelled'])
plt.legend('Measured','Modelled')
#plt.plot([0,4000],[0,4000])
plt.xlabel('Measured (ft)', fontdict=font)
plt.ylabel('Modelled (ft)', fontdict=font)
plt.title.gages(['gage'], fontdict=font)
#plt.xlim(1000,4000)
#plt.ylim(-2000,4000)
plt.show()
However, i get the error message:
%run "C:/From_LT017_old D drive/Projects/ELM/FY14/python/elm3_1-4 devFlux plot from rei.py"
---------------------------------------------------------------------------
OverflowError Traceback (most recent call last)
C:\Program Files\Enthought\Canopy\App\appdata\canopy-1.1.0.1371.win-x86_64\lib\site-packages\IPython\utils\py3compat.pyc in execfile(fname, glob, loc)
174 else:
175 filename = fname
--> 176 exec compile(scripttext, filename, 'exec') in glob, loc
177 else:
178 def execfile(fname, *where):
C:\From_LT017_old D drive\Projects\ELM\FY14\python\elm3_1-4 devFlux plot from rei.py in <module>()
5
6 data = np.genfromtxt('elm3_1-4 - Copy.rei', dtype=None, names=True, skip_header=6)
----> 7 gages = np.genfromtxt('elmph3_dev_gages_28may2013.txt', dtype=None, names=True)
8
9 font = {'size' : 10,}
C:\Users\jtraylor\AppData\Local\Enthought\Canopy\User\lib\site-packages\numpy\lib\npyio.pyc in genfromtxt(fname, dtype, comments, delimiter, skiprows, skip_header, skip_footer, converters, missing, missing_values, filling_values, usecols, names, excludelist, deletechars, replace_space, autostrip, case_sensitive, defaultfmt, unpack, usemask, loose, invalid_raise)
1689 ddtype = zip(names, column_types)
1690 mdtype = zip(names, [np.bool] * len(column_types))
-> 1691 output = np.array(data, dtype=ddtype)
1692 if usemask:
1693 outputmask = np.array(masks, dtype=mdtype)
OverflowError: Python int too large to convert to C long
This appears to work