Opened 9 years ago

Closed 7 years ago

#3438 closed defect (fixed)

Unable to add NetCDF support to PostGIS 2.2

Reported by: N3tMaster Owned by: dustymugs
Priority: blocker Milestone: PostGIS GDAL
Component: postgis Version: 2.2.x
Keywords: postgis gdal netcdf Cc:

Description

I installed, into Ubuntu 14.10, Postgresql 9.4 with PostGIS 2.2 with Proj and GDAL support but I'm able to add NetCDF support to PostGIS.

My Install steps were: 1) installed postgresql 9.4 using apt-get 2) installed proj, libxml by apt-get 3) installed from source: hdf5, netCDF and GDAL 2.0 4) installed from source: postgis 2.2.1

I successfully check postgis version using SELECT postgis_full_version(); command I enabled all gdal drivers with : SET postgis.gdal_enabled_drivers = 'ENABLE_ALL'; I enabled outdb gdal with : SET postgis.enable_outdb_rasters TO True

I ran several postgis functions successfully but unfortunately when I launched select * from ST_GDALDrivers() NetCDF support didn't appear…

moreover if I set gdal_enabled_drivers to "GMT" or "netCDF" , the query will run without error but the result of "st_gdaldrivers()" will be always 0… I seems that Postgis recognizes netCDF/GMT code but I isn't able to find related driver information

Any idea?

Change History (7)

comment:1 by N3tMaster, 9 years ago

Keywords: postgis gdal netcdf added
Priority: mediumblocker

comment:2 by N3tMaster, 9 years ago

It seems that Postgis recognizes netCDF/GMT code but It isn't able to find related driver information

comment:3 by rouault, 9 years ago

netCDF files are sometimes reported as datasets with zero reaster band, but with subdatasets listed. This is the subdatasets you must open. Use gdalinfo on the main netCDF file to see the name of the subdataset to use.

Example :

