Giter Site home page Giter Site logo

gee_asset_manager's Introduction

Google Earth Engine Batch Asset Manager

Google Earth Engine Batch Asset Manager ambition is helping user with batch actions on assets. It will be developed on use case basis, so if there's something missing feel free to post a feature request in Issues tab.

Table of contents

Installation

We assume Earth Engine Python API is installed and EE authorised as desribed here. To install:

git clone https://github.com/tracek/gee_asset_manager
cd gee_asset_manager && pip install -e .

Installation is an optional step; the application can be also run directly by executing geebam.py script. The advantage of having it installed is being able to execute geebam as any command line tool. I recommend installation within virtual environment.

Getting started

As usual, to print help:

geebam -h

positional arguments:
  {delete,upload,cancel,report}
    delete              Deletes collection and all items inside. Supports
                        Unix-like wildcards.
    upload              Batch Asset Uploader.
    cancel              Cancel all running tasks
    report              Produce summary of all assets.

optional arguments:
  -h, --help            show this help message and exit
  -s SERVICE_ACCOUNT, --service-account SERVICE_ACCOUNT
                        Google Earth Engine service account.
  -k PRIVATE_KEY, --private-key PRIVATE_KEY
                        Google Earth Engine private key file.

To obtain help for a specific functionality, simply call it with help switch, e.g.: geebam upload -h. If you didn't install geebam, then you can run it just by going to geebam directory and running python geebam.py [arguments go here]

Batch uploader

The script creates an Image Collection from GeoTIFFs in your local directory. By default, the collection name is the same as the local directory name; with optional parameter you can provide a different name. Another optional parameter is a path to a CSV file with metadata for images, which is covered in the next section: Parsing metadata.

geebam upload -h

usage: geebam upload [-h] --source SOURCE --dest DEST [-m METADATA] [--large]
                     [--nodata NODATA] [-u USER] [-s SERVICE_ACCOUNT]
                     [-k PRIVATE_KEY] [-b BUCKET]

optional arguments:
  -h, --help            show this help message and exit

Required named arguments.:
  --source SOURCE       Path to the directory with images for upload.
  --dest DEST           Destination. Full path for upload to Google Earth
                        Engine, e.g. users/pinkiepie/myponycollection
  -u USER, --user USER  Google account name (gmail address).

Optional named arguments:
  -m METADATA, --metadata METADATA
                        Path to CSV with metadata.
  --large               (Advanced) Use multipart upload. Might help if upload
                        of large files is failing on some systems. Might cause
                        other issues.
  --nodata NODATA       The value to burn into the raster as NoData (missing
                        data)
  -b BUCKET, --bucket BUCKET
                        Google Cloud Storage bucket name

Parsing metadata

By metadata we understand here the properties associated with each image. Thanks to these, GEE user can easily filter collection based on specified criteria. The file with metadata should be organised as follows:

filename (without extension) property1 header property2 header
file1 value1 value2
file2 value3 value4

Note that header can contain only letters, digits and underscores.

Example:

id_no class category binomial system:time_start
my_file_1 GASTROPODA EN Aaadonta constricta 1478943081000
my_file_2 GASTROPODA CR Aaadonta irregularis 1478943081000

The corresponding files are my_file_1.tif and my_file_2.tif. With each of the files five properties are associated: id_no, class, category, binomial and system:time_start. The latter is time in Unix epoch format, in milliseconds, as documented in GEE glosary. The program will match the file names from the upload directory with ones provided in the CSV and pass the metadata in JSON format:

{ id_no: my_file_1, class: GASTROPODA, category: EN, binomial: Aaadonta constricta, system:time_start: 1478943081000}

The program will report any illegal fields, it will also complain if not all of the images passed for upload have metadata associated. User can opt to ignore it, in which case some assets will have no properties.

Having metadata helps in organising your asstets, but is not mandatory - you can skip it.

Usage examples

Delete a collection with content:

The delete is recursive, meaning it will delete also all children assets: images, collections and folders. Use with caution!

geebam delete users/pinkiepie/test

Console output:

2016-07-17 16:14:09,212 :: oauth2client.client :: INFO :: Attempting refresh to obtain initial access_token
2016-07-17 16:14:09,213 :: oauth2client.client :: INFO :: Refreshing access_token
2016-07-17 16:14:10,842 :: root :: INFO :: Attempting to delete collection test
2016-07-17 16:14:16,898 :: root :: INFO :: Collection users/pinkiepie/test removed

Delete all directories / collections based on a Unix-like pattern

