(content link) weather.gov    
NOAA link
National Weather Service
  NWS link
National Operational Hydrologic
Remote Sensing Center

NOHRSC Technology > NOHRSC GIS Applications

NOHRSC Software -
Instructions for Informix to PostgreSQL Migration

February 22, 2006

The following is documentation for moving an installation of NOHRSC's Integrated Hydrologic Automated Basin Boundary System (IHABBS) and Unit Hydrograph (UHG) from a Informix database to a PostgreSQL database system. It is assumed that:

  1. The client machine may be different.
  2. The directory file paths may be different.
  3. Once completed, the Informix database will no longer be used by IHABBS.

If you have any questions or concerns, please contact Anders Nilsson at NOHRSC, (952) 368-2517 or email .

Instructions for the Informix environment

In an environment where the Informix version of IHABBS can run,

  1. Make sure you have the latest Database Administration tool executable (NOHRSC_systems) for Informix shown on this page.

  2. Find a directory where you wish the installation to be archived.

  3. Download the archive_all script (if you do not have it). Note that this script will copy and remove everything from the existing database and file systems and place it in the corresponding directory. If you do not want your existing installation to be affected (you wish to duplicate the installation) then change the following line in the archive_all script:

    OPTION=archive
    
    to
    
    OPTION=share
    

    Now execute the script:

       ./archive_all (a suitable output directory)
    

    This will archive (and remove if not altered) all GIS layers from the Informix database and the appropriate file systems.

  4. Download the archive_hydrographs script (if you do not have it) and execute the following script:

       ./archive_hydrographs (the same suitable output directory)
    

    This will copy all generated hydrograph information (if there is any).

  5. Copy your nohrsc.cfg file to this directory.

       cp $IHABBS/nohrsc.cfg (the same suitable output directory)
    

At this point, all the pertinent data from the Informix installation should be archived. If this is being migrated to a different machine/file system, the current directory could be tarred and gzipped.

