Statistics In Techlog

Question: How do you get statistics on log values (variable values*) for a given well?  How about a given zone in that well?

Answer**: In Techlog 2013.2.0 (not 2011 as far as I could tell), you can do this with the Statistics tool.

One well:

  1. Menu->Data->Toolbox->Statistics
  2. Select a variable from one of the wells and move it to the “Data type assignment” pane with the “Variables >” button and click “Create”
  3. Drag a well from your Project Browser to the Input pane of the Workflow Manager (right side).
  4. Click the Statistics tab in the Workflow Manager (right side).
  5. Click the purple “Play” button to compute statistics for your selection.

One well with zones:

  1. Proceed to step 3, above.
  2. Open the Zonation pane in the Project Browser.
  3. Select the zones you want to calculate statistics for.
  4. Open the Zonation tab in the Workflow Manager.
  5. Click the icon for “Insert zones from the zonation dock window.”
  6. Go to step 4, above.

I hope this helps someone at least a little bit.

*”Variables” are what Techlog calls digital logs.  Each type of log is a different variable.
**Drawing somewhat from this knowledge base article

GIS: Raster cell centroids as vector points with GDAL and R

Short intro: I’m using raster data for part of my dissertation, but I’m storing the paleoenvironment data in a database as the latitude and longitude of the center of each grid cell. This lets me query my environment localities, add new ones, and make specific datasets.

Sometimes I take existing maps of other people’s environmental interpretations and digitize them, leaving me with vector polygon data. I need to convert the polygons into the same kind of data I’ve been storing. This is surprisingly hard in both QGIS and GDAL alone, so I finally figured out how to do it in R today courtesy of Simbamangu over at StackExchange.

See the attached images for how things look at each stage.

Below are the general terminal commands, first in GDAL and then R. I will try to add more rationalization and explanation later. My operating system is Mac OS X but these should be modifiable.

GDAL in your terminal

gdal_rasterize -at -where 'freshwater = 1' -a freshwater -ts 360 180 -te -180 -90 180 90 -l "source_layer_name_in_shapefile" "shapefile.shp" "output_raster.tif"
Produces a geoTiff of your input polygons where the attribute ‘freshwater’ is equal to ‘1’. For more detail I invite you to read the GDAL documentation, it’s quite good.


To run through a single file:
# load necessary libraries

# Load the raster from a file
r <- raster("rastername.tif") # Convert to spatial points p <- as(r, "SpatialPointsDataFrame") # Set name of column of raster values for later use names(p)[1]<-"value" # Get only the values we want (values above zero) in that column psubset<-subset(p,p$value>0);

# Save as a shapefile (extension appended automatically)
writeSpatialShape(psubset, "outputfile");

You can also loop through a directory:
# load necessary libraries

# Set working directory

# list all .tif files in working directory
for (file in dir(pattern="*.tif")) {
r <- raster(file); p <- as(r, "SpatialPointsDataFrame"); # Set name of column of raster values names(p)[1]<-"value"; # Get only the values we want (values above zero) psubset<-subset(p,p$value>0);

# Make a new filename
oldname<-substr(file, start = 1, stop = nchar(file) -4); newname<-paste(oldname,"pts",sep=" "); # Make a shapefile writeSpatialShape(psubset, newname) ; # Make a CSV file # Convert to data frame so you can drop extra columns psubsetdf< write.table(psubsetdf[,c(2,3)],file=paste(newname,".csv",sep=""),sep=",", row.names=FALSE); }