|Metadata and the National Hydrography Dataset (NHD)|
Metadata provided with data from the U.S. National Hydrography Dataset contain many elements appropriate for use in the National Spatial Data Infrastructure (NSDI). However the format of these files is not directly compatible with software created for the NSDI.
The NHD high-resolution data packages are distributed from http://edcw2ks56.cr.usgs.gov/fod/hftp.asp Each package includes a directory labeled metadata containing many files whose names end in .met. Files with the same root name (8-digit hydrologic unit code) can be merged to form a reasonable metadata record.
Data for the Truckee hydrologic unit (code 16050102) are at
ftp://edc.usgs.gov/pub/data/nhd/fod_cache/high_resolution/arc/16050102.tgzWhen unpacked, a directory 16050102 is created and within it, a directory metadata containing, at this writing,
Size Date created File name ----------------------------------- 12855 Jan 21 10:25 16050101001.met 477 Jan 21 10:25 16050101002.met 166 Jan 21 10:25 16050101003.met 126 Jan 21 10:25 16050101004.met 400 Jan 21 10:25 16050101005.met 12849 Jan 21 10:25 16050102001.met 126 Jan 21 10:25 16050102002.met 704 Jan 21 10:25 16050102003.met 400 Jan 21 10:25 16050102004.met 12859 Jan 21 10:25 16050201001.met 714 Jan 21 10:25 16050201002.met 400 Jan 21 10:25 16050201003.met 4763 Jan 21 10:25 nhd.metAlthough the data in this package pertain only to the hydrologic unit 16050102, metadata are included for units 16050101 and 16050201 as well. Those can be ignored.
The task at hand is to re-format and merge the information provided in the files pertaining to 16050102 so that they can be understood by software that handles metadata. Here the files that need to be merged and reformatted are
16050102001.met 16050102002.met 16050102003.met 16050102004.met nhd.met
Each specific file is merged, in turn, with a "boilerplate" file using a script merge.tcl which is written in Tcl and interpreted by the Tcl shell ("tclsh"). This script utilizes the Tcl extension mq to read and edit the metadata.
http://aspn.activestate.com/ASPN/Downloads/ActiveTcl(follow the link labeled "Download" under Product Information on the left side)
These instructions assume you installed Tcl/Tk into the folder C:\Program Files\Tcl.
http://geology.usgs.gov/tools/metadata/all_win.exeThese instructions assume you installed in C:\USGS
package require mq. The response should be a version number like 2.6.0.
tclshat the command prompt.
'tclsh' is not recognized as an internal or external command, operable program or batch file.then you need to set the execution path to include the Tcl interpreter. Type
at the prompt. Then try typing
PATH %PATH%;C:\Program Files\Tcl\bin
cd \gis\NHD\16050102\metadataat the prompt. But instead of
\gis\NHD\16050102\metadata(which I've made up as an example), use the real directory on your system where the NHD metadata for this HUC are.
16050102001.met 16050102002.met 16050102003.met 16050102004.metEach time you run the script, you'll want to use the results as the template for the next run. So rename the output to match the template name:
Finally, rename the file nhd0.met, which now contains all of the merged metadata, so that its name is the number of your HUC, with .met as the extension:
copy nhd-hr.met nhd0.met tclsh merge.tcl 16050102001.met move merged-16050102001.met nhd0.met tclsh merge.tcl 16050102002.met move merged-16050102002.met nhd0.met tclsh merge.tcl 16050102003.met move merged-16050102003.met nhd0.met tclsh merge.tcl 16050102004.met move merged-16050102004.met nhd0.met
This looks like a pain, so I've written a Tcl script mkbat.tcl that will create a batch file containing all of the commands you need for this step. From the command prompt, run
move nhd0.met 16050102.met
tclsh mkbat.tcl. Then inspect the file doit.sh, which should have been created by this script. If all went well, all you have to type now is
Peter N. Schweitzer Mail Stop 954 National Center U.S. Geological Survey 12201 Sunrise Valley Drive Reston VA 20192 703-648-6533 703-648-6252 FAX email@example.com