Skip to main content

The module implements functions for working with the Cropwise Operations digital management platform.

Project description

The cropwiseworker module is designed to work with the Cropwise Operations digital agricultural enterprise management platform. The module allows you to interact with various platform data, facilitating the integration and automation of tasks.

Installing

Install module using pip:

pip install cropwiseworker

Module functions

Get dict with Cropwise Operations user account API token

to_auth(login, password):

Mass download of data from the Cropwise Operations account

data_downloader(endpoint, token, params=None, data_format=None, version=None)
  • endpoint (required) – enter your endpoint from Cropwise Operations API documentation using str data type
  • token (required) – enter your TOKEN from Cropwise Operations account using str data type
  • params – enter your endpoint parameters using array format (default = None)
  • data_format – enter suggested data format (default = pd.DataFrame(), also could be 'json')
  • version – enter your Cropwise Operations API version using str data type (default = 'v3')

Create a massive dataset with soil test, crop rotation, agro operation and yield data for analysis named Agrimatrix

agrimatrix_dataset(enterprise, token, season)
  • enterprise (required) – enter a name of your enterprise using str data type
  • token (required) – enter your TOKEN from Cropwise Operations account using str data type
  • season (required) – enter an interested value of season using int data type

Create a kml-file with several orchard rows inside of quarter kml-file

create_orchard_rows(file_path, quarter_name, number_of_rows, start_side='right', crop=None, download_directory=None, start_row_number=1)
  • file_path (required) – enter a directory of your quarter with row direction line in KML format using str data type. The row direction line should have a name 'row_direction_{quarter name}'
  • quarter_name (required) – enter a name of your quarter. This argument allows to create rows for KML-file with several quarters with different row directions
  • number_of_rows (required) – enter the relevant number of orchard rows to create using int data type
  • start_side – select the side from which you want to start numbering rows relative to the direction line (default = 'right', also could be 'left')
  • crop – enter a name of crop which grows in your quarter using str data type (default = None)
  • download_directory – enter a directory to download result file using str data type (default = None)
  • start_row_number – enter a number of a first row in the quarter using int data type (default = 1)

Get a data with last changed objects within certain period

fetch_changes(endpoint, token, start_date, end_date, step_days=3, output_format='dataframe')
  • endpoint (required) – enter your endpoint from Cropwise Operations API documentation using str data type
  • token (required) – enter your TOKEN from Cropwise Operations account using str data type
  • start_date (required) – enter a date which from the data should start downloading in format 'YYYY-MM-DD'
  • end_date (required) – enter a date which till the data should start downloading in format 'YYYY-MM-DD'
  • step_days – enter a number of days between start_date and every next date
  • output_format – enter a format name for output data (default = pd.DataFrame, also could be 'json')

Workflow examples

import cropwiseworker as cw

token = to_auth('test@cropwise.com', 'pass')['token']

params = {'created_at_gt_eq':'2023-01-01'}

fields = cw.data_downloader('fields', token=token, params=params)
print(fields)

my_2023_analysis = cw.agrimatrix_dataset('YOUR_ENTERPRISE_NAME', token=token, season=2023)
print(my_2023_analysis)

cw.create_orchard_rows('path/to/your/file.kml', 'Quarter1', 50, 'left', 'Apple', 'path/to/download/directory', 10)

field_changes = cw.fetch_changes('fields', token, '2024-01-01', '2024-01-07', step_days=1, output_format='json')
print(field_changes)

License

This package is distributed under the Apache License 2.0.

Changelog

All noticeable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.0.11] – 2024-12-27

Added

– Added the new function to_auth() for getting user Cropwise Operations API token

Changed

  • The README.md

Fixed

  • The bug with agrimatrix_dataset() function

[0.0.10] – 2024-10-04

Added

  • Added requires for numpy

Changed

  • The README.md

Fixed

  • The bug with lack of attribute create_orchard_rows() and fetch_changes()

[0.0.9] – 2024-10-02

Added

  • Added argument start_row_number in function create_orchard_rows() to allow using your own numeration of rows

Changed

  • The README.md

Fixed

  • The bug in function create_orchard_rows() while working with MultiPolygon objects

[0.0.8] – 2024-08-02

Changed

  • The README.md
  • Added argument quarter_name in function create_orchard_rows() to allow using a KML-file with several quarters

[0.0.7] – 2024-07-25

Changed

  • The README.md
  • The algorithm of function create_orchard_rows() was changed. Added the opportunity to create rows in individual direction using the LineString of row direction in KML-file

[0.0.6] – 2024-07-16

Added

  • Added a new function fetch_changes() for mass loading of changed object from Cropwise Operations

Changed

  • The README.md

Fixed

  • The bug with previous version downloading

[0.0.5] – 2024-07-08

Added

  • Added a new function create_orchard_rows() for geofencing

[0.0.2] - 2024-04-12

Added

  • The project was created
  • Added the function data_downloader() for mass loading of data on the Cropwise Operations API
  • Added the function agrimatrix_dataset() for creating an Agrimatrix report
  • Integration with the external Cropwise Operations API

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

cropwiseworker-0.0.11.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

cropwiseworker-0.0.11-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file cropwiseworker-0.0.11.tar.gz.

File metadata

  • Download URL: cropwiseworker-0.0.11.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.7

File hashes

Hashes for cropwiseworker-0.0.11.tar.gz
Algorithm Hash digest
SHA256 ee9ca666d7a1b03c67562faca13e7c7537ae9b4153308dd14ec873a602a846d3
MD5 3f054891ca94890136b3dbb8f6d1982d
BLAKE2b-256 5743d401d278a2cba4d85e3d1d6e2cb3a7ad2b71ae416a24dfc3b6e33d73c915

See more details on using hashes here.

File details

Details for the file cropwiseworker-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for cropwiseworker-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 84cb736e9ba40942736a62a030363503f5eb32c685e98a988083525e80059a03
MD5 4f0c7e12981ede4218b37dae076f50f9
BLAKE2b-256 f2d0b4342170f8eb9f2d442bb43810a632418ad6a703d3b36bd506cf8178bc8d

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