Skip to content

Commit

Permalink
Run data types through from_gdal_data_type to match pixetl output
Browse files Browse the repository at this point in the history
  • Loading branch information
dmannarino committed Dec 17, 2024
1 parent b70d59d commit ab99a97
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions batch/python/gdal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,10 @@ def run_gdal_subcommand(cmd: List[str], env: Optional[Dict] = None) -> Tuple[str
raise GDALError(e)

return o, e


def from_gdal_data_type(data_type: str) -> str:
if data_type == "Byte":
return "uint8"
else:
return data_type.lower()
8 changes: 6 additions & 2 deletions batch/python/tiles_geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from shapely.ops import unary_union

from errors import GDALError
from gdal_utils import run_gdal_subcommand
from gdal_utils import from_gdal_data_type, run_gdal_subcommand


def to_4326(crs: CRS, x: float, y: float) -> Tuple[float, float]:
Expand All @@ -26,7 +26,11 @@ def extract_metadata_from_gdalinfo(gdalinfo_json: Dict[str, Any]) -> Dict[str, A

bands = [
{
"data_type": band.get("type", None),
"data_type": (
from_gdal_data_type(band.get("type"))
if band.get("type") is not None
else None
),
"no_data": (
"nan" if (
band.get("noDataValue", None) is not None
Expand Down

0 comments on commit ab99a97

Please sign in to comment.