[gdal-dev] NetCDF: how to read coordinates from "lon" and "lat" variables?

Michael Sumner mdsumner at gmail.com
Tue Dec 3 03:01:50 PST 2024


Try

gdalinfo NETCDF:"out.input.nc":NO2

If you see those lon and lat subdatasets listed under "geolocation" then
you can use gdalwarp to create a georeferenced dataset, automatically with
gdalwarp sds.in out.tif or by specifying a grid with some of
-tr,-te,-t_srs,-ts.

If they don't appear they can can be arranged via VRT.

HTH

On Tue, 3 Dec 2024, 21:52 andy via gdal-dev, <gdal-dev at lists.osgeo.org>
wrote:

> Hi,
> I have a NetCDF file that I cannot share here.
>
> Using gdalinfo I have the below output.
>
> Is there any way to tell gdal to read coordinates from the “lon” and “lat”
> variables/subdatasets, and thus have the coordinates of the vertices not in
> pixels?
>
> Thank you very much
>
>
> Driver: netCDF/Network Common Data Format
> Files: none associated
> Size is 512, 512
> Subdatasets:
>   SUBDATASET_1_NAME=NETCDF:"out.input.nc":NO2
>   SUBDATASET_1_DESC=[25x1x229x174] NO2 (32-bit floating-point)
>   SUBDATASET_2_NAME=NETCDF:"out.input.nc":O3
>   SUBDATASET_2_DESC=[25x1x229x174] O3 (32-bit floating-point)
>   SUBDATASET_3_NAME=NETCDF:"out.input.nc":PM10
>   SUBDATASET_3_DESC=[25x1x229x174] PM10 (32-bit floating-point)
>   SUBDATASET_4_NAME=NETCDF:"out.input.nc":PM25
>   SUBDATASET_4_DESC=[25x1x229x174] PM25 (32-bit floating-point)
>   SUBDATASET_5_NAME=NETCDF:"out.input.nc":Times
>   SUBDATASET_5_DESC=[25x19] Times (8-bit character)
>   SUBDATASET_6_NAME=NETCDF:"out.input.nc":lat
>   SUBDATASET_6_DESC=[229x174] lat (64-bit floating-point)
>   SUBDATASET_7_NAME=NETCDF:"out.input.nc":lon
>   SUBDATASET_7_DESC=[229x174] lon (64-bit floating-point)
>   SUBDATASET_8_NAME=NETCDF:"out.input.nc":pDUST
>   SUBDATASET_8_DESC=[25x1x229x174] pDUST (32-bit floating-point)
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0,  512.0)
> Upper Right (  512.0,    0.0)
> Lower Right (  512.0,  512.0)
> Center      (  256.0,  256.0)
>
>
>
> --
> ___________________
>
> Andrea Borruso
> website: https://medium.com/tantotanto
> 38° 7' 48" N, 13° 21' 9" E, EPSG:4326
> ___________________
>
> "cercare e saper riconoscere chi e cosa,
>  in mezzo all’inferno, non è inferno,
> e farlo durare, e dargli spazio"
>
> Italo Calvino
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241203/fb6dd606/attachment.htm>


More information about the gdal-dev mailing list