Python Reference¶
Public API¶
EURING data processing library.
This package provides functionality to decode and validate EURING (European Union for Bird Ringing) data records. EURING is the standard format for bird ringing data exchange in Europe.
Main features: - Decode EURING 2000 and 2000+ format records - Validate field types and formats - Parse geographical coordinates - Look up code meanings
- exception euring.EuringParseException[source]¶
Bases:
EuringExceptionRaised when EURING parsing or validation fails.
- class euring.EuringRecord(format: str, *, strict: bool = True)[source]¶
Bases:
objectBuild or decode EURING records.
- classmethod decode(value: str, format: str | None = None) EuringRecord[source]¶
Decode a EURING record string into an EuringRecord.
- property display_format: str¶
Return the formal EURING format name.
- export(output_format: str, *, force: bool = False, warn_on_loss: bool = True) str[source]¶
Export the record to another EURING string format.
- property fields: dict[str, dict[str, object]]¶
Return the decoded field data.
- has_errors(errors: object) bool[source]¶
Return True when a structured errors payload contains entries.
- serialize(output_format: str | None = None) str[source]¶
Serialize and validate a EURING record string or JSON payload.
- set(key: str, value: object) EuringRecord[source]¶
Set a field value by key.
- update(values: dict[str, object]) EuringRecord[source]¶
Update multiple field values.
- euring.convert_euring2000_record(value: str, target_format: str = 'euring2020') str[source]¶
Convert a fixed-width euring2000 record to euring2000plus or euring2020.
- euring.convert_euring_record(value: str, source_format: str | None = None, target_format: str = 'euring2020', force: bool = False) str[source]¶
Convert EURING records between euring2000, euring2000plus, and euring2020.
- euring.euring_coord_to_dms(value, degrees_pos)[source]¶
Format a decimal coordinate into EURING DMS text with fixed degree width.
- euring.euring_float_to_dms(value, round_seconds=False)[source]¶
Convert a Decimal Degree Value into Degrees Minute Seconds Notation.
Pass value as double type = {Latitude or Longitude} as string
returns a dict with quadrant, degreees, minutes, seconds created by: anothergisblog.blogspot.com modified by: Dylan Verheul
- euring.euring_identification_display_format(euring_number)[source]¶
Return EURING number in upper case, with anything that is not a letter or digit removed.
- Parameters:
euring_number
- Returns:
- euring.euring_identification_export_format(euring_number)[source]¶
Return EURING code formatted for display and with added internal padding (dots) up to length 10.
- Parameters:
euring_number
length
- Returns:
- euring.euring_lat_to_dms(value)[source]¶
Convert a latitude in decimal degrees into EURING DMS text.
- euring.euring_lng_to_dms(value)[source]¶
Convert a longitude in decimal degrees into EURING DMS text.
- euring.euring_scheme_export_format(scheme_code)[source]¶
Proper export format for a scheme code.
- Parameters:
scheme_code – Scheme code (string)
- Returns:
Formatted scheme code
- euring.euring_species_export_format(species_code)[source]¶
Proper export format for EURING species code.
- Parameters:
species_code
- Returns:
- euring.is_alphabetic(value)[source]¶
Alphabetic.
Upper case letters drawn from the 26-letter Roman alphabet, some punctuation marks (but never commas) may be included. :param value: Value to test :return: Result
- euring.is_alphanumeric(value)[source]¶
Alphanumeric.
Combinations of upper case letters, digits 0 to 9 and arithmetic signs. :param value: Value to test :return: Result
- euring.is_integer(value)[source]¶
Integer.
Whole numbers, one or more digits. Note that some fields require leading zeroes. :param value: Value to test :return: Result
- euring.is_numeric(value)[source]¶
Numeric.
Any numbers, with decimal points allowed. :param value: Value to test :return: Result
- euring.is_numeric_signed(value)[source]¶
Numeric signed.
Like Numeric, but allows a leading minus sign. The value -0 is not permitted. :param value: Value to test :return: Result
Usage examples¶
Build a EURING record:
from euring import EuringRecord
record = EuringRecord("euring2000plus")
record.set("ringing_scheme", "GBB")
record.set("primary_identification_method", "A0")
record.set("identification_number", "1234567890")
record.set("place_code", "AB00")
record.set("geographical_coordinates", "+0000000+0000000")
record.set("accuracy_of_coordinates", "1")
record_str = record.serialize()
record_json = record.serialize(output_format="json")
record_2020 = record.export("euring2020")
serialize() raises ValueError if required fields are missing or a value
fails validation. Use EuringRecord("euring2000plus", strict=False)
to allow missing optional values and keep placeholders in the output. Use
export() to convert to other EURING string formats.