Skip to content

Commit

Permalink
updated v0.6.2
Browse files Browse the repository at this point in the history
- Removed call to shell
- Now prints status of task at task creation
- Overwrite option for both images and tables
  • Loading branch information
samapriya committed Feb 4, 2023
1 parent 1d519c1 commit ac0e6f0
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 37 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ optional arguments:

# Changelog

### 0.6.2
- Removed call to shell
- Now prints status of task at task creation
- Overwrite option for both images and tables

### 0.6.1
- Removed dependency on pipwin uses pipgeo instead
- Removed dependency on beautifulsoup
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

### 0.6.2
- Removed call to shell
- Now prints status of task at task creation
- Overwrite option for both images and tables

### 0.6.1
- Removed dependency on pipwin uses pipgeo instead
- Removed dependency on beautifulsoup
Expand Down
2 changes: 1 addition & 1 deletion geeup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = "Samapriya Roy"
__email__ = "[email protected]"
__version__ = "0.6.1"
__version__ = "0.6.2"
17 changes: 6 additions & 11 deletions geeup/batch_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,21 +240,16 @@ def upload(
if v.validate(asset_validate, schema) is False:
print(v.errors)
raise Exception
with open(os.path.join(lp, "data.json"), "w") as outfile:
json.dump(main_payload, outfile)
request_id = ee.data.newTaskId()[0]
check_list = ['yes', 'y']
if overwrite is not None and overwrite.lower() in check_list:
output = subprocess.check_output(
f"earthengine upload image --manifest {os.path.join(lp, 'data.json')} -f",
shell=True
)
output = ee.data.startIngestion(
request_id, main_payload, allow_overwrite=True)
else:
output = subprocess.check_output(
f"earthengine upload image --manifest {os.path.join(lp, 'data.json')}",
shell=True
)
output = ee.data.startIngestion(
request_id, main_payload, allow_overwrite=False)
logging.info(
f"Ingesting {current_image_no+1} of {file_count} {str(os.path.basename(asset_full_path))} with Task Id: {output.decode('ascii').strip().split(' ')[-1]}"
f"Ingesting {current_image_no+1} of {file_count} {str(os.path.basename(asset_full_path))} with Task Id: {output['id']} & status {output['started']}"
)
except Exception as error:
print(error)
Expand Down
39 changes: 15 additions & 24 deletions geeup/tuploader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__copyright__ = """
Copyright 2022 Samapriya Roy
Copyright 2023 Samapriya Roy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -269,22 +269,15 @@ def tabup(dirc, uname, destination, x, y, overwrite=None):
if v.validate(asset_validate, schema) is False:
print(v.errors)
raise Exception
with open(
os.path.join(lp, "data.json"), "w"
) as outfile:
json.dump(main_payload, outfile)
request_id = ee.data.newTaskId()[0]
if overwrite is not None and overwrite.lower() in check_list:
output = subprocess.check_output(
f"earthengine upload table --manifest {os.path.join(lp, 'data.json')} -f",
shell=True
)
output = ee.data.startTableIngestion(
request_id, main_payload, allow_overwrite=True)
else:
output = subprocess.check_output(
f"earthengine upload table --manifest {os.path.join(lp, 'data.json')}",
shell=True
)
output = ee.data.startTableIngestion(
request_id, main_payload, allow_overwrite=False)
logging.info(
f"Ingesting {i+1} of {file_count} {str(os.path.basename(asset_full_path))} with Task Id: {output.decode('ascii').strip().split(' ')[-1]}"
f"Ingesting {i+1} of {file_count} {str(os.path.basename(asset_full_path))} with Task Id: {output['id']} & status {output['started']}"
)
elif base_ext == ".csv":
m = MultipartEncoder(
Expand Down Expand Up @@ -337,17 +330,15 @@ def tabup(dirc, uname, destination, x, y, overwrite=None):
if v.validate(asset_validate, schema) is False:
print(v.errors)
raise Exception
with open(
os.path.join(lp, "data.json"), "w"
) as outfile:
json.dump(main_payload, outfile)
manifest_file = os.path.join(lp, "data.json")
output = subprocess.check_output(
f"earthengine upload table --manifest {manifest_file}",
shell=True,
)
request_id = ee.data.newTaskId()[0]
if overwrite is not None and overwrite.lower() in check_list:
output = ee.data.startTableIngestion(
request_id, main_payload, allow_overwrite=True)
else:
output = ee.data.startTableIngestion(
request_id, main_payload, allow_overwrite=False)
logging.info(
f"Ingesting {i+1} of {file_count} {str(os.path.basename(asset_full_path))} with Task Id: {output.decode('ascii').strip().split(' ')[-1]}"
f"Ingesting {i+1} of {file_count} {str(os.path.basename(asset_full_path))} with Task Id: {output['id']} & status {output['started']}"
)
except Exception as error:
print(error)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def readme():

setuptools.setup(
name="geeup",
version="0.6.1",
version="0.6.2",
packages=find_packages(),
url="https://github.com/samapriya/geeup",
install_requires=[
Expand Down

0 comments on commit ac0e6f0

Please sign in to comment.