ArcToolbox banner

Find SIR Files and Convert To ArcGIS Rasters

Finds SIR files in a directory and converts them to ArcGIS rasters.


Command line syntax

SIRFileFindAndConvertToArcGISRasters_GeoEco <inputDirectory> <outputWorkspace> {wildcard} {searchTree} {minSize} {maxSize} {minDateCreated} {maxDateCreated} {minDateModified} {maxDateModified} {projectedCoordinateSystem} {geographicTransformation} {NEAREST | BILINEAR | CUBIC} {projectedCellSize} {registrationPoint} {clippingRectangle} {mapAlgebraExpression} {buildPyramids} {outputRasterPythonExpression} {modulesToImport;modulesToImport...} {skipExisting}

Parameters
ExpressionExplanation
<inputDirectory>

Directory to search.

<outputWorkspace>

Workspace to receive the ArcGIS rasters.

{wildcard}

UNIX-style "glob" wildcard expression specifying the pathnames to find.

The glob syntax supports the following patterns:

  • ? - matches any single character

  • * - matches zero or more characters

  • [seq] - matches any single character in seq

  • [!seq] - matches any single character not in seq

seq is one or more characters, such as abc. You may specify character ranges using a dash. For example, a-z0-9 specifies all of the characters in the English alphabet and the decimal digits 0 through 9.

You may specify subdirectories in the glob expression. For example, the expression cruise*/sst* will find all paths beginning with sst that are contained in directories beginning with cruise.

The operating system determines whether / or \ is used as the directory separator. On Windows, both will work. On most flavors of UNIX, / must be used.

The operating system determines if matching is case sensitive. On Windows, matching is case-insensitive. On most flavors of UNIX, matching is case-sensitive.

{searchTree}

If True, subdirectories will be searched.

{minSize}

Minimum size, in bytes, of files to find. If provided, only files that are this size or larger will be found.

{maxSize}

Maximum size, in bytes, of files to find. If provided, only files that are this size or smaller will be found.

{minDateCreated}

Minimum creation date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were created on or after this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.

{maxDateCreated}

Maximum creation date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were created on or before this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.

{minDateModified}

Minimum modification date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were modified on or after this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.

{maxDateModified}

Maximum modification date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were modified on or before this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.

{projectedCoordinateSystem}

New coordinate system to project the output raster to.

The raster may only be projected to a new coordinate system if the original projection is defined. An error will be raised if you specify a new coordinate system without defining the original coordinate system.

The ArcGIS Project Raster tool is used to perform the projection. The documentation for that tool recommends that you also specify a cell size for the new coordinate system.

I have noticed that for certain coordinate systems the ArcGIS 9.2 Project Raster tool seems to clip the projected raster to an arbitrary extent that is too small. For example, when projecting a global MODIS Aqua 4 km chlorophyll image in geographic coordinates to Lambert_Azimuthal_Equal_Area with central meridian of -60 and latitude of origin of -63, the resulting image is clipped to show only one-quarter of the planet. This problem does not occur when Project Raster is invoked interactively from the ArcGIS user interface; it only occurs when the tool is invoked programmatically (the ProjectRaster_management method of the geoprocessor). Thus you may not see it when you use Project Raster yourself but it may happen when you use MGET tools that invoke Project Raster as part of their geoprocessing operations.

