Next / Previous / Contents / Shipman's homepage

Table of Contents

1. Overview
1.1. How to get this publication
1.2. Files generated from this document
2. Installation
2.1. Unix installation from a .zip archive
2.2. Unix installation from the Web
3. Object architecture
3.1. Architecture of the data compilers
3.2. Encounter (output) objects
3.3. Station authority files
3.4. Species authority files
4. baseclasses.py: Prologue
5. Manifest constants
5.1. Constants for species authority files
5.2. Constants related to encounter records
5.3. Encounter codes
5.4. Encounter record attribute names
5.5. Band number constants
6. scanFieldList(): A utility routine for flat-file scanning
7. scanFieldItems(): Parse a sequence of FieldItem objects
8. class BaseStationSet: Base class for station authority objects
8.1. BaseStationSet.locationLookup()
8.2. BaseStationSet.stationNoLookup()
8.3. BaseStationSet.__init__(): Constructor
8.4. BaseStationSet.readLine(): Read one station line
8.5. BaseStationSet.addStation(): Add a new station
9. class Location: Represents a group of stations
9.1. Location.__init__(): Constructor
9.2. Location.addStation(): Add a new station to a location
9.3. Location.lookupStaCode()
9.4. Location.__str__()
10. class Station: Represents one station
10.1. Station.__init__(): Constructor
10.2. Station.__str__()
11. class MapsStationSet: Station set object
11.1. MapsStationSet.__init__()
11.2. MapsStationSet.readline()
12. class MawsStationSet: Station set object
12.1. MawsStationSet.__init__()
13. class BaseSpeciesSet: Base class for species authority objects
13.1. BaseSpeciesSet.lookupSpec4()
13.2. BaseSpeciesSet.lookupSpec6()
13.3. BaseSpeciesSet.engRe(): Search English names
13.4. BaseSpeciesSet.__init__(): Constructor
13.5. BaseSpeciesSet.readLine()
13.6. BaseSpeciesSet.addSpecies(): Add a new species line
14. class Maps2004SpeciesSet
14.1. Maps2004SpeciesSet.__init__()
14.2. Maps2004SpeciesSet.readLine()
15. class Maps1998SpeciesSet
16. class Maws2002SpeciesSet
17. class SpeciesSearcher: Logic for the species code search scripts
17.1. SpeciesSearcher: Manifest constants
17.2. SpeciesSearcher.__init__()
17.3. SpeciesSearcher.run(): Execute a search
17.4. SpeciesSearcher.run4(): Four-letter code search
17.5. SpeciesSearcher.run6()
17.6. SpeciesSearcher.runEng()
18. class Species: Definition of a species code
18.1. Species.__init__(): Constructor
18.2. Species.__str__()
19. class BaseCompiler: Base class for banding data compilers
19.1. class BaseCompiler: The interface
19.2. Internal state of the BaseCompiler class
19.3. BaseCompiler.__init__(): Constructor
19.4. BaseCompiler.parseFileName(): Parse the batch file name
19.5. BaseCompiler.parseFileLocality(): Find the location or station code in a batch file name
19.6. BaseCompiler.checkForLocation()
19.7. BaseCompiler.checkForStation()
19.8. BaseCompiler.scanCallback(): Error localization string
19.9. BaseCompiler.__iter__(): Iterator
19.10. BaseCompiler.classify(): Which kind of line is it?
19.11. BaseCompiler.scanPageHeader(): Process a page header line
19.12. BaseCompiler.scanPrefix(): Process a band prefiix line
19.13. BaseCompiler.scanEncounter(): Process an encounter line
20. class Maps2006Compiler: Compiler for MAPS 2006 files
21. class Maps2004Compiler: Compiler for MAPS 2004 protocol
21.1. Maps2004Compiler.scanEncounter()
22. class Maws2007Compiler: MAWS 2007 compiler
22.1. Maws2007Compiler.scanEncounter()
23. class Maws2004Compiler: MAWS compiler
23.1. Maws2004Compiler.scanEncounter()
24. class PageHeader: Page header line object
24.1. PageHeader.__init__(): Constructor
24.2. PageHeader.scanLine(): Scan a page header line
24.3. PageHeader.checkSite(): Verify correct location or station
25. class Prefix: Band number prefix line
25.1. Prefix.__init__(): Constructor
25.2. Prefix.scanLine(): Scan a band prefix line
26. class FieldItem: Base class for encounter record fields
27. class SingleField: Generic single-character field
27.1. SingleField.scanField()
27.2. SingleField.flatten(): Flatten single-character field
28. class PageNoField: Page number field
28.1. PageNoField.flatten()
29. class BandSizeField: Band size field
29.1. BandSizeField.flatten()
30. class LocationField: Location code field
30.1. LocationField.flatten()
31. class CaptureCodeField: Encounter record type code
31.1. CaptureCodeField.flatten()
32. class BandNoField: Band number field
32.1. BandNoField.prefix(): Extract band number prefix
32.2. BandNoField.suffix(): Extract band number suffix
32.3. BandNoField.incrementPrefix(): Increment a prefix with rollover
32.4. BandNoField.scanField()
32.5. BandNoField.flatten()
32.6. BandNoField.attachSuffix(): Join a band prefix and suffix
33. class BandNoSuffix: Short band number
33.1. BandNoSuffix.scanField()
34. class Spec4Field: Four-letter species code
34.1. Spec4Field.scanField()
34.2. Spec4Field.flatten()
35. class Spec6Field: Six-letter MAWS species code
35.1. Spec6Field.scanField()
35.2. Spec6Field.flatten()
36. class AgeCodeField: Age code
36.1. AgeCodeField.scanField()
37. class HowGroupField: How-code group
37.1. HowGroupField.scanField(): Scan a group of how-codes
37.2. HowGroupField.flatten()
38. class SexCodeField: Sex code
38.1. SexCodeField.scanField()
39. class SkullField: Skull ossification
39.1. SkullField.scanField()
40. class CloacalField: Cloacal protuberance
41. class BroodField: Brood patch
42. class FatField: Fat class
43. class BodyMoltField: Body molt
44. class FlightMoltField: Flight feather molt
45. class FlightWearField: Flight feather wear
46. class JuvenalField: Juvenal plumage
47. class MicroAgingField: Base class for microaging fields
48. class MicroPPCField: Primary coverts micro-aging field
49. class MicroSSCField: Secondary coverts micro-aging field
50. class MicroPPFField: Primaries micro-aging field
51. class MicroSSFField: Secondaries micro-aging field
52. class MicroTTField: Tertials micro-aging field
53. class MicroRRField: Rectrices micro-aging field
54. class MicroHDField
55. class MicroUPPField
56. class MicroUNPField
57. class MicroBPLField: Body plumage micro-aging field
58. class MicroNFField: Non-feather micro-aging field
59. class WingField: Wing length
59.1. WingField.scanField(): Scan a wing length field
59.2. WingField.flatten()
60. class MassField: Body mass
60.1. MassField.scanField()
60.2. MassField.flatten()
61. class StatusField: Release status code
61.1. StatusField.scanField()
61.2. StatusField.flatten()
62. class DateField: Date field
62.1. DateField.scanField()
62.2. DateField.flatten()
63. class MawsDateField: MAWS date field
63.1. MawsDateField.scanField()
64. class HHMField: Time of day
64.1. HHMField.scanField()
64.2. HHMField.flatten()
65. class StationCodeField: Station code
65.1. StationCodeField.scanField()
65.2. StationCodeField.flatten()
66. class Net2Field: Two-character net code
66.1. Net2Field.scanField()
66.2. Net2Field.flatten()
67. class Net4Field: Four-character net code
67.1. Net4Field.scanField()
67.2. Net4Field.flatten()
68. class DispositionField
68.1. DispositionField.scanField()
69. class NoteField: Note number
69.1. NoteField.scanField()
69.2. NoteField.flatten()
70. class PulledField: Feather-pulled code
71. class ColorBandsField: Color-band sequence
71.1. ColorBandsField.scanField()
71.2. ColorBandsField.flatten()
72. class SwabField: Cloacal swab code
72.1. SwabField.scanField()
73. class BaseEncounter: General output record
73.1. Design notes for the BaseEncounter class
73.2. BaseEncounter.OUT_FIELD_LIST: Definition of the output format
73.3. BaseEncounter.__init__(): Constructor
73.4. BaseEncounter.__getattr__(): Handle references to undefined attributes
73.5. BaseEncounter.flatten(): Convert to a flat-file record
73.6. BaseEncounter.scanLine(): Scan a raw encounter record
73.7. BaseEncounter.scanShort(): Scan lost or destroyed encounter line
73.8. BaseEncounter.scanUnbanded(): Scan unbanded encounter line
73.9. BaseEncounter.scanNewBand(): Scan short new-band line
73.10. BaseEncounter.scanLongNew(): Scan long new-band line
73.11. BaseEncounter.scanRecap(): Scan recapture encounter line
73.12. BaseEncounter.dispatchMap: Encounter record routing dictionary
73.13. BaseEncounter.scanBody(): Scan encounter line body and tail sections
73.14. BaseEncounter.scanTail(): Scan tail fields
73.15. BaseEncounter.scanTailField(): Scan one free-form tail field
73.16. BaseEncounter.tailColor(): Scan color-band tail
73.17. BaseEncounter.tailDisposition(): Scan disposition code tail field
73.18. BaseEncounter.tailPulled(): Scan feather-pulled tail field
73.19. BaseEncounter.tailNote(): Scan note tail field
73.20. BaseEncounter.tailSwab(): Scan swab tail field
73.21. BaseEncounter.tailDispatch: Tail field routing dictionary
73.22. BaseEncounter.copyDitto(): Implement single-column ditto
74. class Maps2004Encounter
74.1. Maps2004Encounter.OUT_FIELD_LIST: Output format definition
74.2. Maps2004Encounter.scanBody()
74.3. Maps2004Encounter.scanTail()
74.4. Maps2004Encounter.scanOldAlign(): Scan old alignment or feather-pulled field
74.5. Maps2004Encounter.scanLongTail()
75. class Maws2007Encounter
75.1. Maws2007Encounter.BODY_FIELD_LIST
75.2. Maws2007Encounter.scanBody(): Scan encounter line body and tail sections
76. class Maws2004Encounter
76.1. Maws2004Encounter.OUT_FIELD_LIST: Output record format table
76.2. Maws2004Encounter.BODY_FIELD_LIST
77. iband7: Current MAPS data compiler
77.1. Prologue
77.2. Imports
77.3. Manifest constants
77.4. iband7 main()
77.5. Epilogue
77.6. Test files for iband7
78. maps2004: MAPS data compiler for 2004 protocol
78.1. Prologue
78.2. Imports
78.3. Manifest constants
78.4. maps2004 main()
78.5. Epilogue
79. maps1998: MAPS data compiler for 1998 protocol
80. imaws2007: Current MAWS data compiler
80.1. Prologue
80.2. Imports
80.3. Manifest constants
80.4. imaws2007 main()
80.5. Epilogue
81. imaws2004: MAWS 2004 data compiler
81.1. Prologue
81.2. Imports
81.3. Manifest constants
81.4. imaws2004 main()
81.5. Epilogue
82. showstas: Look up MAPS station and location codes
82.1. showstas: Prologue
82.2. showstas: Imports
82.3. showstas: main
82.4. showstas: Epilogue
83. showmaws: Look up MAWS station and location codes
83.1. showmaws: Prologue
83.2. showmaws: Imports
83.3. showmaws: Manifest constants
83.4. showmaws: main
83.5. showmaws: Epilogue
84. spec2004, spec2002, and spec1998
84.1. spec2004 prologue
84.2. spec2004: Main
84.3. spec2004: Epilogue
84.4. spec2002
84.5. spec1998
85. dbfstruct: Display the structure of a dBASE V file
85.1. Prologue
85.2. main()
85.3. headerReport(): General information
85.4. fieldReport(): Report on field definitions
85.5. Epilogue
86. dbflatten: Convert a dBASE V file to flat format
86.1. Prologue
86.2. main()
86.3. flattenRecord(): Flatten one record
86.4. flattenField(): Flatten one field
86.5. Epilogue
87. The dbfpy package for reading dBASE V files
87.1. Dbf: Database object
87.2. DbfHeader: Database header object
87.3. DbfFieldDef: Field definition object
87.4. DbfRecord: Record object

