User's Guide

NDFIN

Utility to read NDF format tapes and CDs.

Function:

Reads TM and MSS images from NLAPS Data Format (NDF) tapes and CD's and converts them to a LAS image. NDF Format revisions 1 and 2 are supported. Optionally, the NDF headers will be copied to disk and the associated DEM image will be converted to a LAS image.

Parameters:

COMMENT(--)
Description of tape(s) or CD(s). A text string sent to the operator's terminal. The operator uses this text to find the tape(s) or CD(s) to be mounted. Therefore, COMMENT should be as descriptive as possible. It should include both the ID number and a short description which allows the operator to ensure the correct media is mounted. If multiple media are specified the user must specify them so that the image data is in band sequential order. If the source media is disk, leave this field blank.

INFILE(--)
The full host pathname of the input image on disk or CD. If the source media is tape, leave this field blank.

OUT(--)
Output image(s). The number of images specified in OUT must either be one, equal to the number of bands specified in BANDS, or equal the number of entries in NBANDS. See User Note 4.

DEMOUT(--)
DEM output image name. If the DEM image is not specified, it willl not be generated.

BANDS(--)
Band numbers. List of band numbers to be placed into the LAS image(s). These will be sorted into ascending order in the groups defined by NBANDS. See User Note 4.

NBANDS(--)
Defines the number of bands to place in each output file. If NBANDS is specified, the number of entries must match the number of entries in OUT. If NBANDS is not specified, only one output image can be specified, or the number of entries in BANDS must equal the number of output images specified. See User Note 4.

WINDOW(--)
If UNITS is LS, the window specifies the start line, start sample, number of lines, and number of samples for the window. If only the start line and sample are entered, the number of lines and number of samples will default to the end of the image. If UNITS is not LS, the window specifies the upper left Y, upper left X, lower right Y, and lower right X coordinates. If the WINDOW is not specified, it defaults to the entire image. If a window is specified, it is applied to all of the bands.

UNITS(LS)
Units for the WINDOW parameter.

  = LS:  Line/Sample
  = DEG: Degrees
  = DMS: Degrees Minutes Seconds
           (+DDDMMMSSS.SS)
  = PRO: Projection coordinates

ODTYPE(SAME)
Output data type. The data type of the output images.

  = SAME: Same as input
  = BYTE: BYTE       (8-bit unsigned integer) 
  = I*2:  INTEGER*2  (16-bit signed integer) 
  = I*4:  INTEGER*4  (32-bit signed integer) 
  = R*4:  REAL*4     (32-bit signed real) 

WRTDSK(--)
Write Disk. Create associated files on disk from the related files on tape. All files contain ASCII data.

  = HST:  Create an associated processing history file.
  = WOR:  Create an associated work order processing file.
  = NHDR: Create an associated NDF header files.

