Interactive Production Plots

R Reservoir engineering

Some examples of production plots using Plotly

Rigoberto Chandomi Vazquez https://www.linkedin.com/in/rigoberto-chandomi-v%C3%A1zquez-79038495/
10-17-2021

After adequate the data we get a ready dataframe to manipulate and useful for plotting. Production data are from Homol field in México, taking from link

library(dplyr)
library(DT)
library(plotly)
library(lubridate)

prod_data <- read.csv("Production_Data.csv")
prod_data$Date <- as.Date(as.character(prod_data$Date), "%d/%m/%Y")
datatable(prod_data)

updatemenus argument is defined in layout() function to show a list of well and filter the data

#Well list for filter
wells <- list()
for(i in 1:length(unique(prod_data$Well))){
  
  wells[[i]] <- list(method = "restyle",
               args = list("transforms[0].value", unique(prod_data$Well)[i]),
               label = unique(prod_data$Well)[i])
  
}

prod_data$Well <- as.factor(prod_data$Well)

fig <- prod_data  %>%
    filter(Fluid == "Qo") %>%
    plot_ly(transforms = list(
      list(
        type = 'filter',
        target = ~Well,
        operation = '=',
        value = unique(prod_data$Well)[1]
      )
  )) %>%  
  add_markers(
    x = ~Date, 
    y = ~Rate ) %>% 
  layout(
    updatemenus = list(
      list(
        type = 'dropdown',
        active = 0,
        buttons = wells
      )
    )
  )

fig

We can estimate cumulative production and total field production easily with group_by() and mutate() function from dplyr package.

With lubridate package we can manage date data and get the days of the months. Then we calculate the production by month and then de cumulative production.

prod_data <- prod_data %>% 
             group_by(Fluid, Well) %>% 
             arrange(Date) %>%
             mutate(days = days_in_month(Date),
                    cum_month = Rate*days, 
                    Np = cumsum(cum_month)/1000000) %>%
             as.data.frame()
              
fig <- prod_data  %>%
    filter(Fluid == "Qo") %>%
    plot_ly(transforms = list(
      list(
        type = 'filter',
        target = ~Well,
        operation = '=',
        value = unique(prod_data$Well)[1]
      )
  )) %>%  
  add_markers(
    x = ~Date, 
    y = ~Np) %>% 
  layout(
    updatemenus = list(
      list(
        type = 'dropdown',
        active = 0,
        buttons = wells
      )
    )
  ) 

fig

For the field total production and cumulative we can group by fluid and Date, then sum all Rate data in each Date and calculate cumulative production. We use a line plot for Qo field rate.

Field_prod <- prod_data %>% 
              group_by(Fluid, Date) %>% 
              summarize(Rate = sum(Rate, na.rm = TRUE)) %>%
              mutate(days = days_in_month(Date),
                    cum_month = Rate*days, 
                    Np = cumsum(cum_month)/1000000) %>%
             as.data.frame()
  

fig <- Field_prod  %>%
    filter(Fluid == "Qo") %>%
    plot_ly() %>%  
    add_lines(
    x = ~Date, 
    y = ~Rate)


fig

Citation

For attribution, please cite this work as

Vazquez (2021, Oct. 17). Chato Solutions: Interactive Production Plots. Retrieved from https://www.chatosolutions.com/posts/2021-09-23-productionplots/

BibTeX citation

@misc{vazquez2021interactive,
  author = {Vazquez, Rigoberto Chandomi},
  title = {Chato Solutions: Interactive Production Plots},
  url = {https://www.chatosolutions.com/posts/2021-09-23-productionplots/},
  year = {2021}
}