Skip to content

Including needed geotransform metadata into GeoTIFF #5

@mvhulten

Description

@mvhulten

As I noted in mkslopes/create_pfl_slopes, HSURFBurnedAndMod.nc does not have geotransform, gcps, or rpcs information included. This was not preserved in burnShape2Topo.py. Now I thought that this would be then included by

gdal_translate -a_srs ./WKT-Sphere.txt HSURF.nc HSURF-Sphere.tiff
gdal_translate -a_srs ./WKT-Sphere.txt HSURFBurnedAndMod.nc HSURFBurnedAndMod-Sphere.tiff

but it is not:

>>> dem = grid.read_raster('/p/scratch/cdetect/vanhulten1/testing/ParFlow_static-file-gen.25C09/mkslopes/HSURF-Sphere.tiff', crs="sphere")
>>> dem = grid.read_raster('/p/scratch/cdetect/vanhulten1/testing/ParFlow_static-file-gen.25C09/mkslopes/HSURFBurnedAndMod-Sphere.tiff', crs="sphere")
/p/home/jusers/vanhulten1/jureca/.local/lib/python3.12/site-packages/rasterio/__init__.py:356: NotGeoreferencedWarning: Dataset has no geotransform, gcps, or rpcs. The identity matrix will be returned.
  dataset = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)

Is the argument to gdal_translate -a_srs exactly the information that is needed?

The man page states:

No reprojection is done.

and I also do not want this. I do want relevant metadata (missing from the netCDF file) to be included in the GeoTIFF file, but this does not appear to work.

Inspection with gdalinfo(1) shows that Coordinate Systems are defined in both GeoTIFF files, but there is much more Metadata in the non-burnt GeoTIFF file.

Of course, instead of including the needed geotransform metadata into the GeoTIFF output, we could first try to address the discarded/missing metadata in the intermediate netCDF output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions