workspace module
Create and view projects on D2S instance.
Source code in d2spy/workspace.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
add_project(title, description, location, start_date=None, end_date=None, planting_date=None, harvest_date=None)
¶
Create new project in workspace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title
|
str
|
Title for project. |
required |
description
|
str
|
Description of project. |
required |
location
|
dict
|
GeoJSON object representing location of project. |
required |
start_date
|
Optional[date]
|
Start date of project. Defaults to None. |
None
|
end_date
|
Optional[date]
|
End date of project. Defaults to None. |
None
|
planting_date
|
Optional[date]
|
Planting date. Defaults to None. Deprecated. |
None
|
harvest_date
|
Optional[date]
|
Harvest date. Defaults to None. Deprecated. |
None
|
Returns:
Type | Description |
---|---|
Project
|
models.Project: New project instance. |
Source code in d2spy/workspace.py
connect(base_url, email=None)
classmethod
¶
Login and create workspace. If the email argument is not provided, the method will use the value of the D2S_EMAIL environment variable. If neither is available, an exception will be thrown.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
Base URL for D2S instance. |
required |
email
|
Optional[str]
|
Email address used to sign in to D2S. |
None
|
Returns:
Name | Type | Description |
---|---|---|
Workspace |
Workspace
|
D2S workspace for creating and viewing data. |
Source code in d2spy/workspace.py
get_project(project_id)
¶
Request single project by ID. Project must be active and viewable by user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id
|
str
|
Project ID. |
required |
Returns:
Type | Description |
---|---|
Optional[Project]
|
Optional[models.Project]: Project matching ID or None. |
Source code in d2spy/workspace.py
get_projects(has_raster=False)
¶
Request multiple projects. Only active projects viewable by user will be returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
has_raster
|
Optional[bool]
|
Only return projects with rasters. |
False
|
Returns:
Name | Type | Description |
---|---|---|
ProjectCollection |
ProjectCollection
|
Collection of all projects viewable by user. |
Source code in d2spy/workspace.py
logout()
¶
Logout of D2S platform.