Thursday, September 30, 2010

Create points from a line (ArcGIS)

I need two text files, one with the x coordinates and another with the y coordinates of a stream (to put into matlab). I have a polyline shapefile of the stream in ArcGIS. Don't know if this is the easiest way, but it works :)

1. In ArcCatalog, make a new point file with the same coordinate system as your line file.
2. In ArcGIS, start editing your POINT file, and select the line you want to make poins for (so that it is highlighted green).
3. Under the editor pull down (in the editor tool bar) select to 'divide'.
Choose the second option: 'place points separated by every __ units' (the units are your map units... you can check this under dataframe properties).
4. Stop editing.
5. Open the 'Add XY Coordinates' tool. (ArcToolbox>Data Management Tools>Features)
Choose your point shapefile and say OK.
6. Once it's complete, open the attribute table for your point shapefile.
7. Under attribute table options, choose 'export' and save your file as a .dbf file.
8. Open this file in excel (excel is the default program to open .dbf files anyway).
9. For my matlab application I need two files, one with just x coordinates, and one with just y coordinates, so I made two copies of this file and deleted all but the POINT_X column in one and all but the POINT_Y column in the other. Then for each I deleted the title row, changed it to scientific notation and saved the file as a text(ms dos) file.
10. Wahoo! maybe there is an easier way to do this, but it works :)

some chinese translation tools

OT = off topic

(1) old standby babel fish - type in english or paste chinese characters, get unintelligible response

http://babelfish.yahoo.com/translate_txt

(2) draw the character with your mouse and get the closest matches. okay for characters without a hundred strokes. can't cut and paste the result easily, but you get the pin yin and tone.

http://www.chinese-tools.com/tools/mouse.html

(3) chinese word processor and dictionary. extremely useful if you know pin yin. might only be 30 days free.

http://www.njstar.com/cms/njstar-chinese-word-processor-download

Monday, September 27, 2010

vi stuff

some vi stuff

show line numbers:
:set number

copy or move block of lines or line:

:line,linecotarget
:line,linemtarget
:linemtarget

Go to a line:

type line number then G

error in transfer

If you get this error when applying transfer in sac:  

check_channel; decimation blockette with no associated filter,
skipping to next response now
No transfer function applied! 
ERROR 2118: No transfer function applied.


Then go into the RESP file and make sure that the blocks for each stages are in the following order (cut and paste if necessary):

FIR response
Decimation
Channel Gain

Friday, September 24, 2010

perl

some perl stuff

http://esdynamics.geowissenschaften.uni-tuebingen.de/~esd/tutorials/perl/start.html

http://www.perl.com/pub/2008/04/23/a-beginners-introduction-to-perl-510.html

http://perldoc.perl.org/index-tutorials.html


#!/usr/bin/perl -w

foreach $fn (<*BHZ*.SAC>){
   foreach (`sachdr -l $fn`){
      if (/kstnm/){
          @a=split;
          $sta=$a[2];
          }
      if (/stla/){
          @b=split;
          $stla=$b[2];
          }
      if (/stlo/){
          @c=split;
          $stlo=$c[2];
          }
       }
print "$sta $stla $stlo\n";
};

x windows

Xming for xwindows.

Run Xlaunch for multiple windows.

Then in SSH under tunneling settings, check Enable X11.

Wednesday, September 15, 2010

station lat/lon to 3 decimal places

On the IRIS site the seismic station locations are only given to 2 decimal places lat/lon, which is +/- l km. They don't want to real the precise position of the instruments.

If you need more info, location to 3 decimal places is available in the .sac files.

(from rob)

In the sac header files you can find the latitude and longitude to at least 3 decimal places. You can access this either via sac:
read (file)
lh stla stlo

or a couple matlab options based on which sac reader you're using
with load_sac:
[header, data] = load_sac('file');
header.stla, header.stlo

(In the above two cases stla is short for station latitude and stlo is short for station longitude)

or with readsac
[time, amp, header] = readsac('file');
header(17)
header(18)

in this case header(17) is the latitude and header(18) is longitude.

italian insar site

This link has been stuck in my inbox for a long time, courtesy of JP. Might as well archive it here. We're all about databases.

http://webgis.irea.cnr.it/webgis.html

IREA-CNR InSAR WEB GIS

(wow. acronyms.)