Add Factors to a Momocs Coo Object

This wasn’t documented anywhere (maybe it’s obvious?), but here is a short example using the included ‘bot’ dataset.

data(bot);
# Look at the existing factors, stored in bot@fac
a<-bot@fac;
# Add another arbitrary factor
a[2]<-a;
a[2]<-c(1:40);
names(a)[2]<-“number”;
# Put your new factors back into the object
a->bot@fac;
# Look at your data based on the new factor
panel(bot,cols=col.india(40)[bot@fac[,”number”]]);

 

 

PetroMod Simulation Log Location

Simulation logs (one per processor used during simulation) are located in the out folder of your model, with the name(s) log.pma, log1.pma, log2.pma, etc.

Possible use for this information: Write a script that automatically copies log files to another location for later review if needed (watch folder in Python?).  Bonus points if you are timestamping your notes so you can identify the right file to look at.

Race Report: Maah Daah Hey 100

I was 20 miles in before I crashed. I didn’t hurt myself much–a nasty scrape across my chest from the end of my handlebar, figure that one out–but I took it down a notch after that. No need to ride absolutely everything if Joe was choosing not to, and walking some sections was a nice break.

We rolled into the first aid station (checkpoint, really, since the time cutoff applied there, but labeled as an aid station) with 45 minutes or so to spare. We were getting tired and it was warming up, only 25 miles into the race. The first few miles were spent in a grand parade of herky-jerky singletrack, among people who had chosen the back of the pack at the start and realized that it would be some time before they wouldn’t be held back by those ahead.

After a flat tire (torn sidewall on my part), we were pretty much the last two people on the second 25 miles of the course.  Keep drinking, keep moving.  Stop in the shade when you get too hot.  Get up and move again.  Lack of training took its toll.  I think we were an hour past the cutoff at aid station two and the end of our race.

I can’t capture all the beauty of the trail and the dedication of Nick Ybarra and his crew of workers.  The Maah Daah Hey lives up to its reputation, and so does this race.  I’ll be back again someday to finish.

Update!

Midsummer update: Lots of things going on here in science world.  Mostly I’ve been working with PetroMod to create some basin history models of the Williston Basin, which is fun because I get to dig way into how PetroMod works and how different variables affect hydrocarbon generation and migration.

 

Formation tops to Petra, reshaped with R

To import formation tops to Petra, your input file needs to be set up as one row per well, one column per formation top, and each value being the depth measurement.  In the example below, I am trying to rough out the depths of formations in Wyoming using only the TD (total depth) and BOTFORM (formation at total depth).  Not the most precise method of building structural maps, but it will work on a large scale.

Input file has one row per well, columns api_full, TD, and BOTFORM (at least). 

Caution: I tried to run this on the full WY well dataset (111,000 rows) and R used all 36 GB of my RAM and then crashed.  It’s advisable to subset first.

#Read data in
wells<-read.csv(“Wyoming_allwells_headers.csv”);
#Simple sample
ws<-head(wells);
#Remember column names
names (ws);
#Required libraries
library(reshape);
 
#Example: reshape the sample, because the whole dataset is over 100,000 rows.
#Melt according to API and formation at TD
wsr<-melt(ws,c(“api_full”,”BOTFORM”),”TD”);
#Cast into a new data frame
wsc<-cast(wsr, api_full ~ BOTFORM);
 
Output will be one row per well, one column for each formation name in BOTFORM, and TD as the value.
 
I can add more information if there are questions.  Reshape steps are from http://stackoverflow.com/a/1533577/2152245.

Bored? Run a Spatial Analysis!

I’m not bored, so I won’t be today.  Someone could, however, look at the early success of the Great Rides Fargo bikeshare program and compare:

  • the footprint of the stations, according to population density versus Grand Forks (or the nearby city of your choice)
  • the footprint of the stations, according to how much area it would cover in Grand Forks (or the nearby city of your choice)

That might be enough to start thinking seriously about bikeshare in other areas.  Why not Grand Forks (another great hashtag)?  Why not Winnipeg?