Database Reference
In-Depth Information
PostGIS table names
if len(sys.argv) < 4 or len(sys.argv)
> 4:
print "usage: <netCDF file path>
<GDAL PostGIS connection string><PostGIS
table prefix>"
raise SystemExit
file_nc = sys.argv[1]
pg_connection_string = sys.argv[2]
postgis_table_prefix = sys.argv[3]
netcdf2postgis(file_nc,
pg_connection_string,
postgis_table_prefix)
5. Run the script. Be sure to use the correct netCDF file path, GDAL PostGIS
connection string (check the format from http://www.gdal.org/ogr/
drv_pg.html ) ,andatableprefixthathastobeappendedtothetablenames
for the tables that will be created in PostGIS:
(postgis-cb-env)$ python
netcdf2postgis.py
NETCDF:"soilw.mon.ltm.v2.nc"
"PG:dbname='postgis_cookbook'
host='localhost' port='5432' user='me'
password='mypassword'" netcdf
Importing from
NETCDF:"soilw.mon.ltm.v2.nc":climatology_bounds
the variable climatology_bounds...
...
Importing from
NETCDF:"soilw.mon.ltm.v2.nc":soilw the
variable soilw...
Table netcdf_soilw created.
Field band_1 created.
Field band_2 created.
...
Field band_11 created.
Field band_12 created.
Search WWH ::




Custom Search