terrakio-core 0.4.98.1b6__tar.gz → 0.4.98.1b8__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 terrakio-core might be problematic. Click here for more details.
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/PKG-INFO +1 -1
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/pyproject.toml +1 -1
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/mass_stats.py +144 -2
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/README.md +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/__init__.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/async_client.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/client.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/config.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/convenience_functions/convenience_functions.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/auth.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/dataset_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/group_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/mass_stats.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/model_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/space_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/user_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/exceptions.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/helper/bounded_taskgroup.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/helper/decorators.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/helper/tiles.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/sync_client.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/__init__.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/accessors.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/async_client.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/client.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/config.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/convenience_functions/convenience_functions.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/endpoints/auth.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/endpoints/dataset_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/endpoints/group_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/endpoints/mass_stats.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/endpoints/model_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/endpoints/space_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/endpoints/user_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/exceptions.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/helper/bounded_taskgroup.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/helper/decorators.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/helper/tiles.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/sync_client.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/__init__.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/accessors.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/async_client.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/client.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/config.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/convenience_functions/create_dataset_file.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/convenience_functions/geoquries.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/convenience_functions/zonal_stats.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/auth.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/dataset_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/group_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/model_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/space_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/user_management.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/exceptions.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/helper/bounded_taskgroup.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/helper/decorators.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/helper/tiles.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/sync_client.py +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core.egg-info/PKG-INFO +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core.egg-info/SOURCES.txt +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core.egg-info/dependency_links.txt +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core.egg-info/requires.txt +0 -0
- {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core.egg-info/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
3
|
import time
|
|
4
|
-
from typing import Dict, Any, Optional, List
|
|
4
|
+
from typing import Dict, Any, Optional, List, Union
|
|
5
5
|
|
|
6
6
|
import aiohttp
|
|
7
7
|
import typer
|
|
@@ -985,4 +985,146 @@ class MassStats:
|
|
|
985
985
|
'collection': collection,
|
|
986
986
|
'downloaded_files': downloaded_files,
|
|
987
987
|
'total': len(downloaded_files)
|
|
988
|
-
}
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
@require_api_key
|
|
991
|
+
async def gen_and_process(
|
|
992
|
+
self,
|
|
993
|
+
collection: str,
|
|
994
|
+
requests_file: Union[str, Any],
|
|
995
|
+
output: str,
|
|
996
|
+
folder: str,
|
|
997
|
+
consumer: Union[str, Any],
|
|
998
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
999
|
+
force_loc: Optional[bool] = False,
|
|
1000
|
+
skip_existing: Optional[bool] = True,
|
|
1001
|
+
server: Optional[str] = None
|
|
1002
|
+
) -> Dict[str, Any]:
|
|
1003
|
+
"""
|
|
1004
|
+
Generate data and run post-processing in a single task.
|
|
1005
|
+
|
|
1006
|
+
Args:
|
|
1007
|
+
collection: Name of collection
|
|
1008
|
+
requests_file: Path to JSON file or file object containing request configurations
|
|
1009
|
+
output: Output type (str)
|
|
1010
|
+
folder: Folder to store output
|
|
1011
|
+
consumer: Path to post processing script or file object
|
|
1012
|
+
extra: Additional configuration parameters (optional)
|
|
1013
|
+
force_loc: Write data directly to the cloud under this folder (optional, defaults to False)
|
|
1014
|
+
skip_existing: Skip existing data (optional, defaults to True)
|
|
1015
|
+
server: Server to use (optional)
|
|
1016
|
+
|
|
1017
|
+
Returns:
|
|
1018
|
+
API response as a dictionary containing task information
|
|
1019
|
+
|
|
1020
|
+
Raises:
|
|
1021
|
+
CollectionNotFoundError: If the collection is not found
|
|
1022
|
+
GetTaskError: If the API request fails due to unknown reasons
|
|
1023
|
+
"""
|
|
1024
|
+
await self.create_collection(collection=collection)
|
|
1025
|
+
|
|
1026
|
+
upload_urls = await self._upload_requests(collection=collection)
|
|
1027
|
+
url = upload_urls['url']
|
|
1028
|
+
|
|
1029
|
+
# Handle requests_file - either file path (str) or file object
|
|
1030
|
+
if isinstance(requests_file, str):
|
|
1031
|
+
await self._upload_file(requests_file, url)
|
|
1032
|
+
else:
|
|
1033
|
+
# File object - read JSON and upload directly
|
|
1034
|
+
json_data = json.load(requests_file)
|
|
1035
|
+
await self._upload_json_data(json_data, url)
|
|
1036
|
+
|
|
1037
|
+
# Handle consumer - either file path (str) or file object
|
|
1038
|
+
if isinstance(consumer, str):
|
|
1039
|
+
with open(consumer, 'rb') as f:
|
|
1040
|
+
consumer_content = f.read()
|
|
1041
|
+
else:
|
|
1042
|
+
# Assume it's a file object
|
|
1043
|
+
consumer_content = consumer.read()
|
|
1044
|
+
|
|
1045
|
+
form = aiohttp.FormData()
|
|
1046
|
+
form.add_field('output', output)
|
|
1047
|
+
form.add_field('force_loc', str(force_loc).lower())
|
|
1048
|
+
form.add_field('skip_existing', str(skip_existing).lower())
|
|
1049
|
+
|
|
1050
|
+
if server is not None:
|
|
1051
|
+
form.add_field('server', server)
|
|
1052
|
+
|
|
1053
|
+
form.add_field('extra', json.dumps(extra or {}))
|
|
1054
|
+
form.add_field('folder', folder)
|
|
1055
|
+
form.add_field(
|
|
1056
|
+
'consumer',
|
|
1057
|
+
consumer_content,
|
|
1058
|
+
filename='consumer.py',
|
|
1059
|
+
content_type='text/x-python'
|
|
1060
|
+
)
|
|
1061
|
+
|
|
1062
|
+
response, status = await self._client._terrakio_request(
|
|
1063
|
+
"POST",
|
|
1064
|
+
f"collections/{collection}/gen_and_process",
|
|
1065
|
+
data=form
|
|
1066
|
+
)
|
|
1067
|
+
|
|
1068
|
+
if status != 200:
|
|
1069
|
+
if status == 404:
|
|
1070
|
+
raise CollectionNotFoundError(f"Collection {collection} not found", status_code=status)
|
|
1071
|
+
raise GetTaskError(f"Gen and process failed with status {status}", status_code=status)
|
|
1072
|
+
|
|
1073
|
+
return response
|
|
1074
|
+
|
|
1075
|
+
@require_api_key
|
|
1076
|
+
async def create_pyramids(
|
|
1077
|
+
self,
|
|
1078
|
+
name: str,
|
|
1079
|
+
levels: int,
|
|
1080
|
+
config: Dict[str, Any]
|
|
1081
|
+
) -> Dict[str, Any]:
|
|
1082
|
+
"""
|
|
1083
|
+
Create pyramid tiles for a dataset.
|
|
1084
|
+
|
|
1085
|
+
Args:
|
|
1086
|
+
name: Dataset name
|
|
1087
|
+
levels: Maximum zoom level for pyramid (e.g., 8)
|
|
1088
|
+
config: Full pyramid configuration dictionary containing:
|
|
1089
|
+
- name: Dataset name (will override the name parameter)
|
|
1090
|
+
- bucket: GCS bucket name (e.g., "terrakio")
|
|
1091
|
+
- products: List of product names (e.g., ["air_temp", "prec"])
|
|
1092
|
+
- path: Path pattern (e.g., "pyramids/%s_%s_%03d_%03d_%02d.snp")
|
|
1093
|
+
- data_type: Data type (e.g., "float32")
|
|
1094
|
+
- i_max: Maximum i index
|
|
1095
|
+
- j_max: Maximum j index
|
|
1096
|
+
- x_size: Tile size in x (e.g., 400)
|
|
1097
|
+
- y_size: Tile size in y (e.g., 400)
|
|
1098
|
+
- dates_iso8601: List of ISO8601 date strings
|
|
1099
|
+
- no_data: No data value (e.g., -9999.0)
|
|
1100
|
+
|
|
1101
|
+
Returns:
|
|
1102
|
+
API response with task_id
|
|
1103
|
+
|
|
1104
|
+
Raises:
|
|
1105
|
+
GetTaskError: If the API request fails
|
|
1106
|
+
"""
|
|
1107
|
+
await self.create_collection(collection = name)
|
|
1108
|
+
|
|
1109
|
+
pyramid_request = {
|
|
1110
|
+
'name': name,
|
|
1111
|
+
'max_zoom': levels,
|
|
1112
|
+
**config
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
response, status = await self._client._terrakio_request(
|
|
1116
|
+
"POST",
|
|
1117
|
+
"tasks/pyramids",
|
|
1118
|
+
json=pyramid_request
|
|
1119
|
+
)
|
|
1120
|
+
|
|
1121
|
+
if status != 200:
|
|
1122
|
+
raise GetTaskError(
|
|
1123
|
+
f"Pyramid creation failed with status {status}: {response}",
|
|
1124
|
+
status_code=status
|
|
1125
|
+
)
|
|
1126
|
+
|
|
1127
|
+
task_id = response["task_id"]
|
|
1128
|
+
await self.track_progress(task_id)
|
|
1129
|
+
|
|
1130
|
+
return {"task_id": task_id}
|
|
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
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/async_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/endpoints/auth.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
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/helper/decorators.py
RENAMED
|
File without changes
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/helper/tiles.py
RENAMED
|
File without changes
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/build/lib/terrakio_core/sync_client.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
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/dataset_management.py
RENAMED
|
File without changes
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/group_management.py
RENAMED
|
File without changes
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/model_management.py
RENAMED
|
File without changes
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/space_management.py
RENAMED
|
File without changes
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/endpoints/user_management.py
RENAMED
|
File without changes
|
|
File without changes
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core/helper/bounded_taskgroup.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b8}/terrakio_core.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|