Next / Previous / Contents / Shipman's homepage

Abstract

Describes the implementation of a suite of programs to process bird-banding data.

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

Table of Contents

1. Overview
1.1. 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
20.1. Maps2006Compiler.scanEncounter()
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 WrpField: WRP molt cycle code
38.1. WrpField.scanField()
38.2. WrpField._check(): Check a WRP code
38.3. WrpField.flatten()
39. class SexCodeField: Sex code
39.1. SexCodeField.scanField()
40. class SkullField: Skull ossification
40.1. SkullField.scanField()
41. class CloacalField: Cloacal protuberance
42. class BroodField: Brood patch
43. class FatField: Fat class
44. class BodyMoltField: Body molt
45. class FlightMoltField: Flight feather molt
46. class FlightWearField: Flight feather wear
47. class JuvenalField: Juvenal plumage
48. class MicroAgingField: Base class for microaging fields
49. class MicroPPCField: Primary coverts micro-aging field
50. class MicroSSCField: Secondary coverts micro-aging field
51. class MicroPPFField: Primaries micro-aging field
52. class MicroSSFField: Secondaries micro-aging field
53. class MicroTTField: Tertials micro-aging field
54. class MicroRRField: Rectrices micro-aging field
55. class MicroHDField
56. class MicroUPPField
57. class MicroUNPField
58. class MicroBPLField: Body plumage micro-aging field
59. class MicroNFField: Non-feather micro-aging field
60. class WingField: Wing length
60.1. WingField.scanField(): Scan a wing length field
60.2. WingField.flatten()
61. class MassField: Body mass
61.1. MassField.scanField()
61.2. MassField.flatten()
62. class StatusField: Release status code
62.1. StatusField.scanField()
62.2. StatusField.flatten()
63. class DateField: Date field
63.1. DateField.scanField()
63.2. DateField.flatten()
64. class MawsDateField: MAWS date field
64.1. MawsDateField.scanField()
65. class HHMField: Time of day
65.1. HHMField.scanField()
65.2. HHMField.flatten()
66. class StationCodeField: Station code
66.1. StationCodeField.scanField()
66.2. StationCodeField.flatten()
67. class Net2Field: Two-character net code
67.1. Net2Field.scanField()
67.2. Net2Field.flatten()
68. class Net4Field: Four-character net code
68.1. Net4Field.scanField()
68.2. Net4Field.flatten()
69. class DispositionField
69.1. DispositionField.scanField()
70. class NoteField: Note number
70.1. NoteField.scanField()
70.2. NoteField.flatten()
71. class PulledField: Feather-pulled code
72. class ColorBandsField: Color-band sequence
72.1. ColorBandsField.scanField()
72.2. ColorBandsField.flatten()
73. class SwabField: Cloacal swab code
73.1. SwabField.scanField()
74. class BaseEncounter: General output record
74.1. Design notes for the BaseEncounter class
74.2. BaseEncounter.OUT_FIELD_LIST: Definition of the output format
74.3. BaseEncounter.__init__(): Constructor
74.4. BaseEncounter.__getattr__(): Handle references to undefined attributes
74.5. BaseEncounter.flatten(): Convert to a flat-file record
74.6. BaseEncounter.scanLine(): Scan a raw encounter record
74.7. BaseEncounter.scanShort(): Scan lost or destroyed encounter line
74.8. BaseEncounter.scanUnbanded(): Scan unbanded encounter line
74.9. BaseEncounter.scanNewBand(): Scan short new-band line
74.10. BaseEncounter.scanLongNew(): Scan long new-band line
74.11. BaseEncounter.scanRecap(): Scan recapture encounter line
74.12. BaseEncounter.dispatchMap: Encounter record routing dictionary
74.13. BaseEncounter.scanBody(): Scan encounter line body and tail sections
74.14. BaseEncounter.scanTail(): Scan tail fields
74.15. BaseEncounter.scanTailField(): Scan one free-form tail field
74.16. BaseEncounter.tailColor(): Scan color-band tail
74.17. BaseEncounter.tailDisposition(): Scan disposition code tail field
74.18. BaseEncounter.tailPulled(): Scan feather-pulled tail field
74.19. BaseEncounter.tailNote(): Scan note tail field
74.20. BaseEncounter.tailSwab(): Scan swab tail field
74.21. BaseEncounter.tailDispatch: Tail field routing dictionary
74.22. BaseEncounter.copyDitto(): Implement single-column ditto
75. class Maps2006Encounter
75.1. Maps2006Encounter.BODY_FIELD_LIST
75.2. Maps2006Encounter.OUT_FIELD_LIST: Output format definition
76. class Maps2004Encounter
76.1. Maps2004Encounter.OUT_FIELD_LIST: Output format definition
76.2. Maps2004Encounter.scanBody()
76.3. Maps2004Encounter.scanTail()
76.4. Maps2004Encounter.scanOldAlign(): Scan old alignment or feather-pulled field
76.5. Maps2004Encounter.scanLongTail()
77. class Maws2007Encounter
77.1. Maws2007Encounter.BODY_FIELD_LIST
77.2. Maws2007Encounter.scanBody(): Scan encounter line body and tail sections
78. class Maws2004Encounter
78.1. Maws2004Encounter.OUT_FIELD_LIST: Output record format table
78.2. Maws2004Encounter.BODY_FIELD_LIST
79. iband8: 2013 MAPS data compiler
79.1. iband8: Prologue
79.2. iband8: Imports
79.3. iband8: Constants
79.4. iband8: main()
79.5. Epilogue
80. iband7: 2006 MAPS data compiler
80.1. Prologue
80.2. Imports
80.3. Manifest constants
80.4. iband7 main()
80.5. Epilogue
80.6. Test files for iband7
81. maps2004: MAPS data compiler for 2004 protocol
81.1. Prologue
81.2. Imports
81.3. Manifest constants
81.4. maps2004 main()
81.5. Epilogue
82. maps1998: MAPS data compiler for 1998 protocol
83. imaws2007: Current MAWS data compiler
83.1. Prologue
83.2. Imports
83.3. Manifest constants
83.4. imaws2007 main()
83.5. Epilogue
84. imaws2004: MAWS 2004 data compiler
84.1. Prologue
84.2. Imports
84.3. Manifest constants
84.4. imaws2004 main()
84.5. Epilogue
85. showstas: Look up MAPS station and location codes
85.1. showstas: Prologue
85.2. showstas: Imports
85.3. showstas: main
85.4. showstas: Epilogue
86. showmaws: Look up MAWS station and location codes
86.1. showmaws: Prologue
86.2. showmaws: Imports
86.3. showmaws: Manifest constants
86.4. showmaws: main
86.5. showmaws: Epilogue
87. spec2004, spec2002, and spec1998
87.1. spec2004 prologue
87.2. spec2004: Main
87.3. spec2004: Epilogue
87.4. spec2002
87.5. spec1998
88. dbfstruct: Display the structure of a dBASE V file
88.1. Prologue
88.2. main()
88.3. headerReport(): General information
88.4. fieldReport(): Report on field definitions
88.5. Epilogue
89. dbflatten: Convert a dBASE V file to flat format
89.1. Prologue
89.2. main()
89.3. flattenRecord(): Flatten one record
89.4. flattenField(): Flatten one field
89.5. Epilogue
90. The dbfpy package for reading dBASE V files
90.1. Dbf: Database object
90.2. DbfHeader: Database header object
90.3. DbfFieldDef: Field definition object
90.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. 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.

  • 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.

To execute some of these programs, you will need the public-domain, external dbf.py module; see Section 90, “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.