Petrinex Data

Posted
Comments None

All the Petrinex Data is freely available to use, and it's very interesting. I looked through it, and produced these images of production locations in Alberta. I utilized R to summarize the data, and have a walk-through of how to do that below. Below is a summary of the gas production by township in Alberta: . Below is a summary of the condensate production by township in Alberta: Below is a summary of the condensate in a high production area near Grand Prairie. Below is a summary of the water production by township in Alberta: If you don’t already know how useful R is, then hopefully the info below will convince you! To summarize this data yourself, download it from here in CSV format. I downloaded all of 2018. Once it is on your computer, unzip the files. If you are on a unix/linux/BSD/OSX operating system, then you can get into the directory with the files, and type
cat *.CSV >> petrinex_2018.csv 
to combine all the monthly CSV files into one. This will include an extra row per month for the headings, that we will remove later. The file is about 1.5GB. Then start a new project in R Studio. You can make a new R script to keep track of the commands, and input the following commands:
library(ggplot2)
library(dplyr)
library(stringr)
#Read in the joined CSV File
petrinex <- read.csv('2018_petrinex.csv')
#Remove the rows that are actually headings
petrinex <- petrinex[which(petrinex$ProductionMonth != "ProductionMonth"),]
#Change the volume to a numeric data type
petrinex$Volume <- as.numeric(as.character(petrinex$Volume))
#Make a data frame to summarise the production by company
companies <- petrinex[which(petrinex$ReportingFacilitySubType <= 371),] %>% group_by(ProductionMonth,OperatorName,ProductID) %>% summarise(volume = sum(Volume)) %>% ungroup()
#Change the production month into a date format that works better for trending
companies$date <- strptime(paste(companies$ProductionMonth, "-01", sep=''),"%Y-%m-%d")
#Totalise all the production from the companies
province <- subset(companies,ActivityID=="PROD") %>% group_by(date,ProductID) %>% summarise(volume = sum(volume)) %>% ungroup()
#Make a line plot of the total production in the province
ggplot(aes(x=date, y= volume, color=ProductID),data=subset(province, ProductID  "OIL" | ProductID  "GAS" | ProductID  "COND")) + geom_point() + ggtitle("Condensate Production 2018 (m3)")
#Make a pie Chart to show the distribution of condensate production by company in November
bp <- ggplot(aes(x="", y= volume, fill=OperatorName),data=subset(companies, ProductID  "COND" & ProductionMonth  "2018-11" & volume > 500)) + geom_bar(stat="identity")
bp + coord_polar("y", start=0) + ggtitle("November Gas Production")
##Now summarise the data by township to make the maps that we want to see.
prod <- subset(petrinex, ActivityID  "PROD" & ReportingFacilitySubType <= 371)
area_prod <- prod %>% group_by(ProductionMonth, FacilityTownship,FacilityRange,FacilityMeridian,ProductID) %>% summarise(volume = sum(Volume))
#Make the name the same format as the names in the shapefile that I will join to 
area_prod$name <- paste("TWP-",str_pad(area_prod$FacilityTownship, 3, pad= "0"), " RGE-", str_pad(area_prod$FacilityRange, 2, pad="0"), " MER-", area_prod$FacilityMeridian,sep = "")
#Make a column for each product
wide_area_prod <- dcast(area_prod, ProductionMonth + name ~ ProductID, value.var="volume")
#Output one month of data to read into QGIS
write.csv(subset(wide_area_prod, ProductionMonth == "2018-11"), "area_prod_nov2018.csv", row.names = FALSE)
This gives us some interesting insights into what is going on in regards to oil & gas production. I will say there could be some double counting in the data, which I tried to minimize by selecting facility types less than 371 (you can see the list of facility types and what they mean here. To get rid of double counting, you would have to follow each volume through to it’s destination, which would be possible, as there is a column labelled FromToID in this dataset, and this may be the subject of a future blog post. With that warning aside, I wanted to know who the top producers were, and how the production was changing among them. If you view the total production in Alberta, it’s not changing alot, but there are lot’s of companies spending money on growth. A great way to visualize this is a Pie chart. I made a pie chart of the top condensate producers in January 2018, and November 2018, to see how things changed over the year. I further reduced the facility types to just 351, which is “Gas Well Single Battery” for the below charts. There could still be some data quality issues, but it should give a general idea of the changes occuring.


Looking at the companies with the most growth, it appears most of them are privately held.

Author

Comments

There are currently no comments on this article.

Comment

Enter your comment below. Fields marked * are required. You must preview your comment before submitting it.





← Older Newer →