If you encounter this problem, you can work around it like this:

  • First, run this tool without specifying a new coordinate system, to obtain the output raster in the original coordinate system.

  • In ArcCatalog, use the Project Raster tool to project the raster to the new coordinate system. Verify that the entire raster is present, that it has not been clipped to an extent that is too small.

  • In ArcCatalog, look up the extent of the projected raster by right-clicking on it in the catalog tree, selecting Properties, and scrolling down to Extent.

  • Now, before running the MGET tool that projects the raster, set the Extent environment setting to the values you looked up. If you are invoking the MGET tool interactively from ArcCatalog or ArcMap, click the Environments button on the tool's dialog box, open General Settings, change the Extent drop-down to "As Specified Below", and type in the values you looked up. If you're invoking it from a geoprocessing model, right-click on the tool in the model, select Make Variable, From Environment, General Settings, Extent. This will place Extent as a variable in your model, attached to the MGET tool. Open the Extent variable, change it to "As Specified Below" and type in the values you looked up. If you're invoking the MGET tool programmatically, you must set the Extent property of the geoprocessor to the values you looked up. Please see the ArcGIS documentation for more information about this and Environment settings in general.

  • Run the MGET tool. The extent of the output raster should now be the proper size.

{geographicTransformation}

A transformation method used to convert between the original coordinate system and the new coordinate system.

This parameter is a new option introduced by ArcGIS 9.2. You must have ArcGIS 9.2 to use this parameter.

This parameter is only needed when you specify that the raster should be projected to a new coordinate system and that new system uses a different datum than the original coordinate system, or there is some other difference between the two coordinate systems that requires a transformation. To determine if a transformation is needed, I recommend the following procedure:

  • First, run this tool without specifying a new coordinate system, to obtain the output raster in the original coordinate system.

  • Next, use the ArcGIS 9.2 Project Raster tool on the output raster to project it to the desired coordinate system. If a geographic transformation is needed, that tool will prompt you for one. Write down the exact name of the transformation you used.

  • Finally, if a transformation was needed, type in the exact name into this tool, rerun it, and verify that the output raster was projected as you desired.

{NEAREST | BILINEAR | CUBIC}

The resampling algorithm to be used to project the original raster to a new coordinate system. The ArcGIS Project Raster tool is used to perform the projection and accepts the following values:

  • NEAREST - nearest neighbor interpolation

  • BILINEAR - bilinear interpolation

  • CUBIC - cubic convolution

You must specify one of these algorithms to project to a new coordinate system. An error will be raised if you specify a new coordinate system without selecting an algorithm.

{projectedCellSize}

The cell size of the projected coordinate system. Although this parameter is optional, to receive the best results, the ArcGIS documentation recommends you always specify it when projecting to a new coordinate system.

{registrationPoint}

The x and y coordinates (in the output space) used for pixel alignment.

This parameter is a new option introduced by ArcGIS 9.2. You must have ArcGIS 9.2 to use this parameter. It is ignored if you do not specify that the raster should be projected to a new coordinate system.

{clippingRectangle}

Rectangle to which the raster should be clipped.

If a projected coordinate system was specified, the clipping is performed after the projection and the rectangle's coordinates should be specified in the new coordinate system. If no projected coordinate system was specified, the coordinates should be specified in the original coordinate system.

The ArcGIS Clip tool is used to perfom the clip. The clipping rectangle must be passed to this tool as a string of four numbers separated by spaces. The ArcGIS user interface automatically formats the string properly; when invoking this tool from the ArcGIS UI, you need not worry about the format. But when invoking it programmatically, take care to provide a properly-formatted string. The numbers are ordered LEFT, BOTTOM, RIGHT, TOP. For example, if the raster is in a geographic coordinate system, it may be clipped to 10 W, 15 S, 20 E, and 25 N with the string:

10 15 20 25

Integers or decimal numbers may be provided.

{mapAlgebraExpression}

Map algebra expression to execute on the output raster.

WARNING: The ArcGIS Geoprocessing Model Builder may randomly and silently delete the value of this parameter. This is a bug in ArcGIS. Before running a model that you have saved, open this tool and validate that the parameter value still exists.

The expression is executed after the converted raster is projected and clipped (if those options are specified). Use the case-sensitive string inputRaster to represent the raster that you now want to perform map algebra upon. For example, to convert the raster to an integer raster and add 1 to all of the cells, use this expression:

int(inputRaster) + 1

The string inputRaster is case-sensitive. Prior to executing the map algebra expression, the string is replaced with the path to a temporary raster that represents the output raster being generated. The final expression must be less than 4000 characters long or ArcGIS will report an error.

The ArcGIS Single Output Map Algebra tool is used to execute the map algebra expression. You must have a license for the ArcGIS Spatial Analyst extension in order to perform map algebra.

Map algebra syntax can be very picky. Here are some tips that will help you succeed with this tool:

  • Before using this tool, construct and test out your map algebra expression using the ArcGIS Single Output Map Algebra tool. Then paste the expression into this tool and edit it to use the inputRaster variable rather than the test value you used with Single Output Map Algebra.

  • If you do develop your expression directly in this tool, start with a very simple expression. Verify that it works properly, add a little to it, and verify again. Repeat this process until you have built up the complete expression.

  • Always separate mathematical operators from raster paths using spaces. In the example above, the / operator contains a space on either side. Follow this pattern. In some circumstances, ArcGIS will fail to process raster algebra expressions that do not separate raster paths from operators using spaces. The reported error message usually does not indicate that this is the problem, and tracking it down can be very frustrating.

{buildPyramids}

If True, pyramids will be built for the output raster, which will improve its display speed in the ArcGIS user interface. This is the last step performed in post-conversion processing.

{outputRasterPythonExpression}

Python expression used to calculate the absolute path of an output raster. The expression may be any Python statement appropriate for passing to the eval function and must return a Unicode string. The expression may reference the following variables:

  • directoryToSearch - the value provided for the directory to search parameter

  • outputWorkspace - the value provided for the output workspace parameter

  • inputFile - the absolute path to the input SIR file

  • metadata - a dictionary of SIR metadata extracted from the file (see below)

The default expression:

os.path.join(outputWorkspace, os.path.basename(inputFile).split('-')[0], os.path.basename(inputFile).split('-')[2][:3], str(metadata['Year']), os.path.basename(inputFile).split('-')[0] + str(metadata['Year']) + str(metadata['FirstDay']) + os.path.basename(inputFile).split('-')[1])

stores the raster in the output workspace in nested subdirectories according to the product type, region name, and year. For example, the file C:SIRqusv-a-Aus00-153-156.sir with output workspace C:Rasters would be stored as C:RastersqusvAus2000qusv2000153a. Note that the default expression extracts parts of the file name so it may not work with files that are named using a different scheme. The expression also assumes that the output workspace is a directory in the file system (rather than an Arc SDE database, for example).

The following keys are available in the metadata dictionary. The Python data type of the value for the key appears in parentheses. Remember that if the value is not a string, you must convert it to one before you can use it in Python's os.path function:

  • 'HeaderType' (int) - header type for the file. For example, SIR format version 3.1 files have a header type of 31.

  • 'Title' (str) - title of the file, for example "SIRF image of australia".

  • 'Sensor' (str) - satellite sensor that collected the data, for example "QuikScat L1B".

  • 'Tag' (str) - tag for the file, usually a statement such as "(c) 2001 BYU MERS Laboratory".

  • 'Creator' (str) - information about the creator of the file, for example "BYU MERS:sea_meta_sirf_slice v7.2 Ai= -8.40 Bc=0.140 IRef=54.2 It=50".

  • 'Created' (str) - date and time the file was created, for example "12:36:06 08/04/01". I am not sure if this format is used consistently.

  • 'Columns' (int) - number of columns in the image.

  • 'Rows' (int) - number of rows in the image.

  • 'Scale' (int) - scale factor used to scale integers stored in the file to floating-point numbers that are the real values.

  • 'Offset' (int) - offset used to scale integers stored in the file to floating-point numbers that are the real values.

  • 'Year' (int) - four digit year of the image.

  • 'FirstDay' (int) - day of the year (julian day) that the image starts. For example, if the image starts on February 2, FirstDay will be 33.

  • 'LastDay' (int) - day of the year (julian day) that the image ends. For example, if it is a four-day image starting on February 2, LastDay will be 37 (February 5).

  • 'Region' (int) - integer code representing the region of the image. For example, code 214 is the Australia region.

  • 'RegionName' (str) - abbreviated name for the region of the image, such as "Aus" for the Australia region. The tool has a hard-coded list region names, and looks up the name using the region code. There are many regions and the tool probably does not know the names of all of them. When it encounters an unknown region, the RegionName will be "Unknown".

  • 'ImageType' (int) - image type code. BYU MERS documentation defines the following type codes:

    • 0 - Unknown

    • 1 - Scatterometer A (dB)

    • 2 - Scatterometer B (dB/deg)

    • 3 - Radiometer Tb (K)

    • 9 - Topography (m)

  • 'ImageTypeName' (str) - the descriptive name of the image type, as it appears above, or "Unknown" if the ImageType is not one of the codes listed above.

  • 'ProjectionType' (int) - projection type code. BYU MERS documentation defines the following type codes:

    • -1 - No projection defined

    • 0 - Rectangular geographic

    • 1 - Lambert equal area, fixed radius

    • 2 - Lambert equal area, local radius

    • 5 - Polar sterographic

    • 11 - EASE north equal area grid

    • 12 - EASE south equal area grid

    • 13 - EASE cylindrical grid

  • 'ProjectionName' (str) - the descriptive name of the projection, as it appears above, or "Unknown" if the ProjectionType is not one of the codes listed above.

  • 'xDeg' (float) - "span of X" for the projection. For Lambert projections, this is the central meridan of the projection, in degrees.

  • 'yDeg' (float) - "span of Y" for the projection. For Lambert projections, this is the latitude of the origin, in degrees.

  • 'aScale' (float) - "scale for X" for the projection. For Lambert projections, this is the inverse of the cell size, in kilometers. (To get the cell size in meters, invert and multiply by 1000.)

  • 'bScale' (float) - "scale for Y" for the projection. For Lambert projections, this is the inverse of the cell size, in kilometers. (To get the cell size in meters, invert and multiply by 1000.)

  • 'a0' (float) - X coordinate of the "origin" for the projection. For Lambert projections, this is the X coordinate of the lower-left corner, in kilometers (multiply by 1000 to get meters).

  • 'b0' (float) - Y coordinate of the "origin" for the projection. For Lambert projections, this is the X coordinate of the lower-left corner, in kilometers (multiply by 1000 to get meters).

  • 'Polarization' (int) - polarization of the image. BYU MERS documentation defines the following type codes:

    • 0 - n/a

    • 1 - H

    • 2 - V

  • 'Frequency' (float) - frequency, in MHz (I think).

  • 'DataType' (int) - data type used internally in the file. Typically, even if integers are used internally in the file, the scale and offset be automatically applied to convert these to floating-point values before they are returned. BYU MERS documentation defines the following codes:

    • 0 or 2 - signed 16-bit integers. The documentation says this is considered the "SIR standard format".

    • 1 - signed 8-bit integers.

    • 3 - floating point (the documentation does specify the width).

  • 'Headers' (int) - number of 512 byte header blocks in the file.

  • 'NoDataValue' (float) - the NoData value used in the file. For files containing sigma-0 data, this is usually -33.0.

  • 'Description' (str) - a "description" of the file.

  • 'ExtraInts' (int) - number of "extra integers" in the file.

  • 'MinValue' (float) - minimum pixel value for the file.

  • 'MaxValue' (float) - maximum pixel value for the file.

For more information on Python syntax, please see the Python documentation <http://www.python.org/doc/>

{modulesToImport;modulesToImport...}

Python modules to import prior to evaluating the expression. If you need to access Python functions or classes that are provided by a module rather than being built-in to the interpreter, list the module here. For example, to be able to use the datetime class in your expression, list the datetime module here. In your expression, you must refer to the class using its fully-qualified name, datetime.datetime.

{skipExisting}

