This file describes how to take information off of the 1990 Census
CD-ROM's and prepare it so that it can be used with the Problem Set 4
code.

1.  Some commands are meant to be typed in an xterm.  We will precede
these lines with ``xterm**''.  Other command are meant to be evaluated
inside of Edwin using the STUDENT band.  These will be preceded by
scheme**.  Begin by creating both an Edwin and an xterm.

2. Load the scheme code that does all of the work (DATA-STRCTURES and
CREATE-DATA from the PS4 directory)

scheme**(cd "~hal/6001")
scheme**(load "ps4/ps4-data-structures")
scheme**(load "ps4/ps4-create-data")

			 Extracting street data

3. Find the appropriate Census TIGER CD-ROM (Orange ones.  States may
occur on multiple CD-ROMs, and CD-ROMs may hold multiple states).
Also get the Green Census Disk for the right State (These are the
lighter color Blueish color disks that say "Summary Tape file on
them."You also need to find out what county the city is in at time
time.

** go to martigny and insert the TIGER disk in the left cd-rom drive
** and insert the CENSUS disk in the right cd-rom drive.
xterm** telnet martigny.ai
xterm** su ; type the root password at the prompt
xterm** /etc/mount /dev/cdrom-left /cdrom-left
xterm** /etc/mount /dev/cdrom-right /cdrom-right
xterm** exit 
xterm** cd /cdrom-left/DOCUMENT
xterm** grep <name-of-county-of-city> FI[TAB]

Write down the first two digit number; it is the state num.  Write
down the second number; it is the country

xterm** cd ..

4.  Files are stored in STATE-NUM/COUNTY-NUM subdirectories.  For
example, Middlesex cnty, you could cd 25/017.  One of the files you
eventually want to access, TGR<STATE-NUM><COUNTY-NUM>.F41;1 contains
all of the mapping information.

5.  Look in the pubgrf90.s<STATE-NUM> file to find the division number.

xterm** grep name-of-city PUB*.S<state-number>*

The output should look something like this:

032501711000Cambridge city                                              055
^^ summary level
  ^^ state number
    ^^^ county number
       ^^^^^ division number

Write down the division number (the first five numbers left of the Text).

6. Extract the street-list

xterm** cp /cdrom-left/<state>/<country>/TGR<state><country>.F41;1 /tmp/tiger.dat
scheme**(define new-camb (get-street-record-by-division
	"/tmp/tiger.dat"
	<division number>))
xterm** rm /tmp/tiger.dat

Arguments to get-street-record-by-division are FILE-NAME and
DIVISION-NUMBER.  FILE-NAME is the name of the F41 file from above.
DIVISION-NUMBER you also got from above.

7.  Make a town from all the streets.

(define cs (streets->town new-camb))	

Note: You can append street lists.  All streets contain absolute
lat-long coordinates.

**ignore stuff 6) Fasdump the data.
**ignore
**ignore
**ignore                      Extracting population data
**ignore
**ignore 1) Find the appropriate Census CD-ROM.  (Green ones.  1 or more
**ignore states/CD-ROM).
**ignore
**ignore 2) Become root on martigny, and mount the CD-ROM:
**ignore        cd /
**ignore        /etc/mount /dev/dsk/4s0 /cdrom

8.  Do these steps: 
scheme** (cd "/cdrom-right")
scheme** (init "NY") ; where MA is the abbreviation for the State you want

**ignore 5) Assume that cs is list of streets obtained from TIGER CD-ROMS.
**ignore
**ignore (define cs (fasload "/usr-dirs/bal/tiger/cambsom.bin"))
**ignore ;Loading "/usr-dirs/bal/tiger/cambsom.bin" -- done
**ignore ;Value: cs
**ignore (length cs)
**ignore ;Value: 5710

9.  Now, build a list of the block-groups touched by the streets.

scheme** (define cs-tracts (extract-tracts new-camb))
;Value: cs-tracts

(length cs-tracts)
;Value: 200

10.  Now, go and extract the data for the tracts:

scheme** (define cs-data (extract-matching-blkgrps <country-num> cs-tracts))

example** (define cs-data (extract-matching-blkgrps 17 cs-tracts 10000))
example** "Converting 12636"
example** "Converting 12637"
example** "Converting 12638"
example**

Arguments to extract-matching-blkgrps are COUNTY-NUMBER, TRACT-LIST
and (optional) STARTING-RECORD.

||You should already have the COUNTY-NUMBER but you can get it by
||looking at the top of the file, pubgrf90.s<STATE-NUM>.
||
||0225017     Middlesex County
||    ^^^
||    ^^^---county number
||
||(The file pubgrf90.s<SN> is found on the TIGER CD-ROM with the street
||data).
||
||State number map to states in alphbetical order.  You'll find the state
||numbers on the TIGER CD-ROMS.  (First line of pubgrf* files contains
||state name).
||
||**ingore6) Save the cs-data list.
||**ingore	(fasdump cs-data "/usr-dirs/bal/tiger/cs-data.bin")

11.  Making a dataset for PS4:

Run the procedure INITIALIZE-AND-DUMP-DATA:

scheme**(cd "~hal/6001")
scheme** (initialize-and-dump-data cs cs-data "ps4-data/<city-name>.bin")
                                    |      |               |
                                  street  pop          dumped file

12.  Cleaning Up

xterm** cd /
xterm** su
xterm** umount /cdrom-left
xterm** umount /cdrom-right
xterm** exit
xterm** logout

Now go get the disks out of the drive and return them to where you got
them.  You have to hold the eject button down for a very long time to
get the disks to eject.








