Sunday, October 8, 2017

Reading digital well log files with lasio

A well log is a measurement with respect to depth or time of various physical characteristics in or around a well bore. Well logs are used extensively by the oil and gas industry. The universal digital format of well logs is the Log ASCII Standard (LAS).

Reading and interpreting well logs has been a common task for me both in college and at work. I have a project in mind for an app to store, view, interpret, and share well logs in a web app, so I want to be more familiar with the file format.

This Notebook is my first attempt at working with well logs using Python. I'm using lasio as my LAS parser.

My goals with the project were to

  • Test if lasio works consistently with hundreds of well log files.
  • Analyze the usage frequency of well logging tools and how standardized the syntax is between well logging tools in terms of how the tools are named and described.
  • Plot some of the gamma ray, resistivity logs.

No test of a LAS parser would be complete without plotting the log data. Images of plotted well logs are quite large. It's common to have more than one data point per foot depth for each tool and a well can be many thousands of feet deep. Below is a cropped example of a plotted well log. Full logs can be found in the git repo
Cropped plot of resistivity and gamma ray logs

Sunday, August 20, 2017

Forum Website

I made my first web application! 

It's a forum website. Think, reddit, or a site where people post and comment on things. I chose a forum, because some of my ideas down the road involve a website where users collaborate.

I built the project using Django, a Python web framework. Django allows for fast development and is built using a "don't repeat yourself" philosophy which minimizes redundant code.

After going through the official Django tutorial and poking around, I wanted to make something by myself.

Let's see it

Here's the Github repository. To run it locally from Command Prompt or Anaconda, navigate to the manage.py file and enter "python manage.py runserver". 

If you don't want to do that, I do have a few screenshots.

Index Page
The index page will look familiar to a reddit user. The eye grabbing content is the title of each post. In smaller text is when the post was submitted, who posted it, and where they posted it.
In the dark blue header, is a quick link to some of the website's forums. A list of all the website's forums is also available.

Forum page

Each Forum's page lists the forum's topics sorted to show the most recent. The forum's description is in the sidebar. The URL to get to a forum's page is really easy to read. It's just /f/[forum_name].

Topic page



Each topic's page contains the topic's body, followed by posts from other users. The topic page inherits the sidebar from its forum.

Final Thoughts

I used Visual Studio 2017 (VS) as my IDE. I never used VS for development before, but I found it very useful for web development. I'll definitely use it again for my next Django project.

I was happy that the front end web development class I took didn't go to waste. Bootstrap really adds a lot. 

Friday, February 17, 2017

Cross Over Stock Trading Algorithm

Sometimes I wonder if or when I should buy a stock, and I'll get a stock trading algorithm in my head. Would it beat holding the stock? How risky is it?

One way to access that is testing the algorithm on past market data. Here, I do just that.

Stock Market Analysis

  • Use API to pull stock data
  • Methods to analyze stock data
  • Crossover trading concept 
  • Backtest crossover trading strategy

Crossover algorithm trading periods

While this Notebook follows another blog post, I made significant changes to the code and added better visualizations.

Stock Trading Algorithm Testing

  • Test the Crossover trading algorithm on all the stocks in the S&P 500
  • Analyze results 

Return ratio of holding stock vs algorithm for S&P 500 stocks 


Crossover algorithm often exceeding hold when hold results in loss
GitHub for this project

Disclaimer: This is in no way financial advice. I am not a financial adviser.  This post and code were done as a data analysis exercise only.