Re: [gdal-dev] convert NETCDF to Geotiff upside down
Thank you all for the helpful information. I tried the conversion with the -ts and without but I did not see a big difference in the output Geotiff image. On Thu, Aug 10, 2023 at 08:31 Marius Jigmond wrote: > The following works for the proper orientation but there's a shift. I > would consult the documentation as they usually specify conversion params. > > gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -179.9 -72.7 180 72.7 > -co COMPRESS=LZW NETCDF:GLOBCOMPLIR_nc.2023080819:data ofn.tif > -- > *From:* gdal-dev on behalf of Dori < > izzybit...@gmail.com> > *Sent:* Wednesday, August 9, 2023 2:29 PM > *To:* gdal-dev@lists.osgeo.org > *Subject:* [gdal-dev] convert NETCDF to Geotiff upside down > > Hi, > I tried to convert the NETCDF stored in > https://noaa-gmgsi-pds.s3.amazonaws.com/index.html#GMGSI_LW/202308/08/19/GLOBCOMPLIR_nc.2023080819 > to Geotiff format using following command: > > gdal_translate 0ol GTiff -a_srs EPSG:4326 -aullr -180 -72.7 179.9 -72.7 > -co “COMPRESS=LZW” NETCDF:GLOBCOMPLIR_nc.2023080819:data ofn.tif > > ofn.tif is upside down. North latitude points are in South and viceversa. > > How can I solve this upside down output? > What causes this? > > I did notice that the points in the NETCDF file are not equidistant what > could be my issue. > > Thank you for any hint on how to go about getting the correct Geotiff > output > > ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] convert NETCDF to Geotiff upside down
The following works for the proper orientation but there's a shift. I would consult the documentation as they usually specify conversion params. gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -179.9 -72.7 180 72.7 -co COMPRESS=LZW NETCDF:GLOBCOMPLIR_nc.2023080819:data ofn.tif From: gdal-dev on behalf of Dori Sent: Wednesday, August 9, 2023 2:29 PM To: gdal-dev@lists.osgeo.org Subject: [gdal-dev] convert NETCDF to Geotiff upside down Hi, I tried to convert the NETCDF stored in https://noaa-gmgsi-pds.s3.amazonaws.com/index.html#GMGSI_LW/202308/08/19/GLOBCOMPLIR_nc.2023080819 to Geotiff format using following command: gdal_translate 0ol GTiff -a_srs EPSG:4326 -aullr -180 -72.7 179.9 -72.7 -co “COMPRESS=LZW” NETCDF:GLOBCOMPLIR_nc.2023080819:data ofn.tif ofn.tif is upside down. North latitude points are in South and viceversa. How can I solve this upside down output? What causes this? I did notice that the points in the NETCDF file are not equidistant what could be my issue. Thank you for any hint on how to go about getting the correct Geotiff output ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] convert NETCDF to Geotiff upside down
just a follow up, as far as I can tell the lon,lat arrays are actually natively in global Mercator, so a four-number extent would suffice but these arrays have been materialized rather than preserve that compact origin (it's very common sadly). You might feed that back to the providers and/or other users of the data, shipping these lon,lat arrays is unfortunate when simple georeferencing (extent, expressed as affine transform and a crs) would do. There's more metadata than data in these files ... I've used many tricks to workaround bad formats like these, but now I'd just say to shove it through the warper because that is now so fast and reliable. Cheers, MIke On Thu, Aug 10, 2023 at 7:17 AM Michael Sumner wrote: > there is no georeferencing with this one, but as you say it has internal > coordinates (which GDAL interprets as "geolocation arrays") > > so, run it through the warper i.e. > > gdalwarp NETCDF:GLOBCOMPLIR_nc.2023080819:data ofn.tif > > With that you can (and should) set your desired extent (-te), dimensions > (-ts) [or resolution -tr], and crs (-t_crs) but GDAL will produce an output > that works by heuristics if you specify none (or some) of those. > > I did the following just for fun to see if the non-downloading pathway > would work it (not sure if the config is required or not, for testing > purposes I set dimension to 1024,0 which means GDAL figures out a sensible > aspect ratio - just remove -ts when you're happy with the result for full > resolution. ) > > gdalwarp --config AWS_NO_SIGN_REQUEST "YES" > NETCDF:"/vsis3/noaa-gmgsi-pds/GMGSI_LW/2023/08/08/19/GLOBCOMPLIR_nc.2023080819":data > -ts 1024 0 GLOBCOMPLIR_nc.2023080819_test.tif > > (some details might not work depending on your GDAL version) > > Cheers, Mike > > On Thu, Aug 10, 2023 at 6:30 AM Dori wrote: > >> Hi, >> I tried to convert the NETCDF stored in >> https://noaa-gmgsi-pds.s3.amazonaws.com/index.html#GMGSI_LW/202308/08/19/GLOBCOMPLIR_nc.2023080819 >> to Geotiff format using following command: >> >> gdal_translate 0ol GTiff -a_srs EPSG:4326 -aullr -180 -72.7 179.9 -72.7 >> -co “COMPRESS=LZW” NETCDF:GLOBCOMPLIR_nc.2023080819:data ofn.tif >> >> ofn.tif is upside down. North latitude points are in South and viceversa. >> >> How can I solve this upside down output? >> What causes this? >> >> I did notice that the points in the NETCDF file are not equidistant what >> could be my issue. >> >> Thank you for any hint on how to go about getting the correct Geotiff >> output >> >> ___ >> gdal-dev mailing list >> gdal-dev@lists.osgeo.org >> https://lists.osgeo.org/mailman/listinfo/gdal-dev >> > > > -- > Michael Sumner > Software and Database Engineer > Australian Antarctic Division > Hobart, Australia > e-mail: mdsum...@gmail.com > -- Michael Sumner Software and Database Engineer Australian Antarctic Division Hobart, Australia e-mail: mdsum...@gmail.com ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] convert NETCDF to Geotiff upside down
there is no georeferencing with this one, but as you say it has internal coordinates (which GDAL interprets as "geolocation arrays") so, run it through the warper i.e. gdalwarp NETCDF:GLOBCOMPLIR_nc.2023080819:data ofn.tif With that you can (and should) set your desired extent (-te), dimensions (-ts) [or resolution -tr], and crs (-t_crs) but GDAL will produce an output that works by heuristics if you specify none (or some) of those. I did the following just for fun to see if the non-downloading pathway would work it (not sure if the config is required or not, for testing purposes I set dimension to 1024,0 which means GDAL figures out a sensible aspect ratio - just remove -ts when you're happy with the result for full resolution. ) gdalwarp --config AWS_NO_SIGN_REQUEST "YES" NETCDF:"/vsis3/noaa-gmgsi-pds/GMGSI_LW/2023/08/08/19/GLOBCOMPLIR_nc.2023080819":data -ts 1024 0 GLOBCOMPLIR_nc.2023080819_test.tif (some details might not work depending on your GDAL version) Cheers, Mike On Thu, Aug 10, 2023 at 6:30 AM Dori wrote: > Hi, > I tried to convert the NETCDF stored in > https://noaa-gmgsi-pds.s3.amazonaws.com/index.html#GMGSI_LW/202308/08/19/GLOBCOMPLIR_nc.2023080819 > to Geotiff format using following command: > > gdal_translate 0ol GTiff -a_srs EPSG:4326 -aullr -180 -72.7 179.9 -72.7 > -co “COMPRESS=LZW” NETCDF:GLOBCOMPLIR_nc.2023080819:data ofn.tif > > ofn.tif is upside down. North latitude points are in South and viceversa. > > How can I solve this upside down output? > What causes this? > > I did notice that the points in the NETCDF file are not equidistant what > could be my issue. > > Thank you for any hint on how to go about getting the correct Geotiff > output > > ___ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev > -- Michael Sumner Software and Database Engineer Australian Antarctic Division Hobart, Australia e-mail: mdsum...@gmail.com ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] convert NETCDF to Geotiff upside down
Hi, I tried to convert the NETCDF stored in https://noaa-gmgsi-pds.s3.amazonaws.com/index.html#GMGSI_LW/202308/08/19/GLOBCOMPLIR_nc.2023080819 to Geotiff format using following command: gdal_translate 0ol GTiff -a_srs EPSG:4326 -aullr -180 -72.7 179.9 -72.7 -co “COMPRESS=LZW” NETCDF:GLOBCOMPLIR_nc.2023080819:data ofn.tif ofn.tif is upside down. North latitude points are in South and viceversa. How can I solve this upside down output? What causes this? I did notice that the points in the NETCDF file are not equidistant what could be my issue. Thank you for any hint on how to go about getting the correct Geotiff output ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev