terrakit 0.2.1__tar.gz → 0.2.2__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 (55) hide show
  1. {terrakit-0.2.1 → terrakit-0.2.2}/PKG-INFO +1 -1
  2. {terrakit-0.2.1 → terrakit-0.2.2}/pyproject.toml +1 -1
  3. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/geodata_utils.py +21 -17
  4. {terrakit-0.2.1 → terrakit-0.2.2}/README.md +0 -0
  5. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/__init__.py +0 -0
  6. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/__main__.py +0 -0
  7. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/_version.py +0 -0
  8. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/chip/__init__.py +0 -0
  9. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/chip/tiling.py +0 -0
  10. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/__init__.py +0 -0
  11. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/collections.json +0 -0
  12. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/connector.py +0 -0
  13. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/__init__.py +0 -0
  14. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/cds_utils/cordex_domains.json +0 -0
  15. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/cds_utils/cordex_utils.py +0 -0
  16. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/cds_utils/derived-era5-single-levels-daily-statistics_constraints.json +0 -0
  17. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/cds_utils/projections-cordex-domains-single-levels_constraints.json +0 -0
  18. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/cds_utils/projections-cordex-domains-single-levels_constraints_variables.json +0 -0
  19. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/climate_data_store.py +0 -0
  20. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/connector_template.py +0 -0
  21. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/ibmresearch_stac.py +0 -0
  22. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/local_file_system.py +0 -0
  23. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/nasa_earthdata.py +0 -0
  24. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/sentinel_aws.py +0 -0
  25. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/sentinelhub.py +0 -0
  26. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/data_connectors/theweathercompany.py +0 -0
  27. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/download_data.py +0 -0
  28. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/raster_file_reader.py +0 -0
  29. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/transformations/__init__.py +0 -0
  30. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/transformations/download_transformation_template.py +0 -0
  31. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/transformations/impute_nans_xarray.py +0 -0
  32. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/download/transformations/scale_data_xarray.py +0 -0
  33. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/general_utils/__init__.py +0 -0
  34. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/general_utils/curation_metadata.py +0 -0
  35. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/general_utils/defaults.py +0 -0
  36. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/general_utils/exceptions.py +0 -0
  37. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/general_utils/geospatial_util.py +0 -0
  38. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/general_utils/labels_downloader.py +0 -0
  39. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/general_utils/plotting.py +0 -0
  40. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/general_utils/rest.py +0 -0
  41. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/general_utils/statistics.py +0 -0
  42. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/store/__init__.py +0 -0
  43. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/store/taco.py +0 -0
  44. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/terrakit.py +0 -0
  45. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/transform/__init__.py +0 -0
  46. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/transform/labels.py +0 -0
  47. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/upload/__init__.py +0 -0
  48. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/validate/__init__.py +0 -0
  49. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/validate/data_connector.py +0 -0
  50. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/validate/download_model.py +0 -0
  51. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/validate/helpers.py +0 -0
  52. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/validate/labels_model.py +0 -0
  53. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/validate/pipeline_model.py +0 -0
  54. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/validate/store_model.py +0 -0
  55. {terrakit-0.2.1 → terrakit-0.2.2}/terrakit/validate/tiling_model.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: terrakit
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A Python package for finding and getting geospatial data.
5
5
  Author: Blair Edwards, Rosie Lickorish, Leonardo Pondian Tizzei, Fred Ochieng Otieno, Beldine Moturi, Catherine Wanjiru, Benedikt Blumenstiel, Brian Ogolla, Romeo Kienzler
6
6
  Author-email: Blair Edwards <bedwards@uk.ibm.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "TerraKit"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "A Python package for finding and getting geospatial data."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -307,26 +307,30 @@ def verify_input_image(image, standard_dimensions=224) -> typing.Tuple[int, str]
307
307
  Return:
308
308
  tuple[int, str]: [verification_status_code, verification_msg]
309
309
  """
310
- res = os.popen(f"gdalinfo {image} -json").read()
311
- res_json = json.loads(res)
312
- dims = res_json["size"]
310
+ try:
311
+ with rasterio.open(image) as src:
312
+ dims = (src.height, src.width)
313
313
 
314
- # Check if image is geotiff
315
- if res_json["driverShortName"] != "GTiff":
316
- return 1007, f"Input {image} is not a GeoTiff."
314
+ # Check if image is geotiff
315
+ if src.driver != "GTiff":
316
+ return 1007, f"Input {image} is not a GeoTiff."
317
317
 
318
- # Check image dimensions
319
- image_input_dimensions = np.min(dims)
318
+ # Check image dimensions
319
+ image_input_dimensions = np.min(dims)
320
320
 
321
- if image_input_dimensions < standard_dimensions:
322
- return (
323
- 1002,
324
- f"Input image too small for image {image} with dimensions {image_input_dimensions}. Both dimensions must be >= 224.",
325
- )
326
- else:
327
- # Log/Show dimensions of the input image
328
- logger.debug(f"Input image {image} has dimensions {image_input_dimensions}")
329
- return 200, str(image_input_dimensions)
321
+ if image_input_dimensions < standard_dimensions:
322
+ return (
323
+ 1002,
324
+ f"Input image too small for image {image} with dimensions {image_input_dimensions}. Both dimensions must be >= 224.",
325
+ )
326
+ else:
327
+ # Log/Show dimensions of the input image
328
+ logger.debug(
329
+ f"Input image {image} has dimensions {image_input_dimensions}"
330
+ )
331
+ return 200, str(image_input_dimensions)
332
+ except rasterio.errors.RasterioIOError as e:
333
+ return 1001, f"Failed to open image {image}: {e}"
330
334
 
331
335
 
332
336
  def check_projection(file: Union[str, Path]) -> None:
File without changes
File without changes
File without changes
File without changes
File without changes