environmentaltools.common.ascii_tiff
- environmentaltools.common.ascii_tiff(file_name: str, output_format: str = 'row')[source]
Read ASCII or GeoTIFF raster files and extract coordinate data.
Reads georeferenced raster files using rasterio and extracts coordinates and values in either tabular (row) or grid format.
- Parameters:
file_name (str) – Path to the ASCII or TIFF raster file.
output_format (str) – Output format type. Options are: - “row”: Returns flattened DataFrame with x, y, z columns (default) - “grid”: Returns dictionary with 2D arrays for x, y, z
- Returns:
- A tuple containing:
data (pd.DataFrame or dict): Coordinate and value data in specified format.
profile (dict): Rasterio profile containing metadata (CRS, transform, etc.).
- Return type:
tuple