Extract Subdataset (Data Management)

License Level:BasicStandardAdvanced

Summary

Extracts raster datasets stored within a subdataset raster file.

Usage

Syntax

ExtractSubdataset_management (in_raster, out_raster, {subdataset_index})
ParameterExplanationData 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:

  • .bil—ESRI BIL
  • .bip—ESRI BIP
  • .bmp—BMP
  • .bsq—ESRI BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE file
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • no extension—ESRI GRID.

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

ExtractSubdataset example 1 (Python window)

This is a Python sample for ExtractSubdataset

import arcpy
arcpy.ExtractSubDataset_management("c:/data/MyNITF.ntf","extracted.tif", "2")
ExtractSubdataset example 2 (stand-alone script)

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()

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013