$ gdalinfo NL.2001.nsidc0321v01.nc
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Driver: netCDF/Network Common Data Format
Files: NL.2001.nsidc0321v01.nc
Size is 512, 512
Coordinate System is `'
Metadata:
  NC_GLOBAL#comment=Not set at this time
  NC_GLOBAL#creation_date=Wed Feb 20 13:14:48 MST 2008
  NC_GLOBAL#grid_id=Nl
  NC_GLOBAL#history=Wed Feb 20 13:15:33 2008: ncrcat -O NL.2001001.nsidc0321v01.nc NL.2001009.nsidc0321v01.nc NL.2001017.nsidc0321v01.nc NL.2001025.nsidc0321v01.nc NL.2001033.nsidc0321v01.nc NL.2001041.nsidc0321v01.nc NL.2001049.nsidc0321v01.nc NL.2001057.nsidc0321v01.nc NL.2001065.nsidc0321v01.nc NL.2001073.nsidc0321v01.nc NL.2001081.nsidc0321v01.nc NL.2001089.nsidc0321v01.nc NL.2001097.nsidc0321v01.nc NL.2001105.nsidc0321v01.nc NL.2001113.nsidc0321v01.nc NL.2001121.nsidc0321v01.nc NL.2001129.nsidc0321v01.nc NL.2001137.nsidc0321v01.nc NL.2001145.nsidc0321v01.nc NL.2001153.nsidc0321v01.nc NL.2001161.nsidc0321v01.nc NL.2001185.nsidc0321v01.nc NL.2001193.nsidc0321v01.nc NL.2001201.nsidc0321v01.nc NL.2001217.nsidc0321v01.nc NL.2001225.nsidc0321v01.nc NL.2001233.nsidc0321v01.nc NL.2001241.nsidc0321v01.nc NL.2001249.nsidc0321v01.nc NL.2001257.nsidc0321v01.nc NL.2001265.nsidc0321v01.nc NL.2001273.nsidc0321v01.nc NL.2001281.nsidc0321v01.nc NL.2001289.nsidc0321v01.nc NL.2001297.nsidc0321v01.nc NL.2001305.nsidc0321v01.nc NL.2001313.nsidc0321v01.nc NL.2001321.nsidc0321v01.nc NL.2001329.nsidc0321v01.nc NL.2001337.nsidc0321v01.nc NL.2001345.nsidc0321v01.nc NL.2001353.nsidc0321v01.nc NL.2001361.nsidc0321v01.nc NL.2001.nsidc0321v01.nc
  NC_GLOBAL#institution=National Snow & Ice Data Center, Boulder, CO
  NC_GLOBAL#nco_openmp_thread_number=1
  NC_GLOBAL#references=Data set documentation: http://nsidc.org/data/nsidc-0321.html
  NC_GLOBAL#source=Satellite observations from DMSP SSM/I and Terra MODIS
  NC_GLOBAL#title=Global EASE-Grid 8-day Blended SSM/I and MODIS Snow Cover
Subdatasets:
  SUBDATASET_1_NAME=NETCDF:"NL.2001.nsidc0321v01.nc":bpInfo
  SUBDATASET_1_DESC=[43x81] bpInfo (8-bit character)
  SUBDATASET_2_NAME=NETCDF:"NL.2001.nsidc0321v01.nc":scaInfo
  SUBDATASET_2_DESC=[43x81] scaInfo (8-bit character)
  SUBDATASET_3_NAME=NETCDF:"NL.2001.nsidc0321v01.nc":latitude
  SUBDATASET_3_DESC=[721x721] latitude (64-bit floating-point)
  SUBDATASET_4_NAME=NETCDF:"NL.2001.nsidc0321v01.nc":longitude
  SUBDATASET_4_DESC=[721x721] longitude (64-bit floating-point)
  SUBDATASET_5_NAME=NETCDF:"NL.2001.nsidc0321v01.nc":SWE
  SUBDATASET_5_DESC=[43x721x721] lwe_thickness_of_surface_snow_amount (16-bit integer)
  SUBDATASET_6_NAME=NETCDF:"NL.2001.nsidc0321v01.nc":SCA
  SUBDATASET_6_DESC=[43x721x721] surface_snow_area_fraction (16-bit integer)
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)
$ gdalinfo NETCDF:"NL.2001.nsidc0321v01.nc":bpInfo
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Driver: netCDF/Network Common Data Format
Files: NL.2001.nsidc0321v01.nc
Size is 81, 43
Coordinate System is `'
Metadata:
  bpInfo#long_name=SWE_file_used
  bpInfo#_FillValue=
  cols#long_name=x-coordinate in EASE-Grid
  cols#standard_name=projection_x_coordinate
  cols#units=count
  cols#valid_range={0,720}
  NC_GLOBAL#comment=Not set at this time
  NC_GLOBAL#creation_date=Wed Feb 20 13:14:48 MST 2008
  NC_GLOBAL#grid_id=Nl
  NC_GLOBAL#history=Wed Feb 20 13:15:33 2008: ncrcat -O NL.2001001.nsidc0321v01.nc NL.2001009.nsidc0321v01.nc NL.2001017.nsidc0321v01.nc NL.2001025.nsidc0321v01.nc NL.2001033.nsidc0321v01.nc NL.2001041.nsidc0321v01.nc NL.2001049.nsidc0321v01.nc NL.2001057.nsidc0321v01.nc NL.2001065.nsidc0321v01.nc NL.2001073.nsidc0321v01.nc NL.2001081.nsidc0321v01.nc NL.2001089.nsidc0321v01.nc NL.2001097.nsidc0321v01.nc NL.2001105.nsidc0321v01.nc NL.2001113.nsidc0321v01.nc NL.2001121.nsidc0321v01.nc NL.2001129.nsidc0321v01.nc NL.2001137.nsidc0321v01.nc NL.2001145.nsidc0321v01.nc NL.2001153.nsidc0321v01.nc NL.2001161.nsidc0321v01.nc NL.2001185.nsidc0321v01.nc NL.2001193.nsidc0321v01.nc NL.2001201.nsidc0321v01.nc NL.2001217.nsidc0321v01.nc NL.2001225.nsidc0321v01.nc NL.2001233.nsidc0321v01.nc NL.2001241.nsidc0321v01.nc NL.2001249.nsidc0321v01.nc NL.2001257.nsidc0321v01.nc NL.2001265.nsidc0321v01.nc NL.2001273.nsidc0321v01.nc NL.2001281.nsidc0321v01.nc NL.2001289.nsidc0321v01.nc NL.2001297.nsidc0321v01.nc NL.2001305.nsidc0321v01.nc NL.2001313.nsidc0321v01.nc NL.2001321.nsidc0321v01.nc NL.2001329.nsidc0321v01.nc NL.2001337.nsidc0321v01.nc NL.2001345.nsidc0321v01.nc NL.2001353.nsidc0321v01.nc NL.2001361.nsidc0321v01.nc NL.2001.nsidc0321v01.nc
  NC_GLOBAL#institution=National Snow & Ice Data Center, Boulder, CO
  NC_GLOBAL#nco_openmp_thread_number=1
  NC_GLOBAL#references=Data set documentation: http://nsidc.org/data/nsidc-0321.html
  NC_GLOBAL#source=Satellite observations from DMSP SSM/I and Terra MODIS
  NC_GLOBAL#title=Global EASE-Grid 8-day Blended SSM/I and MODIS Snow Cover
  rows#long_name=y-coordinate in EASE-Grid
  rows#standard_name=projection_y_coordinate
  rows#units=count
  rows#valid_range={0,720}
  time#long_name=julian day
  time#units=days since -4713-01-01 12:00:00
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,   43.0)
Upper Right (   81.0,    0.0)
Lower Right (   81.0,   43.0)
Center      (   40.5,   21.5)
Band 1 Block=81x1 Type=Byte, ColorInterp=Undefined
  NoData Value=0
  Metadata:
    long_name=SWE_file_used
    NETCDF_VARNAME=bpInfo
    _FillValue=

So in that case the name for PostGIS out-db must be 'NETCDF:"/path/to/NL.2001.nsidc0321v01.nc":variable_name'

comment:4 by dustymugs, 7 years ago

Owner: changed from pramsey to dustymugs

NetCDF won't show up in ST_GDALDrivers() as we filter to only those drivers that support CreateCopy and VirtualIO, required for ST_AsGDALRaster(). This does not mean PostGIS cannot open a NetCDF as per the prior comment.

Best solution might be to enhance ST_GDALDrivers() by adding columns Read and Write capabilities…

Last edited 7 years ago by dustymugs (previous) (diff)

comment:5 by dustymugs, 7 years ago

Status: newassigned

Created issue: #3963

comment:6 by dustymugs, 7 years ago

You can see the read vs write support by comparing the outputs of ST_GDALDrivers() and raster2pgsql -G

comment:7 by dustymugs, 7 years ago

Resolution: fixed
Status: assignedclosed

Resolved as of r16195

Note: See TracTickets for help on using tickets.