Extract Subdataset (Data Management)
Summary
Extracts raster datasets stored within a subdataset raster file.
Usage
-
This tool is useful since ArcCatalog is only able to preview the first subdataset within the parent file.
-
Subdataset file formats can be either Hierarchical Data Format (HDF) or National Imagery Transmission Format (NITF) files
-
The data structure allows the file format to consist of multiple datasets in one parent file. In addition, each of the subdatasets can consist of one band or multiple bands.
-
If you do not choose any subdatasets, the default will be to only return the first subdataset.
-
When storing your raster dataset to a JPEG or a JPEG 2000 file, you can specify the compression quality within the Raster Storage Settings in the Environment Settings dialog box.
-
The GIF format does not support multiband; therefore, it is not a valid output format unless your raster dataset is single band.
Syntax
Parameter | Explanation | Data Type |
in_raster |
The input subdataset raster format. Valid inputs can either be HDF or NITF files. | Raster Layer |
out_raster |
The name and extension of the raster dataset to be created. When storing the raster dataset in a file format, you need to specify the file extension:
When storing a raster dataset in a geodatabase, no file extension should be added to the name of the raster dataset. When storing your raster dataset to a JPEG file, a JPEG 2000 file, a TIFF file, or a geodatabase, you can specify a compression type and compression quality. | Raster Dataset |
subdataset_index [subdataset_index,...] (Optional) |
Define the subdatasets that you want to extract. | Value Table |
Code Sample
This is a Python sample for ExtractSubdataset
import arcpy
arcpy.ExtractSubDataset_management("c:/data/MyNITF.ntf","extracted.tif", "2")
This is a Python script sample for ExtractSubdataset
##====================================
##Extract Subdataset
##Usage: ExtractSubDataset_management in_raster out_raster {ID;ID...}
try:
import arcpy
arcpy.env.workspace = r"C:/Workspace"
##Extract 3-band subdataset from HDF
arcpy.ExtractSubDataset_management("MHDF.hdf", "subds.tif", "5;6;7")
##Extract 1-band subdataset from NITF
arcpy.ExtractSubDataset_management("MNITF.ntf","subds_ntf.tif", "2")
except:
print "Extract Subdataset example failed."
print arcpy.GetMessages()