Link to USGS home
Surface Water Information--Data Scripts

copy_dv_to_diff_dd

Name:
copy_dv_to_diff_dd - Move daily values and daily value summary statistics from one DD to another within a site or between sites.

Information:

This cleanup script was written to help those needing to consolidate daily values from multiple DDs into one DD. It can copy DVs between DDs at one station or between different equivalent stations. It simply copies the daily values and daily value summary statistics files from one DD to another DD for a specific DV statistic (e.g. mean) and a user specified period, overwriting any existing daily values in the destination DD. It is very useful in the cleanup tasks associated with the NWISWeb daily values project. It is also very powerful and must be used with caution as it can overwrite good data if not used carefully. A new database checkpoint is recommended prior to using this or any extensive database cleanup activity. It can only be run as user "nwis."

Usage:

copy_dv_to_diff_dd [-z db_no] [-a agency_cd] -n site_no -d from_dd_nu -o to site no -t to_dd_nu -b begin_wyr -e end_wyr -s stat_cd

Where:

db_no is database number (if omitted will default to database 1)
agency_cd is agency code (if omitted will default to USGS)
site_no is the 8-15 digit site ID (required)
from_dd_nu is the source DD number (required)
to site not is the destination 8-15 digit site ID (if omitted will default to site no)
to_dd_nu is the destination DD number (required)
begin_wry is the beginning water year of the transfer (required)
end_wyr is the ending water year of the transfer (required)
stat_cd is the DV statistic code to transfer (required)

For example for a station number 12345678, to move mean data from DD 5 to DD 1 for the period 1950-1994 the command would be:

copy_dv_to_diff_dd -n 12345678 -d 5 -t 1 -b 1950 -e 1994 -s 3

To copy mean data from station 12345678, DD 5 to station 12345679, DD3 for the period 1960-1998, the command would be:
- copy_dv_to_diff_dd –n 12345678 -d 5 –o 12345679 –t 3 –b 1960 –e 1998 –s 3

- Must be run as user "nwis"
- Will overwrite any data in the destination DD that it finds, including overwriting data will null values.
- Will also move DV summary statistics tables if they exist (only applies to discharge DDs and stat code 00003)
- Multiple DV statistics (e.g. max/min/mean) must be moved as separate commands
- Must specify the years (no default start or end period of record)
- Must be run on complete water years

Installation:

The scripts can be installed by unzipping the files in any Sun directory and making sure the script is executable (chmod +x copy_dv_to_diff_dd).

Script Language:
ksh

Requirements:

Original Author(s): Scott Bartholoma, NWIS

Note the original author is noted on this page for the purposes of giving credit only. Please address questions/comments to OSW (GS-W OSW Scripts@usgs.gov).

Known Problems/Limitations/Need Improvements:

Scripts:

Version 5.0: (posted 02/01/2013)
—Updated for NWIS 5.0/Oracle and a few minor other minor tweaks
copy_dv_to_diff_dd download (Zip file = 4.1K)

Back to Scripts
[an error occurred while processing this directive]