ellipsis 3.1.21__tar.gz → 3.1.23__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ellipsis might be problematic. Click here for more details.
- {ellipsis-3.1.21 → ellipsis-3.1.23}/PKG-INFO +1 -1
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/__init__.py +1 -1
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/apiManager.py +9 -7
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/timestamp/__init__.py +1 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/timestamp/root.py +90 -7
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/usage/__init__.py +1 -1
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/usage/root.py +10 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis.egg-info/PKG-INFO +1 -1
- {ellipsis-3.1.21 → ellipsis-3.1.23}/setup.py +1 -1
- {ellipsis-3.1.21 → ellipsis-3.1.23}/LICENSE +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/README.md +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/account/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/account/accessToken/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/account/accessToken/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/account/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/file/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/file/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/folder/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/folder/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/hashtag/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/hashtag/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/invite/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/invite/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/member/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/member/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/style/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/style/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/timestamp/file/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/timestamp/file/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/timestamp/order/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/timestamp/order/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/raster/timestamp/util.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/featureProperty/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/featureProperty/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/style/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/style/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/feature/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/feature/message/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/feature/message/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/feature/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/feature/series/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/feature/series/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/file/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/file/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/order/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/order/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/sanitize.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/user/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/user/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/util/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/util/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/view/__init__.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/view/root.py +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis.egg-info/SOURCES.txt +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis.egg-info/dependency_links.txt +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis.egg-info/requires.txt +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis.egg-info/top_level.txt +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/setup.cfg +0 -0
- {ellipsis-3.1.21 → ellipsis-3.1.23}/test/test.py +0 -0
|
@@ -24,7 +24,7 @@ def filterNone(body, toString= False):
|
|
|
24
24
|
params[k] = body[k]
|
|
25
25
|
return params
|
|
26
26
|
|
|
27
|
-
def get(url, body = None, token = None, crash = True):
|
|
27
|
+
def get(url, body = None, token = None, crash = True, parseJson = True):
|
|
28
28
|
if body == None:
|
|
29
29
|
body = {'token': token}
|
|
30
30
|
else:
|
|
@@ -40,7 +40,7 @@ def get(url, body = None, token = None, crash = True):
|
|
|
40
40
|
|
|
41
41
|
url = url + '?' + body
|
|
42
42
|
|
|
43
|
-
r = call( method = requests.get, url = url, body = None, token = token, crash = crash )
|
|
43
|
+
r = call( method = requests.get, url = url, body = None, token = token, crash = crash, parseJson = parseJson )
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
return r
|
|
@@ -66,7 +66,7 @@ def delete(url, body, token = None):
|
|
|
66
66
|
return r
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
def call(method, url, body = None, token = None, crash = True):
|
|
69
|
+
def call(method, url, body = None, token = None, crash = True, parseJson = True):
|
|
70
70
|
body = filterNone(body)
|
|
71
71
|
if type(body) != type(None) and type(body) != type({}):
|
|
72
72
|
raise ValueError(
|
|
@@ -85,10 +85,12 @@ def call(method, url, body = None, token = None, crash = True):
|
|
|
85
85
|
if crash:
|
|
86
86
|
if r.status_code != 200:
|
|
87
87
|
raise ValueError(r.text)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
|
|
89
|
+
if parseJson:
|
|
90
|
+
try:
|
|
91
|
+
r = r.json()
|
|
92
|
+
except:
|
|
93
|
+
r = r.text
|
|
92
94
|
|
|
93
95
|
return r
|
|
94
96
|
else:
|
|
@@ -11,6 +11,7 @@ from ellipsis.path.raster.timestamp.root import trash
|
|
|
11
11
|
from ellipsis.path.raster.timestamp.root import recover
|
|
12
12
|
from ellipsis.path.raster.timestamp.root import getSampledRaster
|
|
13
13
|
from ellipsis.path.raster.timestamp.root import getValuesAlongLine
|
|
14
|
+
from ellipsis.path.raster.timestamp.root import contour
|
|
14
15
|
|
|
15
16
|
from ellipsis.path.raster.timestamp import file
|
|
16
17
|
from ellipsis.path.raster.timestamp import order
|
|
@@ -17,13 +17,16 @@ import tifffile
|
|
|
17
17
|
from PIL import Image
|
|
18
18
|
import geopandas as gpd
|
|
19
19
|
import datetime
|
|
20
|
+
import pandas as pd
|
|
20
21
|
import time
|
|
21
22
|
import requests
|
|
23
|
+
from skimage.measure import find_contours
|
|
24
|
+
from shapely.geometry import Point, LineString
|
|
22
25
|
|
|
23
26
|
def getDownsampledRaster(pathId, timestampId, extent, width, height, epsg=3857, style = None, token = None):
|
|
24
27
|
return getSampledRaster(pathId, timestampId, extent, width, height, epsg, style, token)
|
|
25
28
|
|
|
26
|
-
def getSampledRaster(pathId, timestampId, extent, width, height, epsg=
|
|
29
|
+
def getSampledRaster(pathId, timestampId, extent, width, height, epsg=4326, style = None, token = None):
|
|
27
30
|
bounds = extent
|
|
28
31
|
token = sanitize.validString('token', token, False)
|
|
29
32
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
@@ -32,9 +35,7 @@ def getSampledRaster(pathId, timestampId, extent, width, height, epsg=3857, styl
|
|
|
32
35
|
style = sanitize.validObject('style', style, False)
|
|
33
36
|
epsg = sanitize.validInt('epsg', epsg, True)
|
|
34
37
|
body = {'pathId':pathId, 'timestampId':timestampId, 'extent':bounds, 'width':width, 'height':height, 'style':style, 'epsg':epsg}
|
|
35
|
-
r = apiManager.get('/path/' + pathId + '/raster/timestamp/' + timestampId + '/rasterByExtent', body, token, crash = False)
|
|
36
|
-
if r.status_code != 200:
|
|
37
|
-
raise ValueError(r.message)
|
|
38
|
+
r = apiManager.get('/path/' + pathId + '/raster/timestamp/' + timestampId + '/rasterByExtent', body, token, crash = True, parseJson = False)
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
if type(style) == type(None):
|
|
@@ -56,18 +57,88 @@ def getSampledRaster(pathId, timestampId, extent, width, height, epsg=3857, styl
|
|
|
56
57
|
return {'raster': r, 'transform':trans, 'extent': {'xMin' : xMin, 'yMin': yMin, 'xMax': xMax, 'yMax': yMax}, 'crs':"EPSG:" + str(epsg) }
|
|
57
58
|
|
|
58
59
|
|
|
60
|
+
def contour(pathId, timestampId, extent, interval = None, intervals = None, epsg = 4326, bandNumber = 1, token = None):
|
|
61
|
+
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
62
|
+
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
63
|
+
token = sanitize.validString('token', token, False)
|
|
64
|
+
epsg = sanitize.validInt('epsg', epsg, True)
|
|
65
|
+
extent = sanitize.validBounds('extent', extent, True)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
res = getActualExtent(extent['xMin'], extent['xMax'], extent['yMin'], extent['yMax'], 'EPSG:' + str(epsg))
|
|
69
|
+
if res['status'] == '400':
|
|
70
|
+
raise ValueError('Invalid epsg and extent combination')
|
|
71
|
+
|
|
72
|
+
bounds = res['message']
|
|
73
|
+
|
|
74
|
+
xMinWeb = bounds['xMin']
|
|
75
|
+
yMinWeb = bounds['yMin']
|
|
76
|
+
xMaxWeb = bounds['xMax']
|
|
77
|
+
yMaxWeb = bounds['yMax']
|
|
78
|
+
|
|
79
|
+
extentWeb = {'xMin': xMinWeb, 'xMax':xMaxWeb, 'yMin':yMinWeb, 'yMax':yMaxWeb}
|
|
80
|
+
size = 1000
|
|
81
|
+
r = getSampledRaster(pathId = pathId, timestampId = timestampId, extent = extentWeb, width = size, height = size, epsg=3857, token = token)
|
|
82
|
+
raster = r['raster']
|
|
83
|
+
|
|
84
|
+
if bandNumber >= raster.shape[0]:
|
|
85
|
+
raise ValueError('BandNumber too high. Raster only has ' + str(raster.shape[0]) + 'bands.')
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if type(intervals) == type(None):
|
|
90
|
+
minVal = np.min(raster[bandNumber-1, raster[-1,:,:] == 1])
|
|
91
|
+
maxVal = np.max(raster[bandNumber-1, raster[-1,:,:] == 1])
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
cont = minVal + interval
|
|
95
|
+
|
|
96
|
+
conts = []
|
|
97
|
+
while cont < maxVal:
|
|
98
|
+
conts = conts + [cont]
|
|
99
|
+
cont = cont + interval
|
|
100
|
+
else:
|
|
101
|
+
conts = intervals
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
Lx = (xMaxWeb - xMinWeb)/size
|
|
105
|
+
Ly = (yMaxWeb - yMinWeb)/size
|
|
106
|
+
|
|
107
|
+
sh_total = []
|
|
108
|
+
for cont in conts:
|
|
109
|
+
|
|
110
|
+
lines = find_contours(raster[bandNumber-1,:,:], mask=raster[-1,:,:] == 1, level = cont)
|
|
111
|
+
|
|
112
|
+
newLines = []
|
|
113
|
+
line = lines[0]
|
|
114
|
+
for line in lines:
|
|
115
|
+
newLine = LineString([ Point( xMinWeb + x[0] * Lx , yMinWeb + x[1] * Ly ) for x in line])
|
|
116
|
+
newLines = newLines + [newLine]
|
|
117
|
+
|
|
118
|
+
sh = gpd.GeoDataFrame({'geometry': newLines, 'label': (np.repeat(cont, len(newLines)))} )
|
|
119
|
+
|
|
120
|
+
sh_total = sh_total + [sh]
|
|
121
|
+
|
|
122
|
+
sh = pd.concat(sh_total)
|
|
123
|
+
sh.crs = 'EPSG:3857'
|
|
124
|
+
sh = sh.to_crs('EPSG:' + str(epsg))
|
|
125
|
+
|
|
126
|
+
return sh
|
|
127
|
+
|
|
128
|
+
|
|
59
129
|
def getValuesAlongLine(pathId, timestampId, line, token = None, epsg = 4326):
|
|
60
130
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
61
131
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
62
132
|
token = sanitize.validString('token', token, False)
|
|
63
133
|
line = sanitize.validShapely('line', line, True)
|
|
134
|
+
epsg = sanitize.validInt('epsg', epsg, True)
|
|
64
135
|
|
|
65
136
|
if line.type != 'LineString':
|
|
66
137
|
raise ValueError('line must be a shapely lineString')
|
|
67
138
|
|
|
68
139
|
temp = gpd.GeoDataFrame({'geometry':[line]})
|
|
69
140
|
temp.crs = 'EPSG:' + str(epsg)
|
|
70
|
-
temp = temp.to_crs('EPSG:
|
|
141
|
+
temp = temp.to_crs('EPSG:3857')
|
|
71
142
|
line = temp['geometry'].values[0]
|
|
72
143
|
line = list(line.coords)
|
|
73
144
|
|
|
@@ -79,20 +150,32 @@ def getValuesAlongLine(pathId, timestampId, line, token = None, epsg = 4326):
|
|
|
79
150
|
xMax = max(x_of_line)
|
|
80
151
|
yMin = min(y_of_line)
|
|
81
152
|
yMax = max(y_of_line)
|
|
82
|
-
|
|
153
|
+
|
|
154
|
+
d = (xMax - xMin) * 0.1
|
|
155
|
+
xMax = xMax + d
|
|
156
|
+
xMin = xMin -d
|
|
157
|
+
d = (yMax - yMin) * 0.1
|
|
158
|
+
yMax = yMax + d
|
|
159
|
+
yMin = yMin -d
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
83
163
|
#now we retrieve the needed raster we use epsg = 4326 but we can use other coordinates as well
|
|
84
164
|
extent = {'xMin': xMin, 'xMax':xMax, 'yMin':yMin, 'yMax':yMax}
|
|
85
165
|
|
|
86
166
|
size = 1000
|
|
87
|
-
r = getSampledRaster(pathId = pathId, timestampId = timestampId, extent = extent, width = size, height = size, epsg=
|
|
167
|
+
r = getSampledRaster(pathId = pathId, timestampId = timestampId, extent = extent, width = size, height = size, epsg=3857, token = token)
|
|
88
168
|
raster = r['raster']
|
|
89
169
|
|
|
90
170
|
memfile = MemoryFile()
|
|
91
171
|
dataset = memfile.open( driver='GTiff', dtype='float32', height=size, width=size, count = raster.shape[0], crs= r['crs'], transform=r['transform'])
|
|
92
172
|
dataset.write(raster)
|
|
93
173
|
|
|
174
|
+
|
|
175
|
+
|
|
94
176
|
values = list(dataset.sample(line))
|
|
95
177
|
|
|
178
|
+
memfile.close()
|
|
96
179
|
return values
|
|
97
180
|
|
|
98
181
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
from ellipsis.path.usage.root import getActiveUsers, getUsage, getAggregatedUsage
|
|
1
|
+
from ellipsis.path.usage.root import getActiveUsers, getUsage, getAggregatedUsage, getUserUsage
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from ellipsis import apiManager, sanitize
|
|
2
2
|
from ellipsis.util.root import recurse
|
|
3
|
+
from ellipsis.util.root import dateToString
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
|
|
5
7
|
def getActiveUsers(pathId, token, listAll = True, pageStart = None):
|
|
@@ -36,3 +38,11 @@ def getAggregatedUsage(pathId, loggedIn, token):
|
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
return apiManager.get('/path/' + pathId + '/usage/processingUnits', {'loggedIn': loggedIn}, token)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def getUserUsage(userId, date, token):
|
|
44
|
+
token = sanitize.validString('token', token, True)
|
|
45
|
+
userId = sanitize.validUuid('userId', userId, True)
|
|
46
|
+
date = sanitize.validDate('date', date, True)
|
|
47
|
+
|
|
48
|
+
return apiManager.get('/path/usage/user/' + userId + '/processingUnits', {'date':date}, token)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/feature/message/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ellipsis-3.1.21 → ellipsis-3.1.23}/ellipsis/path/vector/timestamp/feature/series/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|