#!/usr/bin/perl # filename: makewell.pl # author: Marvin Simkin # date: 2002-11-05 # purpose: read wells data make XYZ line instructions # syntax: makewell.pl < wells07.txt # wells07.txt selected wells with depth info # NOTE: # Input data format: 'well'|ID|top|depth|gravelbase|bedrock|easting|northing # well|ASE-19B|1121|145|89|135|472923.1|889444.2 # well|ASE-20B|1121|144|98|133|472627.7|889301.1 # well|ASE-21C|1123|174|80|133|473595.3125|890166.125 # well|ASE-22B|1115|143|116|133|470574|888921.8 # well|ASE-23B|1114|216|126|186|469281.3|888822 # well|ASE-24C|1118|180|91|127|472306.5|888767.1875 # well|ASE-29A|1116|87|62|86|470887.26|889389.68 # well|ASE-37A|1121|112|82|108|473520.6|888919.9 # well|ASE-38A|1121|112|80|110|473571.3|888961.6 # well|ASE-39A|1121|105|85|98|473446.5|888997.2 # well|BC-1|1020|133|85|133|473598.375|889985.5625 # Output data format # this is hardcoded to generate wells08.txt line draw instructions # and top.xyz, fill.xyz, and bed.xyz surface info # # Line draw: # color=r g b;line:X1,Y1,Z1,X2,Y2,Z2 # # *.xyz files are formatted for GMT "surface" command: # x,y,z # INITIALIZE: my $GravelColor; ## 0.547 0.449 0.477 $GravelColor = '0.700 0.700 0.800'; my $FillColor; ## 0.313 0.648 0.684 $FillColor = '0.500 0.500 1.000'; my $BedColor; $BedColor = '0.605 0.200 0.200'; open (LINES, ">wells08.txt") or die "cannot write 'wells08.txt', $!"; print LINES "linewidth=4\n"; open (TOP, ">top.xyz") or die "cannot write 'top.xyz', $!"; open (FILL, ">fill.xyz") or die "cannot write 'fill.xyz', $!"; open (BED, ">bed.xyz") or die "cannot write 'bed.xyz', $!"; # SUBROUTINES: use strict; # ARGUMENTS: # MAINLINE: my $Line; while ($Line = <>) { chomp $Line; my $LineType; my $SiteID; my $MPElev; my $TotalDepth; my $GravelBase; my $Bedrock; my $XCoord; my $YCoord; ($LineType, $SiteID, $MPElev, $TotalDepth, $GravelBase, $Bedrock, $XCoord, $YCoord) = split (/\|/, $Line); print STDERR "TopElev=$MPElev,"; # a couple bedrock fields have a '?'; have to go with it having nothing better $Bedrock =~ s/\?$//; # plot the line from the top to the gravel base # if $GravelBase starts with 'N' (e.g. 'NE') it means there was no gravel; # basin fill comes all the way to the top my $FillElev; if ($GravelBase =~ /N/) { $FillElev = $MPElev; print STDERR "No gravel,"; } else { $FillElev = $MPElev - $GravelBase; # gravel line from top to fill print LINES "color=$GravelColor;line:$XCoord,$YCoord,$MPElev,$XCoord,$YCoord,$FillElev\n"; print STDERR "FillElev=$FillElev,"; } my $BedElev; $BedElev = $MPElev - $Bedrock; print TOP "$XCoord,$YCoord,$MPElev\n"; print FILL "$XCoord,$YCoord,$FillElev\n"; print BED "$XCoord,$YCoord,$BedElev\n"; # fill line from top or fill to bed print LINES "color=$FillColor;line:$XCoord,$YCoord,$FillElev,$XCoord,$YCoord,$BedElev\n"; print STDERR "BedElev=$BedElev,"; my $Bottom; $Bottom = $MPElev - $TotalDepth; # some wells seem to stop when they hit bedrock if ($Bottom < $BedElev) { # bedrock line from bed to bottom print LINES "color=$BedColor;line:$XCoord,$YCoord,$BedElev,$XCoord,$YCoord,$Bottom\n"; print STDERR "Bottom=$Bottom"; } print STDERR "\n"; }