-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteste.py
More file actions
executable file
·59 lines (40 loc) · 1.29 KB
/
teste.py
File metadata and controls
executable file
·59 lines (40 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
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
import json
import os
from pprint import pprint
from google.cloud import storage
import sys
sys.path.append(os.path.abspath('./gee_toolbox'))
import gee as gee_toolbox
# The location of the input data in Google Cloud Storage.
GCS_BUCKET = 'sistema_alertas_sccon'
GCS_PREFIX = 'tiles/'
GCS_IGNORE = ['init']
account = 1
jsonFile = os.path.join(os.getcwd(), 'grids.geojson')
ACCOUNTS = ['joao']
def getTiles(jsonFile, account=1):
with open(jsonFile) as f:
jsonData = json.load(f)
features = jsonData['features']
filtered = filter(
lambda feature: feature['properties']['account'] == account, features)
tiles = map(
lambda feature: feature['properties']['PageNumber'], filtered)
return tiles
bucket = storage.Client().get_bucket(GCS_BUCKET)
# blobs = bucket.list_blobs(prefix=GCS_PREFIX)
# tiles = getTiles(jsonFile, account=account)
blob = storage.Blob(
'tiles/75004/20190326_124419_1034/20190326_124419_1034.xml',
bucket=bucket)
# count = 1
print(blob.download_as_string())
# print(blob.name)
# for blob in blobs:
# directory, filename = os.path.split(blob.name)
# tile = int(directory.split('/')[1])
# if tile in tiles:
# print directory
# print filename
# for i in range(0, len(ACCOUNTS)):
# print i+1, ACCOUNTS[i]