If True, conversion will be skipped for output rasters that already exist.

Scripting syntax

SIRFileFindAndConvertToArcGISRasters_GeoEco (inputDirectory, outputWorkspace, wildcard, searchTree, minSize, maxSize, minDateCreated, maxDateCreated, minDateModified, maxDateModified, projectedCoordinateSystem, geographicTransformation, resamplingTechnique, projectedCellSize, registrationPoint, clippingRectangle, mapAlgebraExpression, buildPyramids, outputRasterPythonExpression, modulesToImport, skipExisting)

Parameters
ExpressionExplanation
Directory to search (Required)

Directory to search.

Output workspace (Required)

Workspace to receive the ArcGIS rasters.

Wildcard expression (Optional)

UNIX-style "glob" wildcard expression specifying the pathnames to find.

The glob syntax supports the following patterns:

  • ? - matches any single character

  • * - matches zero or more characters

  • [seq] - matches any single character in seq

  • [!seq] - matches any single character not in seq

seq is one or more characters, such as abc. You may specify character ranges using a dash. For example, a-z0-9 specifies all of the characters in the English alphabet and the decimal digits 0 through 9.

You may specify subdirectories in the glob expression. For example, the expression cruise*/sst* will find all paths beginning with sst that are contained in directories beginning with cruise.

The operating system determines whether / or \ is used as the directory separator. On Windows, both will work. On most flavors of UNIX, / must be used.

The operating system determines if matching is case sensitive. On Windows, matching is case-insensitive. On most flavors of UNIX, matching is case-sensitive.

Search directory tree (Optional)

If True, subdirectories will be searched.

Minimum size (Optional)

Minimum size, in bytes, of files to find. If provided, only files that are this size or larger will be found.

Maximum size (Optional)

Maximum size, in bytes, of files to find. If provided, only files that are this size or smaller will be found.

Minimum creation date (Optional)

Minimum creation date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were created on or after this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.

Maximum creation date (Optional)

Maximum creation date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were created on or before this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.

Minimum modification date (Optional)

Minimum modification date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were modified on or after this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.

Maximum modification date (Optional)

Maximum modification date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were modified on or before this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.

Project to new coordinate system (Optional)

New coordinate system to project the output raster to.

The raster may only be projected to a new coordinate system if the original projection is defined. An error will be raised if you specify a new coordinate system without defining the original coordinate system.

The ArcGIS Project Raster tool is used to perform the projection. The documentation for that tool recommends that you also specify a cell size for the new coordinate system.

I have noticed that for certain coordinate systems the ArcGIS 9.2 Project Raster tool seems to clip the projected raster to an arbitrary extent that is too small. For example, when projecting a global MODIS Aqua 4 km chlorophyll image in geographic coordinates to Lambert_Azimuthal_Equal_Area with central meridian of -60 and latitude of origin of -63, the resulting image is clipped to show only one-quarter of the planet. This problem does not occur when Project Raster is invoked interactively from the ArcGIS user interface; it only occurs when the tool is invoked programmatically (the ProjectRaster_management method of the geoprocessor). Thus you may not see it when you use Project Raster yourself but it may happen when you use MGET tools that invoke Project Raster as part of their geoprocessing operations.

If you encounter this problem, you can work around it like this:

  • First, run this tool without specifying a new coordinate system, to obtain the output raster in the original coordinate system.

  • In ArcCatalog, use the Project Raster tool to project the raster to the new coordinate system. Verify that the entire raster is present, that it has not been clipped to an extent that is too small.

  • In ArcCatalog, look up the extent of the projected raster by right-clicking on it in the catalog tree, selecting Properties, and scrolling down to Extent.

  • Now, before running the MGET tool that projects the raster, set the Extent environment setting to the values you looked up. If you are invoking the MGET tool interactively from ArcCatalog or ArcMap, click the Environments button on the tool's dialog box, open General Settings, change the Extent drop-down to "As Specified Below", and type in the values you looked up. If you're invoking it from a geoprocessing model, right-click on the tool in the model, select Make Variable, From Environment, General Settings, Extent. This will place Extent as a variable in your model, attached to the MGET tool. Open the Extent variable, change it to "As Specified Below" and type in the values you looked up. If you're invoking the MGET tool programmatically, you must set the Extent property of the geoprocessor to the values you looked up. Please see the ArcGIS documentation for more information about this and Environment settings in general.

  • Run the MGET tool. The extent of the output raster should now be the proper size.

