terrakio-core 0.4.98.1b6__tar.gz → 0.4.98.1b7__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.
Files changed (63) hide show
  1. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/PKG-INFO +1 -1
  2. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/pyproject.toml +1 -1
  3. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/endpoints/mass_stats.py +129 -1
  4. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/README.md +0 -0
  5. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/__init__.py +0 -0
  6. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/async_client.py +0 -0
  7. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/client.py +0 -0
  8. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/config.py +0 -0
  9. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/convenience_functions/convenience_functions.py +0 -0
  10. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/auth.py +0 -0
  11. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/dataset_management.py +0 -0
  12. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/group_management.py +0 -0
  13. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/mass_stats.py +0 -0
  14. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/model_management.py +0 -0
  15. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/space_management.py +0 -0
  16. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/endpoints/user_management.py +0 -0
  17. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/exceptions.py +0 -0
  18. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/helper/bounded_taskgroup.py +0 -0
  19. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/helper/decorators.py +0 -0
  20. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/helper/tiles.py +0 -0
  21. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/__editable__.terrakio_core-0.3.9-py3-none-any/terrakio_core/sync_client.py +0 -0
  22. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/__init__.py +0 -0
  23. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/accessors.py +0 -0
  24. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/async_client.py +0 -0
  25. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/client.py +0 -0
  26. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/config.py +0 -0
  27. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/convenience_functions/convenience_functions.py +0 -0
  28. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/endpoints/auth.py +0 -0
  29. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/endpoints/dataset_management.py +0 -0
  30. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/endpoints/group_management.py +0 -0
  31. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/endpoints/mass_stats.py +0 -0
  32. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/endpoints/model_management.py +0 -0
  33. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/endpoints/space_management.py +0 -0
  34. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/endpoints/user_management.py +0 -0
  35. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/exceptions.py +0 -0
  36. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/helper/bounded_taskgroup.py +0 -0
  37. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/helper/decorators.py +0 -0
  38. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/helper/tiles.py +0 -0
  39. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/build/lib/terrakio_core/sync_client.py +0 -0
  40. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/__init__.py +0 -0
  41. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/accessors.py +0 -0
  42. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/async_client.py +0 -0
  43. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/client.py +0 -0
  44. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/config.py +0 -0
  45. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/convenience_functions/create_dataset_file.py +0 -0
  46. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/convenience_functions/geoquries.py +0 -0
  47. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/convenience_functions/zonal_stats.py +0 -0
  48. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/endpoints/auth.py +0 -0
  49. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/endpoints/dataset_management.py +0 -0
  50. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/endpoints/group_management.py +0 -0
  51. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/endpoints/model_management.py +0 -0
  52. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/endpoints/space_management.py +0 -0
  53. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/endpoints/user_management.py +0 -0
  54. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/exceptions.py +0 -0
  55. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/helper/bounded_taskgroup.py +0 -0
  56. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/helper/decorators.py +0 -0
  57. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/helper/tiles.py +0 -0
  58. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core/sync_client.py +0 -0
  59. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core.egg-info/PKG-INFO +0 -0
  60. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core.egg-info/SOURCES.txt +0 -0
  61. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core.egg-info/dependency_links.txt +0 -0
  62. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core.egg-info/requires.txt +0 -0
  63. {terrakio_core-0.4.98.1b6 → terrakio_core-0.4.98.1b7}/terrakio_core.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: terrakio-core
3
- Version: 0.4.98.1b6
3
+ Version: 0.4.98.1b7
4
4
  Summary: Core package for the terrakio-python-api
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: aiofiles>=24.1.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "terrakio-core"
3
- version = "0.4.98.1b6"
3
+ version = "0.4.98.1b7"
4
4
  description = "Core package for the terrakio-python-api"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -985,4 +985,132 @@ 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: str,
995
+ output: str,
996
+ folder: str,
997
+ consumer: str,
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 containing request configurations
1009
+ output: Output type (str)
1010
+ folder: Folder to store output
1011
+ consumer: Path to post processing script
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
+ await self._upload_file(requests_file, url)
1029
+
1030
+ with open(consumer, 'rb') as f:
1031
+ form = aiohttp.FormData()
1032
+ form.add_field('output', output)
1033
+ form.add_field('force_loc', str(force_loc).lower())
1034
+ form.add_field('skip_existing', str(skip_existing).lower())
1035
+
1036
+ if server is not None:
1037
+ form.add_field('server', server)
1038
+
1039
+ form.add_field('extra', json.dumps(extra or {}))
1040
+ form.add_field('folder', folder)
1041
+ form.add_field(
1042
+ 'consumer',
1043
+ f.read(),
1044
+ filename='consumer.py',
1045
+ content_type='text/x-python'
1046
+ )
1047
+
1048
+ response, status = await self._client._terrakio_request(
1049
+ "POST",
1050
+ f"collections/{collection}/gen_and_process",
1051
+ data=form
1052
+ )
1053
+
1054
+ if status != 200:
1055
+ if status == 404:
1056
+ raise CollectionNotFoundError(f"Collection {collection} not found", status_code=status)
1057
+ raise GetTaskError(f"Gen and process failed with status {status}", status_code=status)
1058
+
1059
+ return response
1060
+
1061
+ @require_api_key
1062
+ async def create_pyramids(
1063
+ self,
1064
+ name: str,
1065
+ levels: int,
1066
+ config: Dict[str, Any]
1067
+ ) -> Dict[str, Any]:
1068
+ """
1069
+ Create pyramid tiles for a dataset.
1070
+
1071
+ Args:
1072
+ name: Dataset name
1073
+ levels: Maximum zoom level for pyramid (e.g., 8)
1074
+ config: Full pyramid configuration dictionary containing:
1075
+ - name: Dataset name (will override the name parameter)
1076
+ - bucket: GCS bucket name (e.g., "terrakio")
1077
+ - products: List of product names (e.g., ["air_temp", "prec"])
1078
+ - path: Path pattern (e.g., "pyramids/%s_%s_%03d_%03d_%02d.snp")
1079
+ - data_type: Data type (e.g., "float32")
1080
+ - i_max: Maximum i index
1081
+ - j_max: Maximum j index
1082
+ - x_size: Tile size in x (e.g., 400)
1083
+ - y_size: Tile size in y (e.g., 400)
1084
+ - dates_iso8601: List of ISO8601 date strings
1085
+ - no_data: No data value (e.g., -9999.0)
1086
+
1087
+ Returns:
1088
+ API response with task_id
1089
+
1090
+ Raises:
1091
+ GetTaskError: If the API request fails
1092
+ """
1093
+ await self.create_collection(collection = name)
1094
+
1095
+ pyramid_request = {
1096
+ 'name': name,
1097
+ 'max_zoom': levels,
1098
+ **config
1099
+ }
1100
+
1101
+ response, status = await self._client._terrakio_request(
1102
+ "POST",
1103
+ "tasks/pyramids",
1104
+ json=pyramid_request
1105
+ )
1106
+
1107
+ if status != 200:
1108
+ raise GetTaskError(
1109
+ f"Pyramid creation failed with status {status}: {response}",
1110
+ status_code=status
1111
+ )
1112
+
1113
+ task_id = response["task_id"]
1114
+ await self.track_progress(task_id)
1115
+
1116
+ return {"task_id": task_id}