using `cog_translate` on netCDF4 with improper georeferencing
See original GitHub issueI am trying to use cog_translate
to convert some netCDF4 datasets to COG, and it appears these files do not have proper georeferencing.
I have modified cogeo.py
to accept vrt_params
, so that I can manually pass the src_crs
and src_transform
via the WarpedVRTReaderBase
mixin of WarpedVRT
, as you can see here:
https://github.com/ryanjdillon/rio-cogeo/blob/cog_translate_vrt_params/rio_cogeo/cogeo.py#L87-L99
Then I’m passing the following vrt_params
:
vrt_params = dict(src_transform=Affine(gdal_geotransform), src_crs='EPSG:4326')
This get’s me past the CRS is None error, but it doesn’t seem to acknowledge the Affine transform I pass to src_transform
, resulting in the following error:
CPLE_AppDefinedError: The transformation is already “north up” or a transformation between pixel/line and georeferenced coordinates cannot be computed for /home/ryan/data/webstep/kvt/NVE_Sorlandet/NVE_Sorlandet_wslev0_xyt_synth.nc4. There is no affine transformation and no GCPs. Specify transformation option SRC_METHOD=NO_GEOTRANSFORM to bypass this check.
Any suggestions on how I might get this to work?
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (5 by maintainers)
Top GitHub Comments
@ryanjdillon Long time no see 😄 I finally had to work with netcdf recently and thanks to some recent change in rio-cogeo we can now pass Memory or VRT files to
cog_translate
.since we can use MemoryFile or VRT, we can now fix the data upfront and pass it to
cog_translate
so I think we can close this issue.🤔 thanks @ryanjdillon,
Can you checkout what https://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/validate_cloud_optimized_geotiff.py gives you ?
Allowing
vrt_params
as input might complicated a lot the code (especially with the changes from https://github.com/cogeotiff/rio-cogeo/pull/62). That said, I think we could document it and tell how to generate a proper temporary file from the netCDF4 before passing it to rio-cogeo.I’m no expert with netCDF so I’m may be missing some knowledge here