[gdal-dev] Export a geotiff to netcdf in lat lon coordinates

Jeff McKenna jmckenna at gatewaygeomatics.com
Mon Nov 25 14:44:22 PST 2019


Hi Tony,

When I execute 'ncdump -h' locally on your generated file I get a proper 
response (see https://pastebin.com/Ki4BTTNS).  Note that MS4W is 
currently built against netCDF-4.7.0 (maybe you have an older netCDF 
library version?)

PS. I'll shortly be upgrading netCDF support to the recent 4.7.3 release 
for Windows users (follow along if you wish at 
https://ms4w.com/trac/ticket/238)

Hope that helps.

-jeff



-- 
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/


On 2019-11-25 4:11 PM, Tony L. wrote:
> Hello Jeff!
> Thank you so much for your help!!
> I tried to follow your steps and works well for the transformation from 
> tif to netcdf. I can use ncdump to check info on the file and I can plot 
> it normally.
> 
> Now, when I reproject the file to lat/lon coord using your command:
> 
> gdalwarp -s_srs EPSG:3411 -t_srs EPSG:4326 
> N_197901_concentration_v3.0.nc N_197901_concentration_v3.0_4326.nc
> 
> and when I try to get info on the file using ncdump -h I get:
> ncdump: N_197901_concentration_v3.0_4326.nc: NetCDF: Unknown file format
> 
> Any idea as to why that would happen?
> 
> Tony
> 
> On Friday, November 22, 2019, 01:19:50 PM EST, Jeff McKenna 
> <jmckenna at gatewaygeomatics.com> wrote:
> 
> 
> Hi Tony,
> 
> Here are my steps.
> 
> Have a nice weekend.
> 
> 
> ***********
> 
> #use gdalinfo to get summary (see https://gdal.org/programs/gdalinfo.html)
> gdalinfo -noct N_197901_concentration_v3.0.tif
> 
> #review source EPSG projection (found from gdalinfo command above)
> in web browser goto: http://epsg.io/3411
> 
> #review desired output projection (lat/long)
> in web browser goto: http://epsg.io/4326
> 
> #transform to NetCDF
> gdal_translate -f netCDF N_197901_concentration_v3.0.tif
> N_197901_concentration_v3.0.nc
> 
> #reproject to lat/long, which is EPSG:4326
> (https://gdal.org/programs/gdalwarp.html)
> gdalwarp -s_srs EPSG:3411 -t_srs EPSG:4326
> N_197901_concentration_v3.0.nc N_197901_concentration_v3.0_4326.nc
> 
> #examine reprojected file (verify "corner coordinates" look proper)
> gdalinfo -noct N_197901_concentration_v3.0_4326.nc
> 
>    * for all commands I used MS4W 4.0.1, on Windows, from https://ms4w.com
> 
> ******
> 
> 
> -- 
> Jeff McKenna
> MapServer Consulting and Training Services
> https://gatewaygeomatics.com/
> 
> 
> 
> On 2019-11-22 1:24 PM, Tony L. wrote:
>  > Hello
>  > I'm quite new with gdal and would like to use is to rewrite a geotiff of
>  > NSIDC sea ice concentration from geotiff in polar stereographic
>  > projection into a netcdf in Lon Lat coordinates
>  >
>  > The file is located here: N_197901_concentration_v3.0.tif
>  > 
> <https://www.dropbox.com/s/bkqt6qgyhpr7vjk/N_197901_concentration_v3.0.tif?dl=0>
>  >
>  >
>  >
>  >
>  >
>  >
>  >    N_197901_concentration_v3.0.tif
>  >
>  > Shared with Dropbox
>  >
>  > 
> <https://www.dropbox.com/s/bkqt6qgyhpr7vjk/N_197901_concentration_v3.0.tif?dl=0>
> 
>  >
>  > I was able to transform the file into a netcdf file using gdal_translate:
>  >
>  > gdal_translate -of netCDF N_197901_concentration_v3.0.tif out.nc
>  >
>  > But I'm still trying to figure out how to translate this into Lon Lat
>  > coordinates (probably using gdalwarp)
>  >
>  > Any help would be really appreciated!
>  >
>  > Tony
> 
>  >



More information about the gdal-dev mailing list