Geographic transformation (Optional)

A transformation method used to convert between the original coordinate system and the new coordinate system.

This parameter is a new option introduced by ArcGIS 9.2. You must have ArcGIS 9.2 to use this parameter.

This parameter is only needed when you specify that the raster should be projected to a new coordinate system and that new system uses a different datum than the original coordinate system, or there is some other difference between the two coordinate systems that requires a transformation. To determine if a transformation is needed, I recommend the following procedure:

  • First, run this tool without specifying a new coordinate system, to obtain the output raster in the original coordinate system.

  • Next, use the ArcGIS 9.2 Project Raster tool on the output raster to project it to the desired coordinate system. If a geographic transformation is needed, that tool will prompt you for one. Write down the exact name of the transformation you used.

  • Finally, if a transformation was needed, type in the exact name into this tool, rerun it, and verify that the output raster was projected as you desired.

Projection resampling technique (Optional)

The resampling algorithm to be used to project the original raster to a new coordinate system. The ArcGIS Project Raster tool is used to perform the projection and accepts the following values:

  • NEAREST - nearest neighbor interpolation

  • BILINEAR - bilinear interpolation

  • CUBIC - cubic convolution

You must specify one of these algorithms to project to a new coordinate system. An error will be raised if you specify a new coordinate system without selecting an algorithm.

Cell size for projected coordinate system (Optional)

The cell size of the projected coordinate system. Although this parameter is optional, to receive the best results, the ArcGIS documentation recommends you always specify it when projecting to a new coordinate system.

Registration point for projected coordinate system (Optional)

The x and y coordinates (in the output space) used for pixel alignment.

This parameter is a new option introduced by ArcGIS 9.2. You must have ArcGIS 9.2 to use this parameter. It is ignored if you do not specify that the raster should be projected to a new coordinate system.

Clip to rectangle (Optional)

Rectangle to which the raster should be clipped.

If a projected coordinate system was specified, the clipping is performed after the projection and the rectangle's coordinates should be specified in the new coordinate system. If no projected coordinate system was specified, the coordinates should be specified in the original coordinate system.

The ArcGIS Clip tool is used to perfom the clip. The clipping rectangle must be passed to this tool as a string of four numbers separated by spaces. The ArcGIS user interface automatically formats the string properly; when invoking this tool from the ArcGIS UI, you need not worry about the format. But when invoking it programmatically, take care to provide a properly-formatted string. The numbers are ordered LEFT, BOTTOM, RIGHT, TOP. For example, if the raster is in a geographic coordinate system, it may be clipped to 10 W, 15 S, 20 E, and 25 N with the string:

10 15 20 25

Integers or decimal numbers may be provided.

Execute map algebra expression (Optional)

Map algebra expression to execute on the output raster.

WARNING: The ArcGIS Geoprocessing Model Builder may randomly and silently delete the value of this parameter. This is a bug in ArcGIS. Before running a model that you have saved, open this tool and validate that the parameter value still exists.

The expression is executed after the converted raster is projected and clipped (if those options are specified). Use the case-sensitive string inputRaster to represent the raster that you now want to perform map algebra upon. For example, to convert the raster to an integer raster and add 1 to all of the cells, use this expression:

int(inputRaster) + 1

The string inputRaster is case-sensitive. Prior to executing the map algebra expression, the string is replaced with the path to a temporary raster that represents the output raster being generated. The final expression must be less than 4000 characters long or ArcGIS will report an error.