Examples:

  1. LAS> ndfin comment=("please mount n0316", "please mount n0317", "please mount n0318") out=outfile bands=(1,3) window=(50,50,100,100) wrtdsk=nhdr

    NDF format tapes will be read starting with N0316 and ending with tape N0318. An image named OUTFILE that contains bands 1 and 3 will be written to the output image. Only the data within the window specified will be read for both bands. The output data type will default to the same data type as the input image since ODTYPE has not been specified. An associated file called outfile;hd (or outfile;h# where # is the resolution number for NDF version 2) containing the NDF header from the tape will be created.

  2. LAS> ndfin comment=("please mount tape n0316", "please mount tape m7761", "please mount tape z8661") out=outfile

    Since BANDS was not specified, NDFIN will convert all bands from the tapes into the LAS image OUTFILE. The entire scene will be placed in the output image since WINDOW is not specified.

  3. LAS> ndfin comment=("please mount n0316", "please mount c0456") out=(image1,image2,image3) bands=(1,2,6) window=(50,50) odtype=(byte)

    Bands 1, 2, and 6 are read from the two tapes specified and each placed in image1, image2, and image3, respectively. The starting line/sample of the output data will be 50,50 for each of the images and it will go to the bottom right corner of the image. The output data type will be BYTE regardless of the input data type.

  4. LAS> ndfin comment=("please mount cd0316", "please mount cd0317") infile=l71028029_02919910826 out=(image1,image2) bands=(1,2,3,4,6) nbands=(4,1) demout=dem

    NDF format CD's will be read starting with CD0316 and ending with CD0317. Files with the base name l71028029_02919910826 will be processed. Bands 1, 2, 3, and 4 are put into image1 and Band 6 is put into image2. The DEM image is also created.

  5. LAS> ndfin infile=data/inimage out=(image1,image2) bands=(1,2,3,4,6) nbands=(4,1) demout=dem

    Read the NDF format image from the subdirectory data. Files with the base name "inimage" will be processed. Bands 1, 2, 3, and 4 are put into image1 and Band 6 is put into image2. The DEM image is also created.

Description/Algorithm:

The specified tapes or CD's will be mounted in order to look for the requested bands (See User Note 3). As each band is found it is placed in the appropriate LAS image. If an error is encountered, the current media is dismounted and the application terminates. Each NDF tape will contain a header file followed by one or more image bands. The header is an ASCII file containing information about the bands present on the tape, the image size, projection parameters, scene corner points, satellite number, and instrument type. For version 2 of the NDF format, additional header files and image bands may appear after the first set of image bands.

Nonfatal Error Messages:

  1. [ndfin-data] Unable to locate <xxxxx>

    The information specified by <xxxxx> could not be located in the NDF header file. Information relating to this field will not be updated in the output DDR.

  2. [ndfin-spheroid] Error parsing <xxxxx>

    An error was encountered parsing the line <xxxxx> from the $LASTABLES/spheroid.txt file. The line was skipped and parsing of the file continued.

  3. [ndfin-datum] Warning: datum in NDF header is invalid

    The datum code in the NDF header is invalid. It may cause errors if windowing with projection coordinates.

  4. [ndfin-warning] Band <xxxxx> not found in input image

    The indicated band was requested by the user, but it was not found in the input image data.

  5. [ndfin-warning] DEM image not found on media - no DEM created

    The DEM image was not found on the input media so the requested DEM image was not created.

Fatal Error Messages:

  1. [ndfin-alloc] Error allocating dynamic memory

    An error was detected while trying to allocate dynamic memory. If the error persists contact the system administrator.

  2. [ndfin-data] Unable to locate <xxxxx>

    The information specified by <xxxxx> could not be located in the NDF header file. Conversion of the image is not possible without this field. Contact the system administrator.

  3. [ndfin-exists] Error: Image <XXXXX> already exists

    The image file name <XXXXX> currently exists. Re-run NDFIN specifing a different image name.

  4. [ndfin-fatal] Fatal error encountered

    A fatal error was encountered during processing. The error message that is displayed immediately preceding this message is the specific error that was encountered.

  5. [ndfin-invalid] Invalid specification of <xxxxx>

    There is a conflict in the number of values specified for either OUT or WINDOW/UNITS. OUT must specify one image file name to store all of the bands that are to be read, one image file name for each of the bands to be read, or one image file name for each entry in NBANDS.

    If the UNITS parameter is LS (line/sample), the WINDOW parameter must have 0, 2, or 4 parameters specified. For other values of UNITS, 0 or 4 WINDOW parameters must be specified.

  6. [ndfin-nbands] NBANDS has a different number of values than OUT

    If NBANDS is specified, it must have the same number of entries as the OUT parameter. Correct the input parameters and try again.

  7. [ndfin-tae] Error passing <xxxxx> to TAE

    An error occurred while attempting to pass variables back to TAE. If the error persists, see the system administrator.

  8. [ndfin-header] Error retrieving <xxxxx> from header file

    An error occurred while retrieving the variable <xxxxx> from the header file on tape. See the system administrator.

  9. [ndfin-env] <xxxxx> not defined

    The environment variable <xxxxx> was not defined. Define it and restart NDFIN.

  10. [ndfin-file] Unable to open <xxxxx>

    The file <xxxxx> could not be opened. Verify the file exists and that permissions are set properly.

  11. [ndfin-hostname] Error reading the hostname

    The hostname could not be obtained. See the system administrator.

  12. [ndfin-file] Error getting size of <xxxxx>

    An error occurred reading the size of the file <xxxxx>. Make sure the file exists and permissions are set correctly.

  13. [ndfin-file] Error reading <xxxxx>

    An error occurred reading from the file <xxxxx>. See the system administrator.

  14. [ndfin-file] Error writing <xxxxx>

    An error occurred writing to the file <xxxxx>. Verify permissions are set properly and there is enough space on the destination disk.

  15. [ndfin-media] Error encountered <xxxxx> media

    The error <xxxxx> occurred while attempting to operate on the media. See the system administrator.

  16. [ndfin-media] Unexpected file found on the tape

    An unexpected file was found on the tape. Verify the tape is really in the NDF format.

  17. [filesize-error] Error encountered reading size of <xxxxx>

    An error occurred reading the size of file <xxxxx>. Verify permissions are set properly.

  18. [ndfin-size] Too many entries for <xxxxx>

    A size of the data structure <xxxxx> was too small. See the system administrator.

  19. [ndfin-file] Error copying file <xxxxx> to <yyyyy>

    File <xxxxx> could not be copied to file <yyyyy>. Verify the file names are valid and permissions are set correctly.

  20. [ndfin-comment] Either COMMENT or INFILE must be specified

    Either the COMMENT or the INFILE parameter need to be specified so the input data can be found (or both if reading a CD).

  21. [ndfin-out] No output files specified

    Either OUT or DEMOUT (or both) needs to be specified so the correct output files can be created.

  22. [ndfin-nbands] NBANDS has a different number of values than OUT

    NBANDS was specified with a different number of entries than the OUT parameter contains. If NBANDS is specified, it must have the same number of entries as OUT.

  23. [ndfin-nullbands] BANDS must be specified if NBANDS is specified

    NBANDS was specified but BANDS was not. If NBANDS is specified, BANDS must also be specified.

  24. [ndfin-badbnd] Discrepancy between BANDS and NBANDS

    When both BANDS and NBANDS are specified, the number of entries in BANDS must equal the sum of the entries in NBANDS.

  25. [ndfin-tape] Unexpected tape change

    The TPIN application issued a tape mount request and switched which tape was mounted. If this happens, the tape being read does not conform to the expected NDF format.

  26. [ndfin-format] Multiple OUT files not supported with BIL format on tape

    Multiple output files were requested for a tape with BIL data. This is not supported. Specify a single OUT file and try again.

  27. [ndfin-filename] Filename <xxx> read from <yyy> is not legal

    The band filename <xxx> read from NDF header file <yyy> is not a legal filename. This is generally caused by an incorrect extension on the filename. The band filenames in the NDF header should end in an extension ".i#".

User Notes:

  1. If a multiple band image is created, the WINDOW only needs to be specified once.

  2. Only those tapes or CD's that contain the requested bands need to be specified. If additional tapes or CD's are specified, NDFIN will sequentially process each tape or CD looking for the requested bands.

  3. A description of the NDF header format can be found in the National Landsat Archive Production System (NLAPS) Data Format Specification, Ver 1.0, 28 July 1995, and Ver 2.0, 26, October, 1998.

  4. The parameters BANDS, NBANDS, and OUT are related to each other. OUT specifies the output file names to use, BANDS indicates which bands should be taken from the input image, and NBANDS indicates the number of entries in BANDS that should be grouped into each OUT file specified. For example, if BANDS=(1,3,2,4) and NBANDS=(2,1,1), OUT must contain three file names (to match the number of entries in NBANDS) and the first output file will contain bands 1 and 3, the second will contain band 2, and the third will contain band 4. If NBANDS is specified, BANDS must be specified and the number of bands in BANDS must equal the sum of the bands in NBANDS. If NBANDS isn't specifed, OUT must contain a single file name, or contain as many file names as there are BANDS requested.

  5. During the process of ingesting data, unique file names are generated to accommodate multiple resolutions and multiple volumes. The file names are generated by attaching "_r#" for different resolution numbers and "_vol#" for different volume numbers (where # is the number of the current resolution or volume). After all the volumes have been ingested, the "_vol#" files are merged together.
  6. Copying multi-volume CD's to disk and processing the data from there is possible. However, NDF header files with the same name but different contents can appear on more than one CD. When these header files are copied to disk, append "_vol#" to the name to make them unique. The "_vol#" must be used, nothing else is allowed. For example, if the file l71234.h1 appears on volume 1 and volume 2, the volume 1 header file should be named l71234_vol1.h1 on disk and the volume 2 header file should be named l71234_vol2.h1 on disk.