def estimate_stage_volume(stage_area_df):
    stage_area_df.loc[:, 'volume_cu_m'] = 0.000
    volume_2 = 0.000
    for h1, h2 in cd.pairwise(stage_area_df.index):
        print h1, h2
        height_diff = abs(h1 - h2)
        area_1 = stage_area_df.loc[h1, 'Area_sq_m']
        area_2 = stage_area_df.loc[h2, 'Area_sq_m']
        volume_2 += conic_volume_estimate(area_1=area_1, area_2=area_2, height_diff=height_diff)
        stage_area_df.loc[h2, 'volume_cu_m'] = volume_2
    return stage_area_df
def estimate_stage_volume(stage_area_df):
    stage_area_df.loc[:, 'volume_cu_m'] = 0.000
    volume_2 = 0.000
    for h1, h2 in cd.pairwise(stage_area_df.index):
        print h1, h2
        height_diff = abs(h1 - h2)
        area_1 = stage_area_df.loc[h1, 'Area_sq_m']
        area_2 = stage_area_df.loc[h2, 'Area_sq_m']
        volume_2 += conic_volume_estimate(area_1=area_1,
                                          area_2=area_2,
                                          height_diff=height_diff)
        stage_area_df.loc[h2, 'volume_cu_m'] = volume_2
    return stage_area_df
Example #3
0
def estimate_stage_volume(stage_area_df):
    """
    Function to calculate stage volume from stage_area dataframe
    """
    # give default value as 0, this will get reset after each loop
    stage_area_df.loc[:, 'volume_cu_m'] = 0.000
    volume_2 = 0.000
    # loop, h -> (h0, h1), (h1, h2), (h2, h3)
    for h1, h2 in cd.pairwise(stage_area_df.index):
        # print h1, h2
        # estimate diff in height between two values
        height_diff = abs(h1 - h2)
        # find out corresponding area of h1, and h2
        area_1 = stage_area_df.loc[h1, 'Area_sq_m']
        area_2 = stage_area_df.loc[h2, 'Area_sq_m']
        # estimate volume using conic volume formula, see above function
        volume_2 += conic_volume_estimate(area_1=area_1, area_2=area_2, height_diff=height_diff)
        # assign volume to h2
        stage_area_df.loc[h2, 'volume_cu_m'] = volume_2
    return stage_area_df
Example #4
0
def estimate_stage_volume(stage_area_df):
    """
    Function to calculate stage volume from stage_area dataframe
    """
    # give default value as 0, this will get reset after each loop
    stage_area_df.loc[:, 'volume_cu_m'] = 0.000
    volume_2 = 0.000
    # loop, h -> (h0, h1), (h1, h2), (h2, h3)
    for h1, h2 in cd.pairwise(stage_area_df.index):
        # print h1, h2
        # estimate diff in height between two values
        height_diff = abs(h1 - h2)
        # find out corresponding area of h1, and h2
        area_1 = stage_area_df.loc[h1, 'Area_sq_m']
        area_2 = stage_area_df.loc[h2, 'Area_sq_m']
        # estimate volume using conic volume formula, see above function
        volume_2 += conic_volume_estimate(area_1=area_1,
                                          area_2=area_2,
                                          height_diff=height_diff)
        # assign volume to h2
        stage_area_df.loc[h2, 'volume_cu_m'] = volume_2
    return stage_area_df
Example #5
0
data_1_df = pd.DataFrame(data_1, columns=['date', 'time', 'rain(mm)'])
# print data_1_df.head()
# print data_1_df.tail()
date_format_1 = "%d-%b-%y %H:%M"
data_1_df['date_time'] = pd.to_datetime(data_1_df['date'] + ' ' +
                                        data_1_df['time'],
                                        format=date_format_1)
data_1_df.set_index(data_1_df['date_time'], inplace=True)
data_1_df.sort_index(inplace=True)
data_1_df.drop(['date_time', 'date', 'time'], axis=1, inplace=True)

# cumulative difference
data_1_8h_df = data_1_df['2010-01-01 8H30T':'2015-11-30 8H30T']
data_1_8h_df['diff'] = 0.000

for d1, d2 in cd.pairwise(data_1_8h_df.index):
    if data_1_8h_df['rain(mm)'][d2] > data_1_8h_df['rain(mm)'][d1]:
        data_1_8h_df['diff'][
            d2] = data_1_8h_df['rain(mm)'][d2] - data_1_8h_df['rain(mm)'][d1]
"""
Remove duplicates
"""
rain_df = data_1_8h_df
rain_df['index'] = rain_df.index
rain_df.drop_duplicates(subset='index', take_last=True, inplace=True)
del rain_df['index']
rain_df.sort_index(inplace=True)
# print rain_df.head()

# resample_daily
rain_df_daily_had = rain_df.resample('D',
Example #6
0
data_1_df = pd.DataFrame(data_1,columns=['date', 'time', 'rain(mm)'])


date_format_1 = "%d-%b-%y %H:%M"
data_1_df['date_time'] = pd.to_datetime(data_1_df['date'] + ' ' + data_1_df['time'], format=date_format_1)
data_1_df.set_index(data_1_df['date_time'], inplace=True)
data_1_df.sort_index(inplace=True)
data_1_df.drop(['date_time', 'date', 'time'], axis=1, inplace=True)


# cumulative difference
data_1_8h_df = data_1_df['2014-09-01 8H30T': '2015-02-09 8H30T']
data_1_8h_df['diff'] = 0.000

for d1, d2 in cd.pairwise(data_1_8h_df.index):
    if data_1_8h_df['rain(mm)'][d2] > data_1_8h_df['rain(mm)'][d1]:
        data_1_8h_df['diff'][d2] = data_1_8h_df['rain(mm)'][d2] - data_1_8h_df['rain(mm)'][d1]
        
data_1_30min_df = data_1_8h_df.resample('30Min', how=np.sum, label='right', closed='right')
aral_rain_df = data_1_30min_df

"""
Remove duplicates
"""
aral_rain_df['index'] = aral_rain_df.index
aral_rain_df.drop_duplicates(subset='index', take_last=True, inplace=True)
del aral_rain_df['index']
aral_rain_df = aral_rain_df.sort()
# print aral_rain_df.head()