The ArcGIS Single Output Map Algebra tool is used to execute the map algebra expression. You must have a license for the ArcGIS Spatial Analyst extension in order to perform map algebra.

Map algebra syntax can be very picky. Here are some tips that will help you succeed with this tool:

  • Before using this tool, construct and test out your map algebra expression using the ArcGIS Single Output Map Algebra tool. Then paste the expression into this tool and edit it to use the inputRaster variable rather than the test value you used with Single Output Map Algebra.

  • If you do develop your expression directly in this tool, start with a very simple expression. Verify that it works properly, add a little to it, and verify again. Repeat this process until you have built up the complete expression.

  • Always separate mathematical operators from raster paths using spaces. In the example above, the / operator contains a space on either side. Follow this pattern. In some circumstances, ArcGIS will fail to process raster algebra expressions that do not separate raster paths from operators using spaces. The reported error message usually does not indicate that this is the problem, and tracking it down can be very frustrating.

Build pyramids (Optional)

If True, pyramids will be built for the output raster, which will improve its display speed in the ArcGIS user interface. This is the last step performed in post-conversion processing.

Output ArcGIS raster Python expression (Optional)

Python expression used to calculate the absolute path of an output raster. The expression may be any Python statement appropriate for passing to the eval function and must return a Unicode string. The expression may reference the following variables:

  • directoryToSearch - the value provided for the directory to search parameter

  • outputWorkspace - the value provided for the output workspace parameter

  • inputFile - the absolute path to the input SIR file

  • metadata - a dictionary of SIR metadata extracted from the file (see below)

The default expression:

os.path.join(outputWorkspace, os.path.basename(inputFile).split('-')[0], os.path.basename(inputFile).split('-')[2][:3], str(metadata['Year']), os.path.basename(inputFile).split('-')[0] + str(metadata['Year']) + str(metadata['FirstDay']) + os.path.basename(inputFile).split('-')[1])

stores the raster in the output workspace in nested subdirectories according to the product type, region name, and year. For example, the file C:SIRqusv-a-Aus00-153-156.sir with output workspace C:Rasters would be stored as C:RastersqusvAus2000qusv2000153a. Note that the default expression extracts parts of the file name so it may not work with files that are named using a different scheme. The expression also assumes that the output workspace is a directory in the file system (rather than an Arc SDE database, for example).