geebam delete users/pinkiepie/*weird[0-9]?name*

Upload a directory with images to your myfolder/mycollection and associate properties with each image:

geebam upload -u [email protected] --source path_to_directory_with_tif -m path_to_metadata.csv --dest users/pinkiepie/myfolder/myponycollection

The script will prompt the user for Google account password. The program will also check that all properties in path_to_metadata.csv do not contain any illegal characters for GEE. Don't need metadata? Simply skip this option.

Upload a directory with images with specific NoData value to a selected destination

geebam upload -u [email protected] --source path_to_directory_with_tif --dest users/pinkiepie/myfolder/myponycollection --nodata 222

In this case we need to supply full path to the destination, which is helpful when we upload to a shared folder. In the provided example we also burn value 222 into all rasters for missing data (NoData).

gee_asset_manager's People

Contributors

doctorluz avatar jelisejev avatar tracek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gee_asset_manager's Issues

ConnectionAbortedError: [WinError 10053]

Hi,

I was trying to batch upload some tifs in a virtualenv on Windows 10 but encountered somes problems. When I typed in codes likegeebam upload -u <my user name> --source path_to_directory_with_tif --dest users/my folder, it firstly runs well and I could see some informations:

2019-11-07 22:36:22,413 :: root :: INFO :: Running the browser in normal mode
2019-11-07 22:36:51,335 :: root :: INFO :: Browser closed.
2019-11-07 22:36:54,883 :: root :: INFO :: New collection users/zhao/test created

but then an error thrrown:

Traceback (most recent call last):
File "C:\Users\zhao\miniconda3\envs\ee\Scripts\geebam-script.py", line 11, in
load_entry_point('geebam', 'console_scripts', 'geebam')()
File "c:\users\zhao\gee_asset_manager\geebam.py", line 153, in main
args.func(args)
File "c:\users\zhao\gee_asset_manager\geebam.py", line 73, in upload_from_parser
tolerate_assets_already_exist=args.tolerate_assets_already_exist)
File "c:\users\zhao\gee_asset_manager\gee_asset_manager\batch_uploader.py", line 92, in upload
tolerate_assets_already_exist)
File "c:\users\zhao\gee_asset_manager\gee_asset_manager\batch_uploader.py", line 170, in _find_remaining_assets_for_upload
remote_assets = get_asset_names_from_collection(path_remote)
File "c:\users\zhao\gee_asset_manager\gee_asset_manager\batch_uploader.py", line 325, in get_asset_names_from_collection
assets_list = ee.data.getList(params={'id': collection_path})
File "c:\users\zhao\miniconda3\envs\ee\lib\site-packages\ee\deprecation.py", line 32, in Wrapper
return func(*args, **kwargs)
File "c:\users\zhao\miniconda3\envs\ee\lib\site-packages\ee\data.py", line 463, in getList
return send
('/list', params)
File "c:\users\zhao\miniconda3\envs\ee\lib\site-packages\ee\data.py", line 1753, in send

response, content = send_with_backoff()
File "c:\users\zhao\miniconda3\envs\ee\lib\site-packages\ee\data.py", line 1744, in send_with_backoff
url, method=opt_method, body=payload, headers=headers)
File "c:\users\zhao\miniconda3\envs\ee\lib\site-packages\google_auth_httplib2.py", line 198, in request
uri, method, body=body, headers=request_headers, **kwargs)
File "c:\users\zhao\miniconda3\envs\ee\lib\site-packages\httplib2_init
.py", line 1957, in request
cachekey,
File "c:\users\zhao\miniconda3\envs\ee\lib\site-packages\httplib2_init
.py", line 1622, in request
conn, request_uri, method, body, headers
File "c:\users\zhao\miniconda3\envs\ee\lib\site-packages\httplib2_init
.py", line 1528, in conn_request
conn.connect()
File "c:\users\zhao\miniconda3\envs\ee\lib\site-packages\httplib2_init
.py", line 1376, in connect
raise socket_err
File "c:\users\zhao\miniconda3\envs\ee\lib\site-packages\httplib2_init
.py", line 1311, in connect
self.sock = self._context.wrap_socket(sock, server_hostname=self.host)
File "c:\users\zhao\miniconda3\envs\ee\lib\ssl.py", line 401, in wrap_socket
_context=self, _session=session)
File "c:\users\zhao\miniconda3\envs\ee\lib\ssl.py", line 808, in init
self.do_handshake()
File "c:\users\zhao\miniconda3\envs\ee\lib\ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "c:\users\zhao\miniconda3\envs\ee\lib\ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the
software in your host machine

Does anyone have same issue?

Some informations of my virtualenv:
Package Version Location


absl-py 0.8.1
asn1crypto 0.22.0
astor 0.8.0
atomicwrites 1.3.0
attrs 19.3.0
beautifulsoup4 4.8.1
cachetools 3.1.1
certifi 2019.9.11
cffi 1.10.0
chardet 3.0.4
chromedriver-binary 78.0.3904.70.0
colorama 0.4.1
cryptography 1.8.1
earthengine-api 0.1.204
future 0.16.0
gast 0.2.2
geebam 0.1.5 c:\users\zhao\gee_asset_manager
google-api-core 1.14.3
google-api-python-client 1.7.11
google-auth 1.7.0
google-auth-httplib2 0.0.3
google-auth-oauthlib 0.4.1
google-cloud-core 1.0.3
google-cloud-storage 1.20.0
google-pasta 0.1.8
google-resumable-media 0.4.1
googleapis-common-protos 1.6.0
grpcio 1.25.0
h5py 2.10.0
httplib2 0.14.0
idna 2.8
implicit 0.4.0
importlib-metadata 0.23
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
Markdown 3.1.1
mkl-service 2.3.0
more-itertools 7.2.0
numpy 1.17.3
oauth2client 4.1.3
oauthlib 3.1.0
opt-einsum 3.1.0
packaging 16.8
pip 19.3.1
pluggy 0.13.0
protobuf 3.10.0
py 1.8.0
pyasn1 0.4.7
pyasn1-modules 0.2.7
pycparser 2.18
pyOpenSSL 17.0.0
pyparsing 2.2.0
PySocks 1.6.6
pytest 5.2.2
pytz 2017.2
requests 2.22.0
requests-oauthlib 1.2.0
requests-toolbelt 0.9.1
retrying 1.3.3
rsa 4.0
scipy 1.3.1
selenium 3.141.0
setuptools 41.6.0
simplejson 3.11.1
six 1.13.0
soupsieve 1.9.5
tensorboard 2.0.1
tensorflow 2.0.0
tensorflow-estimator 2.0.1
termcolor 1.1.0
tqdm 4.36.1
uritemplate 3.0.0
urllib3 1.25.6
wcwidth 0.1.7
Werkzeug 0.16.0
wheel 0.33.6
win-inet-pton 1.0.1
wincertstore 0.2
wrapt 1.11.2
zipp 0.6.0

Many thanks for your help.

Upload to shared assets folder

Currently the tool assumes user uploads the data to his own folder. It should be able to recognise when the path leads to a shared folder and don't assume current user path.

Too Many Redirects

geebam was working fine yesterday so I'm not sure what happened.

Now when I try to upload assets it gives me this error:

2017-05-25 17:55:11,063 :: root :: ERROR :: Upload of SWE_20031007 has failed.
Traceback (most recent call last):
File "/Users/rpetersky/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 83, in upload
properties, multipart_upload, nodata_value)
File "build/bdist.macosx-10.6-intel/egg/retrying.py", line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File "build/bdist.macosx-10.6-intel/egg/retrying.py", line 206, in call
return attempt.get(self._wrap_exception)
File "build/bdist.macosx-10.6-intel/egg/retrying.py", line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
File "build/bdist.macosx-10.6-intel/egg/retrying.py", line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File "/Users/rpetersky/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 133, in __upload_to_gcs_and_start_ingestion_task
nodata=nodata_value)
File "/Users/rpetersky/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 210, in __upload_file
upload_url = __get_upload_url(session)
File "/Users/rpetersky/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 198, in __get_upload_url
_ = session.get('https://ee-api.appspot.com/assets/upload/geturl?')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 597, in send
history = [resp for resp in gen] if allow_redirects else []
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 113, in resolve_redirects
raise TooManyRedirects('Exceeded %s redirects.' % self.max_redirects)
TooManyRedirects: Exceeded 30 redirects.

As far as I know I am not doing anything different. I am working on a MacOS with Yosemite and I am using Python 2.7.

Error uploading Tiff file

I am trying to upload GeoTIff file in the GEE and got the following error message in the GEE task bar ( however I have not got any error message in the screen while running the script). I have used same script before but have not any issue.
"Unable to open test.tif file"
When I try to upload data manually it works fine.

Problems authenticating with Google

Hi,

I'm trying to use gee_asset_manager to automatically upload processed assets and I've encountered some problems with Google authentication. Although I'm working in my own fork which supports non-interactive authentication, I can also reproduce the problem in the main version as well. Here's the problem:

  • I tried to upload the assets in the test folder from my personal machine using my personal account with this command python geebam.py upload -u [email protected] --source tests/images --dest users/jelisejevp/Geebam/TestCollection10. It worked. However, when I try to run it on a remote VM, authentication fails with the following error: RROR :: Incorrect credentials. Probably. If you are sure the credentials are OK, refresh t he authentication token. If it did not work report a problem. They might have changed something in the Matrix.. I've explicitly allowed access from this machine from my google account settings, but this didn't help.
  • When I tried to do this with a new test Google account, I got the same error from both my mac and the VM. The new account has access to Google Earth Engine and the credentials are correct.

Any idea what could be the problem? Could this be some clever security feature of Google?

ee.ee_exception.EEException: Invalid JSON payload received. Unknown name "value" at 'image_manifest.missing_data': Cannot find field.

receiving this error with or without using --nodata parameter or -m metadata values

no images gets uploaded

Traceback (most recent call last):                                                                                                                                                                                                             
  File "/home/jack/miniconda3/envs/earthengine/lib/python3.8/site-packages/ee/data.py", line 324, in _execute_cloud_call                                                                                                                       
    return call.execute(num_retries=num_retries)                                                                                                                                                                                               
  File "/home/jack/miniconda3/envs/earthengine/lib/python3.8/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/home/jack/miniconda3/envs/earthengine/lib/python3.8/site-packages/googleapiclient/http.py", line 856, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/image:import?alt=json returned "Invalid JSON payload received. Unknown name "value" at 'image_manifest.
missing_data': Cannot find field.". Details: "[{'@type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'image_manifest.missing_data', 'description': 'Invalid JSON payload received. Unknown name "value" at \'ima
ge_manifest.missing_data\': Cannot find field.'}]}]">

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jack/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 126, in upload
    task_id = __start_ingestion_task(asset_request)
  File "/home/jack/miniconda3/envs/earthengine/lib/python3.8/site-packages/retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "/home/jack/miniconda3/envs/earthengine/lib/python3.8/site-packages/retrying.py", line 212, in call
    raise attempt.get()
  File "/home/jack/miniconda3/envs/earthengine/lib/python3.8/site-packages/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/home/jack/miniconda3/envs/earthengine/lib/python3.8/site-packages/six.py", line 696, in reraise
    raise value
  File "/home/jack/miniconda3/envs/earthengine/lib/python3.8/site-packages/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "/home/jack/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 195, in __start_ingestion_task
    _ = ee.data.startIngestion(task_id, asset_request)
  File "/home/jack/miniconda3/envs/earthengine/lib/python3.8/site-packages/ee/data.py", line 1393, in startIngestion
    operation = _execute_cloud_call(
  File "/home/jack/miniconda3/envs/earthengine/lib/python3.8/site-packages/ee/data.py", line 326, in _execute_cloud_call
    raise _translate_cloud_exception(e)
ee.ee_exception.EEException: Invalid JSON payload received. Unknown name "value" at 'image_manifest.missing_data': Cannot find field.

Authorisation fails

The upload fails due to failed authorisation. Looks like now in the response I am getting a web form to log in, so the old ways are not working.

batch upload error

I don't have any authentication problems (e.g. I can successfully use geebam delete), and the batch uploader seems to begin the upload process, but then fails. The error message, "They might have changed something in the Matrix." does not give me much hope that this can be resolved. Any additional ideas?

2018-02-21 09:45:43,761 :: oauth2client.transport :: INFO :: Attempting refresh to obtain initial access_token
2018-02-21 09:45:43,761 :: oauth2client.client :: INFO :: Refreshing access_token
Password:
2018-02-21 09:46:05,332 :: root :: WARNING :: Collection users/dralle/persiann already exists
2018-02-21 09:46:06,481 :: root :: INFO :: Processing image 1 out of 3: /Users/daviddralle/Desktop/pers/rain_idw_persiann/rain_idw_persiann_315619200000.tif
2018-02-21 09:46:07,194 :: root :: ERROR :: Incorrect credentials. Probably. If you are sure the credentials are OK, refresh the authentication token. If it did not work report a problem. They might have changed something in the Matrix

Upload Failing with JSONDecodeError from gsid

Upload request from asset manager has been failing since morning wonder if it is not getting tool is not getting the gs url (since the error seems to be from reading the response to gsid. Any suggestions?

Here is the error code

Traceback (most recent call last):
  File "/home/samapriya/Downloads/gee_asset_manager-develop/gee_asset_manager/batch_uploader.py", line 109, in upload
    use_multipart=multipart_upload)
  File "/home/samapriya/.local/lib/python2.7/site-packages/retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "/home/samapriya/.local/lib/python2.7/site-packages/retrying.py", line 206, in call
    return attempt.get(self._wrap_exception)
  File "/home/samapriya/.local/lib/python2.7/site-packages/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/home/samapriya/.local/lib/python2.7/site-packages/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "/home/samapriya/Downloads/gee_asset_manager-develop/gee_asset_manager/batch_uploader.py", line 261, in __upload_file_gee
    gsid = resp.json()[0]
  File "/usr/local/lib/python2.7/dist-packages/requests-2.18.4-py2.7.egg/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 516, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Ability to resume upload

The check for existing asset was being done on case-by-case basis, which is highly ineffective if there are thousands of assets. Do it once for all.

Incorrect credentials

Hi Lukasz,

May be it is an easy to fix issue. I am new to all that coding stuff. I was trying to upload .tif images to GEE. However I receive an error message saying "Incorrect credentials". But I really do not understand what does that mean and what should I do. Could you please explain?

Here is what I get :
D:>python -m geebam upload -u valerija.stepanova@gmail.
com --source "D:\Berkely\Mag\Data\MOD16\d\prmtr" --dest users/Hydrology_Ass_3_la
b/MOD16
2017-04-13 16:54:09,229 :: oauth2client.transport :: INFO :: Attempting refresh
to obtain initial access_token
2017-04-13 16:54:09,244 :: oauth2client.client :: INFO :: Refreshing access_toke
n
Password:
2017-04-13 16:54:18,213 :: root :: WARNING :: Collection users/Hydrology_Ass_3_l
ab/MOD16 already exists
2017-04-13 16:54:19,319 :: root :: INFO :: Processing image 1 out of 180: D:\Ber
kely\Mag\Data\MOD16\d\prmtr\MOD16A2.A2000001.ET_1km.tif
2017-04-13 16:54:20,084 :: root :: ERROR :: Incorrect credentials. Probably. If
you are sure the credentials are OK, refresh the authentication token. If it did
not work report a problem. They might have changed something in the Matrix.

Thank you in advance for your help.

Valerija

Changing the band name

I'm hoping to customize the band names on my images... is there a way to do so with geebam?

GEE Complains with "Unable to open ..." message

Hi Lukasz,

I am trying to upload a new collection to my assets and I am getting this error that I cannot figure out.

When I run the upload command it all works well and I get no error but in the task frame of GEE ui I see that all of the running tasks have failed (in red) with the message:

Error: Unable to open 8c7b9b47f57bec71bd52709834db171ebae0d3c08e1a6482cf8aff88.tif.

I tried uploading the same images directly from the Asset manager in GEE and it works fine. Any ideas?
The TIF are not specially large (around 200 KB)

The same command with the same files used now worked a week ago...any ideas?

geebam upload -u [email protected] -m "C:\temp\properties.csv" --source "C:\temp\data" --dest users/MY_USER/test

Thanks!

Issues with first upload and skipping metadata

If metadata does not exist throws this error earlier version used to skip and now it throws this error and stops processing the rest
Traceback (most recent call last):
File "geebam.py", line 68, in
main()
File "geebam.py", line 65, in main
args.func(args)
File "geebam.py", line 35, in upload_from_parser
nodata_value=args.nodata)
File "/home/samapriya/Downloads/gee/gee_asset_manager/batch_uploader.py", line 76, in upload
failed_asset_writer.writerow([filename, 0, 'Missing metadata'])
File "/home/samapriya/Downloads/gee/gee_asset_manager/batch_uploader.py", line 310, in writerow
failed_upload_writer.writerow(row)
UnboundLocalError: local variable 'failed_upload_writer' referenced before assignment

Async upload

There should be an option for asynchronous upload. User should be able to specify number of threads.

pip install requirement file

Hi,

I'd like to use this tool to manage asset for my GEE account but am running into some issues with the pip install. I get the following error after following your instructions on install:

You must give at least one requirement to install (see "pip help install")

I tried the --allow-all-external and --allow-unverified but it looks like these functions have been deprecated. Do you have any suggestions?

Thanks!

Jon

Installation problem with Python 2.7

I have Python 2.7.10 on a Mac High Sierra 10.13.5 . During installation of geebam, this is the message I get Could not find a version that satisfies the requirement geebam (from versions: )
No matching distribution found for geebam

I tried installing requirements.txt manually, but that didn't help.

Any idea why I have these problems?

Missing bs4 module

C:\Python27\Scripts>geebam -h
Traceback (most recent call last):
File "C:\Python27\Scripts\geebam-script.py", line 9, in
load_entry_point('geebam==0.1.0', 'console_scripts', 'geebam')()
File "C:\Python27\lib\site-packages\pkg_resources__init__.py", line 552, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources__init__.py", line 2672, in load_entry_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources__init__.py", line 2345, in load
return self.resolve()
File "C:\Python27\lib\site-packages\pkg_resources__init__.py", line 2351, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "C:\Python27\lib\site-packages\geebam\geebam.py", line 12, in
import batch_uploader
File "C:\Python27\lib\site-packages\geebam\batch_uploader.py", line 11, in
from bs4 import BeautifulSoup
ImportError: No module named bs4

SyntaxError: invalid syntax

I receive syntax errors when trying upload:

2017-03-22 12:12:28,841 :: root :: WARNING :: Collection users/wle0001/test already exists
2017-03-22 12:12:29,273 :: root :: INFO :: Processing image 1 out of 1: /Users/wellenbu/Documents/HKH/WheatMapping/Downloadscripts/Corrected/Sample/Corrected2.tif
2017-03-22 12:12:30,083 :: root :: ERROR :: Upload of Corrected2 has failed.
Traceback (most recent call last):
File "/Users/wellenbu/Downloads/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 83, in upload
properties, multipart_upload, nodata_value)
File "/Users/wellenbu/anaconda2/lib/python2.7/site-packages/retrying.py", line 92, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File "/Users/wellenbu/anaconda2/lib/python2.7/site-packages/retrying.py", line 247, in call
return attempt.get(self._wrap_exception)
File "/Users/wellenbu/anaconda2/lib/python2.7/site-packages/retrying.py", line 285, in get
reraise(self.value[0], self.value[1], self.value[2])
File "/Users/wellenbu/anaconda2/lib/python2.7/site-packages/retrying.py", line 241, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File "/Users/wellenbu/Downloads/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 133, in __upload_to_gcs_and_start_ingestion_task
nodata=nodata_value)
File "/Users/wellenbu/Downloads/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 207, in __upload_file
upload_url = __get_upload_url(session)
File "/Users/wellenbu/Downloads/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 201, in __get_upload_url
d = ast.literal_eval(r.text)
File "/Users/wellenbu/anaconda2/lib/python2.7/ast.py", line 49, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "/Users/wellenbu/anaconda2/lib/python2.7/ast.py", line 37, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "", line 1

^
SyntaxError: invalid syntax

Any ideas?

Error: incorrect credentials

Hey there,

I am trying to batch upload some tifs with metadata in a virtualenv and have an Incorrect Credentials error. I have tried it with both installed, and from the gee_asset_manger folder. My email and password are correct, and I can initialize. Any thoughts or help is appreciated.

Cheers,
J

2018-10-06 02:42:46,357 :: root :: INFO :: New collection users/TEST/puyo2 created
2018-10-06 02:42:47,816 :: root :: INFO :: Processing image 1 out of 131: /home/bschwert/puyo/tif/20150217_040D_RTC.dat_RsNear_Gamma0_VV.tif
2018-10-06 02:42:48,376 :: root :: ERROR :: Incorrect credentials. Probably. If you are sure the credentials are OK, refresh the authentication token. If it did not work report a p
roblem. They might have changed something in the Matrix.

Incorrect credentials issue when uploading directory directly to GEE Assets

#Thanks very much for this tool. Everything seemed to work well for me except that I couldn’t upload a directory to GEE Assets due to the issue below after I typed the password. I am pretty sure I input the correct password and tried many times but always got the same error. Any suggestions? Thanks!

“2017–11–02 18:08:31,628 :: root :: ERROR :: Incorrect credentials. Probably. If you are sure the credentials are OK, #ref
resh the authentication token. If it did not work report a problem. They might have changed something in the Matrix.”

Cheers

Joey

Upload stalls until user intervenes

Uploads occasionally stall until I intervene (tapping return seems kick it back into action). Usually returns "Refreshing due to a 401" before continuing. Would be good to have an automatic periodic check on upload progress, since recovering from this error seems to be seamless once it's detected.

Password as an additional argument

Is it possible to include password as an additional argument, as at present I need to provide the password manually every time while uploading the data which is not really convenient while updating a asset with new sets of data every week.
Thanks.

Image Band Name

I am using geebam for uploading a large number of images where each of the image has 5 bands.
The GEE took default band names (e.g., b1, b2) but I want to provide different band names instead of those default . I have found that earthengine has a command line option to provide band names separately
but not noticed in the geebam. Is there any way to provide band names using geebam?
Thanks a lot.

Specify Property Type for Metadata

I don't know if many people have realized this or faced this problem
Google Collections now have a property type tag meaning for every property you need to specify a type or it assumes one for you based on the first asset which was uploaded

So for example: If someone has has a metadata which has both numeric as well as string values if the string value is uploaded first then Google will not let you upload a purely numeric string with the same metadata column.

ImageID
1189-122f0-ad123 --alphanumeric uploaded as string
1882-12929-19192-- This is purely numeric and will be uploaded as Float64

so depending on the order of the upload the property type for ImageID is either string or Float64

This can be fixed post ingestion but for now this means it will stop ingestion if an image metadata type does not match with each other so I cannot upload both these images one after the other.

I am including a task id for quick check
property satID (type FLOAT64), whose type does not match the schema (type STRING).
Exampled Task Id: TVK2FLYIW42ICXTAKFWJOEJU

Wonder if there is a way to specify a property during ingestion.

To correct this post ingestion is
earthengine asset set -p '(string)ImageID=1882-12929-19192' users/username/asset_id
However since you cannot upload the images to begin with you cannot correct the property post ingestion.

actions on "projects"

Hi - I was hoping to delete an ImageCollection that is saved in a project.

Here's an example:

ee|master $ geebam delete projects/wri-datalab/FormaTestEG
2016-12-02 14:33:55,773 :: oauth2client.transport :: INFO :: Attempting refresh to obtain initial access_token
2016-12-02 14:33:55,774 :: oauth2client.client :: INFO :: Refreshing access_token
2016-12-02 14:33:58,825 :: root :: WARNING :: users/brookwilliams/projects/wri-datalab/FormaTestEG asset could not be found.

Of course I'm hoping to delete

projects/wri-datalab/FormaTestEG

But its prepending "projects/wri-datalab" with my personal folder "users/username".

It would be great to have the option of putting in the full path

In metadata, every field is treated as a string

id_no,level,area,season,system:time_start
L3_LBN_PHE_s1,3,JL,1,1420113601

resulting in:

raise ee_exception.EEException(json_content['error']['message'])
EEException: Value for property 'system:time_start' must be a number.

understanding Image Upload

Hi Lucas,
Thank you so much for your help via email! I just joined GitHub and thought of sharing my problem here so that others can access your suggestion too after that I have another question I would like to ask you.

My problem was that I was getting an error saying bs4 module not found, to solve it, I just used pip to installed bs4 and it worked. (pip install bs4)

Another problem I ran into was after starting the image upload. For now, I am just trying it with one test image. While the run created an image collection in EE successfully, it was empty and my image didn't get uploaded.

Here is the message I saw on the console:
C:\Python27\Scripts>geebam upload -u [email protected] -d C:\ET_Data\test_upload -m C:\ET_Data\test_upload\test_metadata.csv
2016-10-28 17:08:31,469 :: oauth2client.transport :: INFO :: Attempting refresh to obtain initial access_token
2016-10-28 17:08:31,470 :: oauth2client.client :: INFO :: Refreshing access_token
Password:
2016-10-28 17:08:37,868 :: requests.packages.urllib3.connectionpool :: INFO :: Starting new HTTPS connection (1): accounts.google.com
2016-10-28 17:08:38,657 :: requests.packages.urllib3.connectionpool :: INFO :: Starting new HTTPS connection (1): accounts.google.co.in
2016-10-28 17:08:38,940 :: requests.packages.urllib3.connectionpool :: INFO :: Starting new HTTPS connection (1): myaccount.google.com
2016-10-28 17:08:41,674 :: root :: INFO :: New collection users/radb06/test_upload created
2016-10-28 17:08:41,677 :: root :: INFO :: Processing image 1 out of 1: C:\ET_Data\test_upload\ETensemble250m-h27v6-mm-Monthly-2003_01.tif
2016-10-28 17:08:42,306 :: requests.packages.urllib3.connectionpool :: INFO :: Starting new HTTPS connection (1): ee-api.appspot.com
2016-10-28 17:08:42,528 :: requests.packages.urllib3.connectionpool :: INFO :: Starting new HTTPS connection (1): www.google.com
2016-10-28 17:08:42,835 :: requests.packages.urllib3.connectionpool :: INFO :: Starting new HTTPS connection (1): appengine.google.com

Do you know what am I missing here?
Thank you is much for your help throughout,
Really appreciate it!

Deleting collection in shared folder

Hey Lucas,
I was wondering if we could use the geebam tool to delete collection from a shared folder, just like we could upload using the -p switch. Currently it doesn't seem to work, perhaps, it would be a good idea to add that functionality for delete tool as well.

Thanks.

SSL certificate verify failed

When using geebam upload and provide the password for my google account, an SLL error is displayed.

Traceback (most recent call last):
  File "/home/jhelcq/fao_fra/entorno_virtual_faofra/bin/geebam", line 11, in <module>
    load_entry_point('geebam', 'console_scripts', 'geebam')()
  File "/home/jhelcq/fao_fra/gee_asset_manager/geebam.py", line 65, in main
    args.func(args)
  File "/home/jhelcq/fao_fra/gee_asset_manager/geebam.py", line 35, in upload_from_parser
    nodata_value=args.nodata)
  File "/home/jhelcq/fao_fra/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 55, in upload
    google_session = __get_google_auth_session(user, password)
  File "/home/jhelcq/fao_fra/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 174, in __get_google_auth_session
    login_html = session.get(google_accounts_url)
  File "/home/jhelcq/fao_fra/entorno_virtual_faofra/local/lib/python2.7/site-packages/requests/sessions.py", line 526, in get
    return self.request('GET', url, **kwargs)
  File "/home/jhelcq/fao_fra/entorno_virtual_faofra/local/lib/python2.7/site-packages/requests/sessions.py", line 513, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/jhelcq/fao_fra/entorno_virtual_faofra/local/lib/python2.7/site-packages/requests/sessions.py", line 623, in send
    r = adapter.send(request, **kwargs)
  File "/home/jhelcq/fao_fra/entorno_virtual_faofra/local/lib/python2.7/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: ("bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)",)

If I execute this code:

import requests
session = requests.session()
login_html = session.get('https://accounts.google.com')

The same error is shown, but if the url is https://www.agetic.gob.bo or http://slack.com the SSL error is not displayed

Uploading of files is failed.

Hi,

I encountered some issues when I uploaded images. Could anyone help me? Below is the Error.

2018-08-24 21:17:55,509 :: root :: INFO :: Processing image 12 out of 31: F:\Kapiti\PlanetScope\output\clip_extend_2017_Mar_Jun\20170420.tif
2018-08-24 21:18:24,741 :: root :: ERROR :: Upload of 20170420 has failed.
Traceback (most recent call last):
File "c:\users\cheng\gee_asset_manager\gee_asset_manager\batch_uploader.py", line 109, in upload
use_multipart=multipart_upload)
File "c:\users\cheng\anaconda3\lib\site-packages\retrying.py", line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File "c:\users\cheng\anaconda3\lib\site-packages\retrying.py", line 206, in call
return attempt.get(self._wrap_exception)
File "c:\users\cheng\anaconda3\lib\site-packages\retrying.py", line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
File "c:\users\cheng\anaconda3\lib\site-packages\six.py", line 693, in reraise
raise value
File "c:\users\cheng\anaconda3\lib\site-packages\retrying.py", line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File "c:\users\cheng\gee_asset_manager\gee_asset_manager\batch_uploader.py", line 261, in _upload_file_gee
gsid = resp.json()[0]
File "c:\users\cheng\anaconda3\lib\site-packages\requests\models.py", line 892, in json
return complexjson.loads(self.text, **kwargs)
File "c:\users\cheng\anaconda3\lib\json_init
.py", line 354, in loads
return _default_decoder.decode(s)
File "c:\users\cheng\anaconda3\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "c:\users\cheng\anaconda3\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Delete not finding the directory to remove

The delete functionality does not seem to work (after having uploading too many collections i am testing to remove some of them)

when I run the command (the collection has this name! ):
geebam delete users/openforisinitiative/ECMWF_evpt_final

It returns this message :

2018-01-08 22:46:52,888 :: oauth2client.transport :: INFO :: Attempting refresh to obtain initial access_token
2018-01-08 22:46:52,888 :: oauth2client.client :: INFO :: Refreshing access_token
Traceback (most recent call last):
  File "C:\opt\apps\Python27\Scripts\geebam-script.py", line 11, in <module>
    load_entry_point('geebam', 'console_scripts', 'geebam')()
  File "c:\users\faoadmin\git\gee_asset_manager\geebam.py", line 118, in main
    args.func(args)
  File "c:\users\faoadmin\git\gee_asset_manager\geebam.py", line 45, in delete_collection_from_parser
    delete(args.id)
  File "c:\users\faoadmin\git\gee_asset_manager\gee_asset_manager\batch_remover.py", line 29, in delete
    all_assets_names = [e['id'] for e in ee.data.getList({'id': root})]
  File "c:\opt\apps\python27\lib\site-packages\ee\data.py", line 172, in getList
    return send_('/list', params)
  File "c:\opt\apps\python27\lib\site-packages\ee\data.py", line 728, in send_
  raise ee_exception.EEException(json_content['error']['message'])
ee.ee_exception.EEException: No such folder or collection: 'users/openforisinitiative'

'projects/project-earth/landcover' not found

The dataset is not available any more through Google Earth Engine code editor. I noticed this error on 23 September 2019, but could it have occurred during the previous week.
Also have a question, the dataset wasn't availbale in all the countries. Is it possible to generate the images using an existent model and it is it possible to do it from localhost or this project should be deployed to the cloud. Many thanks!

GALX cookie

I have used geebam for quite a few months now and suddenly in every machine where ti is installed I get an error related with the line:
galx = login_html.cookies['GALX']

It seems that google authentication is not returning that cookie anymore.

Features batch upload

Hi,
Is it possible to do batch upload of shape files with this tool? I really need it but it looks to me that this tool is only for batch uploading images.

Regards
Shahriar

Always require absolute path

Ability to use relative and absolute path is confusing for users and clutters code. For the price of breaking backwards compatibility and a little bit more typing, I will make absolute paths (e.g. users/user/asset) the only possibility.

Blocksize and Upload error

Traceback (most recent call last):
File "/home/samapriya/Downloads/gee/gee_asset_manager/batch_uploader.py", line 83, in upload
properties, multipart_upload, nodata_value)
File "/home/samapriya/.local/lib/python2.7/site-packages/retrying.py", line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File "/home/samapriya/.local/lib/python2.7/site-packages/retrying.py", line 206, in call
return attempt.get(self._wrap_exception)
File "/home/samapriya/.local/lib/python2.7/site-packages/retrying.py", line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
File "/home/samapriya/.local/lib/python2.7/site-packages/retrying.py", line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File "/home/samapriya/Downloads/gee/gee_asset_manager/batch_uploader.py", line 133, in __upload_to_gcs_and_start_ingestion_task
nodata=nodata_value)
File "/home/samapriya/Downloads/gee/gee_asset_manager/batch_uploader.py", line 222, in __upload_file
resp = session.post(upload_url, files=files)
File "/home/samapriya/.local/lib/python2.7/site-packages/requests/sessions.py", line 522, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/samapriya/.local/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/home/samapriya/.local/lib/python2.7/site-packages/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "/home/samapriya/.local/lib/python2.7/site-packages/requests/adapters.py", line 423, in send
timeout=timeout
File "/home/samapriya/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 595, in urlopen
chunked=chunked)
File "/home/samapriya/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 363, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python2.7/httplib.py", line 1057, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1097, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 897, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 873, in send
self.sock.sendall(data)
File "/home/samapriya/.local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 253, in sendall
sent = self._send_until_done(data[total_sent:total_sent + SSL_WRITE_BLOCKSIZE])
File "/home/samapriya/.local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 242, in _send_until_done
return self.connection.send(data)
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 1256, in send
self._raise_ssl_error(self._ssl, result)
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 1166, in _raise_ssl_error
raise SysCallError(errno, errorcode.get(errno))
SysCallError: (104, 'ECONNRESET')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.