I can read the netCDF file data with netCDF-python or with gdalinfo, but I am unsure of the easiest way to get it into a PostGIS database. It would be really easy if I could convert the netCDF file to the shapefile format because using ogr2ogr is fairly straightforward. I started to used some code netCDF2postgis.py from the PostGIS Recipes book, but it has a lot of problems and what I did get working created way too many tables.

If it helps, the data is NOAA GOES 15 weather satellite data which contains the following information. This is only for Band 1 (visible light) at a specific date and time:

gdalinfo NETCDF:"goes15.2014.175.190020.BAND_01.nc"
Driver: netCDF/Network Common Data Format
Files: none associated
Size is 512, 512
Coordinate System is `'
  NC_GLOBAL#Satellite Sensor=G-15 IMG    
  NC_GLOBAL#Source=McIDAS Area File
  SUBDATASET_1_DESC=[2x80] auditTrail (8-bit character)
  SUBDATASET_2_DESC=[1x29x68] data (32-bit floating-point)
  SUBDATASET_3_DESC=[29x68] lat (32-bit floating-point)
  SUBDATASET_4_DESC=[29x68] lon (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)
  • @scottlittle, do you remember where you got the data from? Did you do the conversion from McIDAS Area to NetCDF? Feb 9 '16 at 21:30
  • I got the data directly from NOAA and requested NetCDF directly. Feb 9 '16 at 21:50
  • 1
    It's not clear if this question asks about vector or raster data stored in a NetCDF file, as it mentions both OGR and GDAL tools. For raster support, GDAL requires the data subdataset to be identified; see examples. Vector support was introduced in version 2.1.
    – Mike T
    Feb 14 '17 at 22:21

From the header info you show it appears that what you are trying to load is a raster image. GDAL is the correct tool for converting the raster bands from netcdf to for instance geotiff after which you can use raster2pgsql to load the raster into postgis. Basically, you might be done with:

gdal_translate mynetcdf.nc mygeotiff.tiff
raster2pgsql -somesettings mygeotiff.tiff  | psql -somesettings

But... you also refer to shapefiles which are obviously vector format. It might be not straigtforward to go from netcdf to postgis vector. If you really want to have vector then every lat/lon position would become 1 point in your vector table, likely resulting in more data than you needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.