Observed since 20 Oct, 19:32 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A package for parsing ADIS files or creating new files in the ADIS format.
A python package for parsing and creating ADIS (Agricultural Data Interchange Syntax) files.
This parser supports Class A ADIS format.
Wikipedia artice (unfortunately only available in german)
pip install adis
# example_adis_to_json.py
from adis import Adis
adis = Adis.parse_from_file("sample.ads")
generated_json = adis.to_json()
print(generated_json)
Prettyprinted output:
[
{
"990001": {
"definitions": [
{
"item_number": "00000000",
"field_size": 20,
"decimal_digits": 0
},
{
"item_number": "00000001",
"field_size": 9,
"decimal_digits": 6
},
{
"item_number": "00000002",
"field_size": 10,
"decimal_digits": 0
}
],
"data": [
{
"00000000": "Euler number",
"00000001": 2.718281,
"00000002": null
},
{
"00000000": "Pi",
"00000001": 3.141592,
"00000002": null
},
{
"00000000": "Gravity on Earth",
"00000001": 9.81,
"00000002": "ms^(-2)"
}
],
"status": "H"
},
"990002": {
"definitions": [
{
"item_number": "00000008",
"field_size": 10,
"decimal_digits": 0
},
{
"item_number": "00000009",
"field_size": 10,
"decimal_digits": 0
}
],
"data": [
{
"00000008": "abc",
"00000009": "xyz"
},
{
"00000008": "def",
"00000009": "uvw"
}
],
"status": "N"
}
},
{
"990001": {
"definitions": [
{
"item_number": "00000006",
"field_size": 10,
"decimal_digits": 0
},
{
"item_number": "00000007",
"field_size": 5,
"decimal_digits": 2
}
],
"data": [
{
"00000006": "1",
"00000007": 1.23
},
{
"00000006": "2"
}
],
"status": "H"
}
}
]
# example_json_to_adis.py
from adis import Adis
adis = Adis.from_json_file("sample.json")
generated_adis_text = adis.dumps()
print(generated_adis_text)
Output:
DH990001000000002000000000109600000002100
VH990001Euler number 2718281??????????
VH990001Pi 3141592??????????
VH990001Gravity on Earth 9810000ms^(-2)
DN9900020000000810000000009100
VN990002abc xyz
VN990002def uvw
EN
DH9900010000000610000000007052
VH990001 1 123
VH990001 2|||||
ZN
Each physical file can contain multiple logical ADIS files, these are represented by objects of the type AdisFile.
Each of those logical ADIS files contains one or multiple blocks, these are represented by objects of the type AdisBlock.
Each block consists of the definitions for the fields (list of objects of type AdisFieldDefinition) and one or multiple
data rows (list of list of AdisValue).
This documentation only contains methods that are inteded to be used by the user. Take a look at the docstrings for more information about methods.
Static methods:
parse(text): Creates an Adis object from a text that's in the ADIS formatparse_from_file(path_to_file): Creates an Adis object from an ADIS filefrom_json(json_text): Create an Adis object from a json textfrom_json_file(path_to_json_file): Create an Adis object from a json fileNormal methods:
__init__(adis_files): Creates an Adis object from a list of AdisFilesto_json(strip_string_values=True): Creates a json text containing the files, definitions and datadumps(): Creates a text in the ADIS formatget_files(): Returns a list of AdisFilesNormal methods:
__init__(blocks): Creates an AdisFile from a list of AdisBlocksget_blocks(): Returns a list of AdisBlocksNormal methods:
__init__(entity_number, status, field_definitions, data_rows): Creates an AdisBlockget_entity_number(): Returns the entity number of this AdisBlockget_field_definitions(): Returns the field definitions as list of AdisFieldDefinitionsget_data_rows(): Returns the data rows as list. Each data row is a list of AdisValuesNormal methods:
__init__(item_number, field_size, decimal_digits): Creates an AdisFieldDefinitionget_item_number(): Returns the item numberget_field_size(): Returns the field sizeget_decimal_digits(): Returns the number of decimal digitsStatic flags:
strip_string_values: String values that are returned by to_dict() will be
stripped if this flag is set.Normal methods:
__init__(item_number, value): Creates an AdisValueto_dict(): Returns a dict containing the item number and value of this AdisValueDownload counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.1 | 16 Feb 2022 | 0 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 19:32 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:de143b09803a3a0327005b959c37e1b7ab4ffe4a112d680be3bfc9e6611959e5