U.S. Geological Survey

USGS NSDI Training for creation of formal metadata
Workshop session two

Exercise 1: Using mp

This exercise is intended to introduce you to the practical use of mp, with an example metadata record that conforms well to the FGDC standard. In each step below, you type the information that is shown in red type in a fixed-width font.

  1. Log in to the system
    login: meta01
    If you're using the standard Bourne shell, the system prompt will be a dollar sign, and if you're running the C shell or one of its variants, the prompt will be a percent sign.

  2. Look at the files in your home directory
    $ ls -laF
  3. Find the directory examples

    $ cd examples
    $ ls -laF
  4. Find the file dds27.met; this is USGS DDS-27: Monthly Polar Sea-Ice Concentration

    $ ls -laF dds27.met
  5. Determine whether mp is properly installed
    $ mp
    Usage: mp [-e efile] [-c cfile] [-t tfile] [-h hfile] [-s sfile] [-d dfile] input_file
           where efile will contain syntax errors
                 cfile contains configuration info
                 tfile will contain text output
                 hfile will contain html output
                 sfile will contain sgml output
                 dfile will contain DIF output
    If you don't get this "usage" text but instead see lots of PostScript code, then the mp that the system found first is a program associated with the mail system. Find our mp and give its full path name, like /usr/local/bin/mp.

  6. Parse the metadata file, displaying errors on the screen
    $ mp dds27.met
  7. The screen wraps the text and, for other files, there can be many messages. Redirect them to a file so that you can examine them more closely with a text editor.
    $ mp dds27.met -e dds27.err
  8. Look at the error file and the metadata using a text editor.
    $ xed dds27.err dds27.met
    In xed, the top line of the window is a "status line" that shows you what line you're on, what column your cursor is in, whether you're in Insert and Autoindent mode, the width that tabs will be expanded, and the name of the file you're editing (a '+' before the name means you've made changes to the file).

  9. Note that mp gives a warning for line 448. Switch to the metadata record and look at line 448.

    1. Click the mouse on the status line to bring up the menus.

    2. Click File to open the File menu, and click Next file twice to switch to the next file. The file dds27.met appears.

    3. Go to the menu again and click Move to open the Move menu, then click Go to line twice to go to a specific line (F4 does all this in one keystroke).

    4. When Go To Line: _ appears in the status line, type 448.

    5. The warning says the element Stereographic appeared in the text of the element Process_Description. Note that on line 456 the word Stereographic appears at the beginning of the line. mp has decided that this word is not supposed to be the element Stereographic but is instead just part of the text of the process description. The warning lets you know this is what it thought, just in case that's not what you intended to write in the metadata record. We can ignore this warning because mp has made the right decision.

    6. Switch back to the error file by selecting Prev file from the File menu.

  10. mp shows errors on lines 517 and 525. Look at those lines.

    1. Switch to the metadata record again (hold down Alt and press the period key).

    2. Go to line 517 (press F4, then enter 517).

    3. This element is Spatial_Data_Organization_Information. Look up its usage in the CSDGM. Note that its structure is defined as
      Spatial_Data_Organization_Information =
          0{Indirect_Spatial_Reference}1 +
          0{Direct_Spatial_Reference_Method +
          ( [Point_and_Vector_Object_Information |
          Raster_Object_Information] )}1
      Note that Raster_Object_Information, if applicable, is not supposed to be repeated.

    4. Go to line 525. This record contains two Raster_Object_Information elements, describing images of different sizes. One set of images (of size 304x448) depicts the north polar region, the other set (of size 316x332) depicts the south polar region.

    5. Note that the two errors for line 517 and 525 are caused by only one element. If we decided to eliminate one of the Raster_Object_Information elements, both errors would disappear.

  11. Now that we understand the error messages, re-run mp to generate output files in several useful formats.
    $ mp dds27.met -e dds27.err -h dds27.html -f dds27.faq.html -s dds27.sgml -d dds27.dif -t dds27.txt
    This generates the following files in the following formats:

    FAQFAQ-style hypertext markup languagedds27.faq.html
    HTMLHypertext markup languagedds27.html
    SGMLStandard generalized markup languagedds27.sgml
    DIFDirectory interchange formatdds27.dif
    (text)Indented textdds27.txt

    Examine each of these files. Note that the HTML, SGML, and text formats contain the same information, and the DIF record expresses some of the metadata in a different schema.

  12. This completes the exercise.

This page is <URL:http://geology.usgs.gov/usgs/gdinfo/nsdi/training/2a.html>
Maintained by Peter Schweitzer
Last updated Thursday, 10-May-2012 16:01:30 EDT