Instructions for the PostgreSQL environment

  1. On the new machine / file system, Download the following two files and put them into a spacious work directory.

    nohrsc_pg_docs.tar.gz
    nohrsc_pg_executables.tar.gz
  2. Uncompress the files by using the following:

       tar xvzf nohrsc_pg_docs.tar.gz
       tar xvzf nohrsc_pg_executables.tar.gz
    

    These will create an "install" directory, and fill it with files.

  3. Copy all the archived files/directories created by the end of the Informix section above (though not the output directory itself) into the newly created "install" directory.

  4. Make sure the environment variables are set as listed below:

    Some environment variables have to be set for the rest of the installation process. These variables will also need to be set in the shell before a NOHRSC application can be run. Some River Forecast Centers define these variables in the user's profiles (files such as .profile, .appsdefaults, or .bashrc), while others place these in a script which then calls the nohrsc launcher. The general PATH environment variable will also need to have the directory containing the executables in it (described below).

    File path info:

    export GISRS_HOME=
    a parent master directory into which IHABBS-related subdirectories will be placed.
    export GISRS_COMMON_DATA=
    a parent directory into which static "common" data (State outlines, county boundaries, etc...) will be placed. (This is often the same as $GISRS_HOME)
    export GISRS_BASIN_DATA=
    a parent directory into which IHABBS static data (flow accumulation grids) and more dynamic data (basin vectors) will be placed. (This is often the same as $GISRS_COMMON_DATA)
    export GISRS_ARCHIVE=
    a directory to contain archived and shared layers (and often installation packages) (This is often $GISRS_HOME/archive)
    export GISRS_SCRATCH_PATH=
    an already-created directory to contain scratch files. Preferably located on a local disk (akin to /tmp). This directory should have 1 GB free. If there are no available local disks, leave this environment variable undefined.
    export IHABBS=
    a directory to contain all the binary executables (This is often $GISRS_HOME/bin)
    export PATH=$PATH:$IHABBS

    Database info:

    export PGHOST=
    ( the name of the database machine)
    export PGUSER=ihabbs
    export PGCONNECT_TIMEOUT=0
    export GISRS_DATABASE=
    ( the name of the database that you wish to use ) (This can be gisrs)
    export GISRS_SCHEMA=
    ( the name of the database schema/search_path that you wish to use ) ( This can be the default schema name, like "public", ( or a name of a schema which can be created below, like "gisrs". )

    Misc. Preferences:

    export GISRS_DATABASE_WAIT_SECONDS=60
    (duration in seconds for an overly long database transaction)
    export GISRS_FILE_SIZE_PAUSE_SECONDS=1
    (duration after which, if a file size has not changed, it is assumedly finished copying)
    export GISRS_MINIMUM_RASTER_COMPRESSION_LEVEL=100
    (Maximum percentage size of a compressed raster. A value of 100 means that the programs will compress a raster file if the compressed file is smaller than the original file)
    GISRS_USER=`whoami`
    GISRS_MAIL=`whoami`
  5. Database Setup

    Once these variables are set, the database and the database use $PGUSER can be created using an database administrator account. The database creation step is shown below. More in-depth discussion on Postgres database setup can be found here. If you are having problems creating the database, be sure to check it.

    If you have PostgreSQL version 8+, you can specify a tablespace in which to put the database using the following:

       psql template1 << NOHRSC
       create database $GISRS_DATABASE tablespace tablespace ;
       grant temporary on database $GISRS_DATABASE to $PGUSER ;
       \q
       NOHRSC
    

    However, AWIPS machinery currently is installed with a version less than 8 (7.4.7). So, in those circumstances, you can create the database (and place it in an already created area PGDATA_LOCAL) using the following:

       psql template1 << NOHRSC
       create database $GISRS_DATABASE with location = 'PGDATA_LOCAL' ;
       grant temporary on database $GISRS_DATABASE to $PGUSER ;
       \q
       NOHRSC
    

    For either version, if a schema other than the default (most likely "public") is to be used by IHABBS, it can be created by the following:

       psql $GISRS_DATABASE << NOHRSC
       create schema $GISRS_SCHEMA ;
       grant usage on schema $GISRS_SCHEMA to $PGUSER ;
       grant create on schema $GISRS_SCHEMA to $PGUSER ;
       \q
       NOHRSC
    
  6. Once the database and schema has been created, Add/modify the following lines to the nohrsc.cfg file

    DATABASE = (the new $GISRS_DATABASE value)
    SCHEMA = (the $GISRS_SCHEMA value)
    DATAPATH = (where you want hydrographs to live, often $GISRS_HOME/hydrograph)
    

    Next, run the following four scripts:

       ./make_directories.sh
    

    (This will create the directories specified by the environment variables.)

       ./copy_files.sh
    

    (This will move the executables and the documentation to their places. This will also update the nohrsc.cfg configuration file with the values specified in the environment variables.)

       ./install_script.sh
    

    (This will create tables within the newly created database, and then populate it with restored layers.)

       ./restore_hydrographs
    

    (This will restore any hydrograph information.)

Documents and Programs

This is a minimum listing of what should be in the <BIN> directory.

Documents
Export.hlp - Help file for the "Export" application
ihabbs.hlp - Help file for the IHABBS application
nohrsc.cfg - Generic configuration file used by all apps: nohrsc, Export, uhg and ihabbs. This file can either be located in the <BIN> directory, or in a local directory from which the user runs the nohrsc launcher. This file will probably need to be edited to reflect different GIS data layers.
nohrsc.hlp - Help file for the nohrsc toolbar application
uhg.hlp - Help file for the unit hydrograph application

Programs
nohrsc - Command toolbar which launches other applications and manages X color allocation on 8-bit displays
Export - GIS layer exporting program called by the nohrsc toolbar
NOHRSC_systems - Database administration program called by the nohrsc toolbar
uhg - Unit Hydrograph application, called by the nohrsc toolbar
ihabbs - IHABBS, or Integrated Hydrologic Automated Basin Boundary System, called by the nohrsc toolbar

Obsolete executables for HP-UX can be foud in this directory.

NOHRSC
Mission Statement  |  Contact


National Weather Service
National Operational Hydrologic Remote Sensing Center
Office of Water Prediction
1735 Lake Drive W.
Chanhassen, MN 55317

NOHRSC homepage
Contact NOHRSC
Glossary
Credits
Information Quality
Page last modified: Jun 02, 2014 - cloud
About Us
Disclaimer
Privacy Policy
FOIA
Career Opportunities