Пример #1
0
    s_usgs = df_usgs.mean(
        axis=1, skipna=False)  # if either column is missing, return NaN

# check if both datasets are not all missing values
if s_rbm.notnull().sum() == 0:  # if all missing
    print 'All RBM output values are missing!'
    exit()
if s_usgs.notnull().sum() == 0:  # if all missing
    print 'All USGS data are missing!'
    exit()

#========================================================
# Determine plot starting and ending date (always plot full water years)
#========================================================
# determine the common range of available data of both data sets
data_avai_start_date, data_avai_end_date = my_functions.find_data_common_range(
    s_rbm, s_usgs)
if (data_avai_start_date -
        data_avai_end_date).days >= 0:  # if no common time range
    print "No common range data available!"
    exit()
# find the full water years with available data for both data sets
plot_start_date, plot_end_date = my_functions.find_full_water_years_within_a_range(
    data_avai_start_date, data_avai_end_date)
# determine time locator
if plot_end_date.year - plot_start_date.year < 5:  # if less than 5 years
    time_locator = (
        'year', 1
    )  # time locator on the plot; 'year' for year; 'month' for month. e.g., ('month', 3) for plot one tick every 3 months
else:  # if at least 5 years
    time_locator = (
        'year', (plot_end_date.year - plot_start_date.year) / 5
Пример #2
0
	df_usgs = my_functions.read_USGS_data(usgs_data_path, columns=usgs_streamT_col_split, names=names)  # read in data
	s_usgs = df_usgs.mean(axis=1, skipna=False) # if either column is missing, return NaN

# check if both datasets are not all missing values
if s_rbm.notnull().sum()==0:  # if all missing
	print 'All RBM output values are missing!'
	exit()
if s_usgs.notnull().sum()==0:  # if all missing
	print 'All USGS data are missing!'
	exit()

#========================================================
# Determine plot starting and ending date (always plot full water years)
#========================================================
# determine the common range of available data of both data sets
data_avai_start_date, data_avai_end_date = my_functions.find_data_common_range(s_rbm, s_usgs)
if (data_avai_start_date-data_avai_end_date).days>=0: # if no common time range
	print "No common range data available!"
	exit()
# find the full water years with available data for both data sets
plot_start_date, plot_end_date = my_functions.find_full_water_years_within_a_range(data_avai_start_date, data_avai_end_date)
# determine time locator
if plot_end_date.year-plot_start_date.year < 5:  # if less than 5 years
	time_locator = ('year', 1)  # time locator on the plot; 'year' for year; 'month' for month. e.g., ('month', 3) for plot one tick every 3 months
else:  # if at least 5 years
	time_locator = ('year', (plot_end_date.year-plot_start_date.year)/5)  # time locator on the plot; 'year' for year; 'month' for month. e.g., ('month', 3) for plot one tick every 3 months

#========================================================
# Select data to be plotted
#========================================================
s_rbm_to_plot = my_functions.select_time_range(s_rbm, plot_start_date, plot_end_date)