28.8.08

August 28, 2008 - I knew it was coming...

Slave! Make me a map! No, not with fancy graphical software, write the code from scratch or I'll flog you with the sinuous dried up hopes and dreams of the all the failed graduate students before you!

Ok, my advisor didnt really say that, it was more like... I dont know how to do this, can you help? But its coming, I know, he's just being nice because its the first week...


Anyways, here's the map I made first thing this morning (while brushing my teeth no less). Its the Southwest Nevada Volcanic Field. It also includes the infamous Yucca Mountains and thier proposed nuclear repository site...joy!

It still needs a scale ect.. but Im a slacker you know... and because Im that much of a dork, Im posting the code... that and Im covering my ass for the day when I cant find it anywhere else.

srtm2xyz.pl

for (my $i = 0; $i < _ =" <">;
($key, $value) = split " ",$_;
$H{$key} = $value;
print STDERR "$key $value\n";
}

@data;
$xstart = $H{xllcorner};
$ystart = $H{yllcorner}+5;
$nodata = $H{NODATA_value};
$grid = $H{cellsize};
print STDERR "Starting location: $xstart $ystart\n";
#$grid = 0.000833333333;
$x = $xstart;
$y = $ystart;

$min_val = 1e6;
$max_val = $nodata;
while (<>) {
@data = split " ",$_;
foreach my $cell (@data) {
#if ($cell == -500) {$cell = 0;}
if ($cell > $nodata) {
if ($cell < $min_val) {$min_val = $cell;} if ($cell > $max_val) {$max_val = $cell;}
}
printf "%.12f %.12f %d\n", $x, $y, $cell;
$x += $grid;
}
$y -= $grid;
$x = $xstart;
}

SNVF.gmt

# File: SNVF.gmt
# Format: UNIX
# Author: Hintz, AR
# Date: August 27 ,2008
# Purpose: This code will generate a shaded relief map of the SNVF

#xyz2grd SNVF.dat.ll -GSNVF.grd -I0.000833333 -R-116.833/-116.1666/36.4166/37.25 -V

makecpt -Cgray.cpt -T-1500/2500/5 -V > SNVF.cpt

grdgradient SNVF.grd -Gintensity.grd -E60/30/=/0.5 -Nt0.5 -V

grdimage SNVF.grd -R -JM10i -CSNVF.cpt -P -E100 -Iintensity.grd -K -V > SNVF.eps

psbasemap -JM -R -Ba0.25g0.25 -V -O -K -P >> SNVF.eps

#psscale -Df-116.2/36.5/10 -P -V >> SNVF.eps

1 comment:

Paul Daniel Ash said...

Jesus, Mary and Joseph. You write perl.

What happened to the retarded hippie chick I sat behind in Algebra?