UnitConversion

サマリー

Converts pixels from one unit to another. It supports conversion of distance, speed, and temperature.

説明

For more information about how this function works, see the Unit Conversion raster function.

The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.

構文

UnitConversion (raster, {from_unit}, {to_unit})
パラメーター説明データ タイプ
raster

The input raster that will contain the converted units.

Raster
from_unit

The original unit type of the pixels.

  • MetersPerSecondMeters per second
  • KilometersPerHourKilometers per hour
  • KnotsKnots
  • FeetPerSecondFeet per second
  • MilesPerHourMiles per hour
  • CelsiusCelsius
  • FahrenheitFahrenheit
  • KelvinKelvin
  • inchesInches
  • FeetFeet
  • YardsYards
  • MilesMiles
  • NauticalMilesNautical miles
  • MillimetersMillimeters
  • CentimetersCentimeters
  • MetersMeters

(デフォルト値は次のとおりです None)

String
to_unit

The converted unit type of the pixels.

  • MetersPerSecondMeters per second
  • KilometersPerHourKilometers per hour
  • KnotsKnots
  • FeetPerSecondFeet per second
  • MilesPerHourMiles per hour
  • CelsiusCelsius
  • FahrenheitFahrenheit
  • KelvinKelvin
  • inchesInches
  • FeetFeet
  • YardsYards
  • MilesMiles
  • NauticalMilesNautical miles
  • MillimetersMillimeters
  • CentimetersCentimeters
  • MetersMeters

(デフォルト値は次のとおりです None)

String
戻り値
データ タイプ説明
Raster

The output raster.

コードのサンプル

UnitConversion example 1

This example calculates the input raster from meters per second to kilometers per hour.

from arcpy.sa import *
out_unit_raster = UnitConversion("wind_speed_meter_per_second.tif",
                                 "MetersPerSecond'", "KilometersPerHour")
out_unit_raster.save("C:/arcpyExamples/outputs/wind_speed_km_per_hour.tif")
UnitConversion example 2

This example calculates the input temperature raster from Celsius to Kelvin.

# Import system modules
import arcpy
from arcpy.sa import *

# Set the analysis environments
arcpy.env.workspace = "C:/arcpyExamples/data"

# Set the local variables
inRaster_File = "temperature_celcius.tif"
from_unit = 'Celsius'
to_unit = 'Kelvin'

# Execute UnitConversion function
out_unit_raster = UnitConversion(inRaster_File, from_unit, to_unit)

# Save the output
out_unit_raster.save("C:/arcpyExamples/outputs/temperature_kelvin.tif")

関連トピック