The Herbarium Label Generator is a Python tool designed to create formatted herbarium labels from a iNaturalist and Mushroom Observer observations. This project rapidly creates professional quality labels for herbarium specimens. It is designed to be robust, work on many different platforms and handle errors or unexpected input gracefully.
An easy to use online version is at https://images.mushroomobserver.org/labels
- Fetches observation data using the iNaturalisti / Mushroom Observer API
- Supports multiple observation IDs or URLs as input - or a file can be specified
- Generates labels with key information including:
- Scientific Name (in italics)
- Common Name (if different from scientific name)
- iNaturalist / Mushroom Observer Observation Number
- iNaturalist / Mushroom Observer URL
- Location (in text format)
- GPS Coordinates (with accuracy - accuracy is set to 20km if observation geoprivacy is obscured)
- Date Observed
- Observer Name and iNaturalist login
- DNA Barcode ITS, LSU, RPB1, RPB2 and TEF1 (if present)
- GenBank Accession Number (if present)
- Provisional Species Name (if present)
- Mushroom Observer URL (if present, formatted in simplest possible URL form)
- Microscopy Performed (if present)
- Traditional or Mobile Photography (if present)
- Herbarium Catalog Number (if present)
- Herbarium Name (if present)
- Mycoportal ID (if present)
- Voucher number(s) (if present)
- Observation Notes
- By default outputs labels to console for quick viewing / testing
- Optionally creates formatted RTF files for high-quality printing (RTF output is strongly recommended)
- Handles special characters and formatting (e.g., italics for scientific names, proper display of ± symbol)
- An optional command line switch can print out the iNaturalist URL's of observations which are in California. This makes it easy to add these observations to the Mycomap CA Network project.
- Includes a 1-second delay if there are more than 20 requests, which stops the iNaturalist API from denying requests for large label printing jobs.
- Adds a QR code to the RTF labels which points to the iNaturalist URL
- When generating RTF labels it prints the iconic taxon along with the name - fungi in blue, plants in green and everything else in white. This will help you quickly notice if an observation number is mistyped.
Instead of installing this software, consider using the online version: https://images.mushroomobserver.org/labels
-
Clone this repository:
bash git clone https://github.com/AlanRockefeller/inat.label.py
-
Navigate to the project directory:
bash cd inat.label.py
-
Install the required dependencies:
bash pip install requests python-dateutil beautifulsoup4 qrcode[pil] colorama replace-accents pillow
Run the script from the command line, providing one or more iNaturalist observation IDs or URLs:
python inat.label.py <observation_number_or_url> [<observation_number_or_url> ...]
To generate an RTF file, use the --rtf
option:
python inat.label.py <observation_number_or_url> [<observation_number_or_url> ...] --rtf <filename.rtf>
To print out a list of URL's of observations that are in California, use the --find-ca
option. This was added to make it easy to add observations to the Mycomap CA Network project. I paste the list of URL's into the Bulk URL Opener Chrome extension and add each tab to the project. If there is an easier way, I haven't found it yet.
python inat.label.py <observation_number_or_url> [<observation_number_or_url> ...] --find-ca
-
Generate label for a single observation:
python3 inat.label.py 183905751
-
Generate labels for multiple observations:
python3 inat.label.py 183905751 147249599 https://www.inaturalist.org/observations/106191917 MO505283
-
Generate labels and save to an RTF file:
python3 inat.label.py 183905751 147249599 --rtf two_labels.rtf
The script generates herbarium labels to the standard output by default, or labels are written to an RTF file if the --rtf command line argument is given. RTF labels look much more professional when printed and include QR codes - the standard output is mostly for testing.
- Python 3.6+
- requests
- python-dateutil
- beautifulsoup4
- qrcode[pil]
- colorama
- replace-accents
- pillow
Contributions to the iNaturalist Herbarium Label Generator are welcome! Here's how you can contribute:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature
) - Make your changes
- Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Contact Alan Rockefeller via email, old fashioned phone call or messenger of your choice
Or just contact me with suggestions.
This project is licensed under the MIT License - see the LICENSE.md file for details.
Alan Rockefeller - My email address is my full name at gmail, or message me on Facebook, Linkedin or Instagram
Project Link: https://github.com/AlanRockefeller/inat.label.py