Skip to main content

Python client for Sintetic Project. This library provides a simple interface to interact with the Sintetic API, allowing users to manage and retrieve data related to synthetic datasets. For more information, visit https://sinteticproject.eu/

Project description

Contents of README.md

Sintetic Library

Description

Python client for Sintetic Project. This library provides a simple interface to interact with the Sintetic API, allowing users to manage and retrieve data related to synthetic datasets. For more information, visit https://sinteticproject.eu/

Intallation

To install the library, you can use pip:

pip install sintetic-library

Use case

from sintetic_library import SinteticClient

# Create istance of SinteticClient using your Sintetic account
client = SinteticClient(
        email="XXXXXX",
        password="YYYYYYY"
    )

# Call method for retrieving list of tree processors
result = client.get_list_tree_processors ()

# Retrieve list of forest properties
result = client.get_list_forest_properties () 

# Retrieve list of forest properties
result = client.get_list_forest_properties ()

# Create tree processor id for given data
data = { "name" : "Test Tree Processor",
         "type" : "harvester"    
       }        

id_tree_processor = client.create_tree_processor(data)

# Create new forest operation from given data
# 
data = { "name" : "Test Forest Operation",
                 "status" : "planned",
                 "location": {
                    "type": "Point",
                    "coordinates": [10.2, 45.2]
                    },  
                 "start_date" : "2025-06-19",
                 "end_date" : "2025-06-19", 
                 "area": 100,
                 "forest_property_id": "XXXXXXXX-YYYY-ZZZZ-XXXX-ZZZZZZZZZZZZ"
                }
        
id_forest_operation = client.create_forest_operation(data)       

# Retrieve list of Stan4D files
response = client.get_stan4d_list() 

# Save new Stan4D file
with open("./stan4d_file.hpr", "rb") as f:
    xml_content = f.read()
    
response = client.save_stan4d_object(
    filename=os.path.basename(f.name),
    xml_content=xml_content,
    tree_processor_id=id_tree_processor,
    forest_operation_id=id_forest_operation
)
    
# Extract Stan4D file ID    
stand4d_id = response.json()["id"]

# Get Stan4D file using the associated ID
response = client.get_stan4d_file(fileid=stand4d_id)

# Delete Stan4D file using the associated ID
response = client.delete_stan4d_file(fileid=stand4d_id)

# Delete Forest Operation using the associated ID
response = client.delete_forest_operation(forest_operation_id=id_forest_operation)
        
# Delete Tree Processor using the associated ID
response = client.delete_tree_processor(tree_processor_id=id_tree_processor)

# Save new climate attachment with daily values

# open csv file
with open("testcsv.csv", "rb") as f:
    csv_content = f.read()

# save new climate attachment element
response = client.save_climate_object(
    filename="testcsv.csv",
    climate_file=csv_content,
    anomalistic=True,
    forest_operation_id=id_forest_operation,
    temporal_resolution=TemporalResolution.DAILY.value,
    coverage_start_year=2025,
    coverage_end_year=2025,
    description="Some descriptions"
)
    
# Save UUID    
climate_object_id = response   

# print new Climate attachment UUID
print("Climate object saved successfully:", climate_object_id)    
    
# Get saved Climate Attachment info
print("Retrieved Climate Attachment info:", client.get_climate_attachments(climate_object_id))   

# Get Climate Attachment file    
print("Retrieved Climate file contents:", client.get_climate_file(climate_object_id))

# Delete Climate Attachment by given UUID    
print("delete climate file:", client.delete_climate_file(climate_object_id))

License

This library is freely provided for use within the Sintetic project

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sintetic_library-0.3.6.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sintetic_library-0.3.6-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file sintetic_library-0.3.6.tar.gz.

File metadata

  • Download URL: sintetic_library-0.3.6.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for sintetic_library-0.3.6.tar.gz
Algorithm Hash digest
SHA256 4214d249887096d926cbfc9cc40f93a0dbd087c6d5010a773bbf2546ba98fbb2
MD5 ff8c9fecd37504c606da59d512161cb5
BLAKE2b-256 bc3eeb1ae531488858a9687a1535bd8c661f8c04d52ab390135179a67c92f924

See more details on using hashes here.

File details

Details for the file sintetic_library-0.3.6-py3-none-any.whl.

File metadata

File hashes

Hashes for sintetic_library-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7dbfda21a02005be6e8b37e716ff575aa81d60cd5e520221f99751f3c9cb274a
MD5 539965382c2821666e35e8a4ea995d6f
BLAKE2b-256 52048603e8eb5c749f0f1162e10868211c8d16b2cc8f9244a2b31cd99de39cd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page