The following keys are available in the metadata dictionary. The Python data type of the value for the key appears in parentheses. Remember that if the value is not a string, you must convert it to one before you can use it in Python's os.path function:

  • 'HeaderType' (int) - header type for the file. For example, SIR format version 3.1 files have a header type of 31.

  • 'Title' (str) - title of the file, for example "SIRF image of australia".

  • 'Sensor' (str) - satellite sensor that collected the data, for example "QuikScat L1B".

  • 'Tag' (str) - tag for the file, usually a statement such as "(c) 2001 BYU MERS Laboratory".

  • 'Creator' (str) - information about the creator of the file, for example "BYU MERS:sea_meta_sirf_slice v7.2 Ai= -8.40 Bc=0.140 IRef=54.2 It=50".

  • 'Created' (str) - date and time the file was created, for example "12:36:06 08/04/01". I am not sure if this format is used consistently.

  • 'Columns' (int) - number of columns in the image.

  • 'Rows' (int) - number of rows in the image.

  • 'Scale' (int) - scale factor used to scale integers stored in the file to floating-point numbers that are the real values.

  • 'Offset' (int) - offset used to scale integers stored in the file to floating-point numbers that are the real values.

  • 'Year' (int) - four digit year of the image.

  • 'FirstDay' (int) - day of the year (julian day) that the image starts. For example, if the image starts on February 2, FirstDay will be 33.

  • 'LastDay' (int) - day of the year (julian day) that the image ends. For example, if it is a four-day image starting on February 2, LastDay will be 37 (February 5).

  • 'Region' (int) - integer code representing the region of the image. For example, code 214 is the Australia region.

  • 'RegionName' (str) - abbreviated name for the region of the image, such as "Aus" for the Australia region. The tool has a hard-coded list region names, and looks up the name using the region code. There are many regions and the tool probably does not know the names of all of them. When it encounters an unknown region, the RegionName will be "Unknown".

  • 'ImageType' (int) - image type code. BYU MERS documentation defines the following type codes:

    • 0 - Unknown

    • 1 - Scatterometer A (dB)

    • 2 - Scatterometer B (dB/deg)

    • 3 - Radiometer Tb (K)

    • 9 - Topography (m)

  • 'ImageTypeName' (str) - the descriptive name of the image type, as it appears above, or "Unknown" if the ImageType is not one of the codes listed above.

  • 'ProjectionType' (int) - projection type code. BYU MERS documentation defines the following type codes:

    • -1 - No projection defined

    • 0 - Rectangular geographic

    • 1 - Lambert equal area, fixed radius

    • 2 - Lambert equal area, local radius

    • 5 - Polar sterographic

    • 11 - EASE north equal area grid

    • 12 - EASE south equal area grid

    • 13 - EASE cylindrical grid

  • 'ProjectionName' (str) - the descriptive name of the projection, as it appears above, or "Unknown" if the ProjectionType is not one of the codes listed above.

  • 'xDeg' (float) - "span of X" for the projection. For Lambert projections, this is the central meridan of the projection, in degrees.

  • 'yDeg' (float) - "span of Y" for the projection. For Lambert projections, this is the latitude of the origin, in degrees.

  • 'aScale' (float) - "scale for X" for the projection. For Lambert projections, this is the inverse of the cell size, in kilometers. (To get the cell size in meters, invert and multiply by 1000.)

  • 'bScale' (float) - "scale for Y" for the projection. For Lambert projections, this is the inverse of the cell size, in kilometers. (To get the cell size in meters, invert and multiply by 1000.)

  • 'a0' (float) - X coordinate of the "origin" for the projection. For Lambert projections, this is the X coordinate of the lower-left corner, in kilometers (multiply by 1000 to get meters).

  • 'b0' (float) - Y coordinate of the "origin" for the projection. For Lambert projections, this is the X coordinate of the lower-left corner, in kilometers (multiply by 1000 to get meters).

  • 'Polarization' (int) - polarization of the image. BYU MERS documentation defines the following type codes:

    • 0 - n/a

    • 1 - H

    • 2 - V

  • 'Frequency' (float) - frequency, in MHz (I think).

  • 'DataType' (int) - data type used internally in the file. Typically, even if integers are used internally in the file, the scale and offset be automatically applied to convert these to floating-point values before they are returned. BYU MERS documentation defines the following codes:

    • 0 or 2 - signed 16-bit integers. The documentation says this is considered the "SIR standard format".

    • 1 - signed 8-bit integers.

    • 3 - floating point (the documentation does specify the width).

  • 'Headers' (int) - number of 512 byte header blocks in the file.

  • 'NoDataValue' (float) - the NoData value used in the file. For files containing sigma-0 data, this is usually -33.0.

  • 'Description' (str) - a "description" of the file.

  • 'ExtraInts' (int) - number of "extra integers" in the file.

  • 'MinValue' (float) - minimum pixel value for the file.

  • 'MaxValue' (float) - maximum pixel value for the file.

For more information on Python syntax, please see the Python documentation <http://www.python.org/doc/>

Python modules to import (Optional)

Python modules to import prior to evaluating the expression. If you need to access Python functions or classes that are provided by a module rather than being built-in to the interpreter, list the module here. For example, to be able to use the datetime class in your expression, list the datetime module here. In your expression, you must refer to the class using its fully-qualified name, datetime.datetime.

Skip existing outputs (Optional)

If True, conversion will be skipped for output rasters that already exist.