1

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 `'
Metadata:
  NC_GLOBAL#Conventions=CF-1.4
  NC_GLOBAL#Satellite Sensor=G-15 IMG    
  NC_GLOBAL#Source=McIDAS Area File
Subdatasets:
  SUBDATASET_1_NAME=NETCDF:"goes15.2014.175.190020.BAND_01.nc":auditTrail
  SUBDATASET_1_DESC=[2x80] auditTrail (8-bit character)
  SUBDATASET_2_NAME=NETCDF:"goes15.2014.175.190020.BAND_01.nc":data
  SUBDATASET_2_DESC=[1x29x68] data (32-bit floating-point)
  SUBDATASET_3_NAME=NETCDF:"goes15.2014.175.190020.BAND_01.nc":lat
  SUBDATASET_3_DESC=[29x68] lat (32-bit floating-point)
  SUBDATASET_4_NAME=NETCDF:"goes15.2014.175.190020.BAND_01.nc":lon
  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)
  • No answer or comment after a week? I'm wondering if this is the appropriate forum to post this question. – scottlittle Sep 4 '15 at 21:40
  • Hi Scottlittle, is this question still relevant? – tilt Feb 8 '16 at 16:06
  • I'm not working on the project anymore, but the question still stands. – scottlittle Feb 8 '16 at 21:12
  • 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
  • 1
    I am about to start working on weather data and have used netCDF, Python and Postgis extensively. I will try and come back and answer this in a few days. – John Powell Apr 19 '17 at 12:43
1

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.