1. Overview

This document describes the implementation of the system specified by iband7: IBP banding data entry system.

The actual code for several applications is contained in this document, document in literate style. For more information, see the author's lightweight literate programming page.

1.1. How to get this publication

This publication is available in Web form and also as a PDF document. Please forward any comments to john@nmt.edu.

1.2. Files generated from this document

This document is an exposition of the source code using lightweight literate programming practice: the source code is extracted from this document, so what you see here is the actual code. For more information on this practice, see the author's Lightweight Literate Programming page.

Here are links to all the files generated by extraction from this documentation's source file:

These files are not extracted from the source file, but are necessary or useful:

  • ibandims.xml: DocBook source file for this document, including all extracted source files.

  • Makefile: Used by the make utility to build HTML and PDF documentation and extract source code.

  • cset.py: A module from the author's standard Python library to represent sets of characters.

  • dump2006: A quick-and-dirty script to display output files in the MAPS 2006 protocol, used in testing iband7.

  • log.py: A module from the author's standard Python library that does error logging.

  • scan.py: A module from the author's standard Python library that manages reading an input stream and reporting errors on it.

  • README: Manifest of most of the files in this directory and what they do.

To execute some of these programs, you will need the public-domain, external dbf.py module; see Section 87, “The dbfpy package for reading dBASE V files”, which has links to the download page, and all the files from that module currently in use.