コード例 #1
0
def SetNoDataBelowThreshold(raster_filename, new_raster_filename, threshold=0, driver_name="ENVI", NoDataValue=-9999):

    # read the data
    rasterArray = LSDMap_IO.ReadRasterArrayBlocks(raster_filename)
    print "Read the data"

    # set any point on the raster below the threshold as nodata
    rasterArray[rasterArray <= threshold] = NoDataValue
    print "Reset raster values"

    # write the data to a new file
    LSDMap_IO.array2raster(raster_filename, new_raster_filename, rasterArray, driver_name, NoDataValue)
    print "Wrote raster"
コード例 #2
0
def GetHillshade(raster_filename,
                 new_raster_filename,
                 azimuth=315,
                 angle_altitude=45,
                 driver_name="ENVI",
                 NoDataValue=-9999):

    # get the hillshade
    hillshade_raster = LSDMBP.Hillshade(raster_filename, azimuth,
                                        angle_altitude)

    # write to file
    LSDMap_IO.array2raster(raster_filename, new_raster_filename,
                           hillshade_raster, driver_name, NoDataValue)
コード例 #3
0
def SetToConstantValue(raster_filename, new_raster_filename, constant_value, driver_name="ENVI"):

    # get the nodata value
    NoDataValue = LSDMap_IO.getNoDataValue(raster_filename)

    # read the data
    rasterArray = LSDMap_IO.ReadRasterArrayBlocks(raster_filename)
    print "Read the data"

    # set any nodata to a constant value
    rasterArray[rasterArray != NoDataValue] = constant_value
    print "Changed to a constant value"

    # write the data to a new file
    LSDMap_IO.array2raster(raster_filename, new_raster_filename, rasterArray, driver_name, NoDataValue)
    print "Wrote raster"
コード例 #4
0
def SetNoDataBelowThreshold(raster_filename,
                            new_raster_filename,
                            threshold=0,
                            driver_name="ENVI",
                            NoDataValue=-9999):

    # read the data
    rasterArray = LSDMap_IO.ReadRasterArrayBlocks(raster_filename)
    print "Read the data"

    # set any point on the raster below the threshold as nodata
    rasterArray[rasterArray <= threshold] = NoDataValue
    print "Reset raster values"

    # write the data to a new file
    LSDMap_IO.array2raster(raster_filename, new_raster_filename, rasterArray,
                           driver_name, NoDataValue)
    print "Wrote raster"
コード例 #5
0
def SetToConstantValue(raster_filename,
                       new_raster_filename,
                       constant_value,
                       driver_name="ENVI"):

    # get the nodata value
    NoDataValue = LSDMap_IO.getNoDataValue(raster_filename)

    # read the data
    rasterArray = LSDMap_IO.ReadRasterArrayBlocks(raster_filename)
    print "Read the data"

    # set any nodata to a constant value
    rasterArray[rasterArray != NoDataValue] = constant_value
    print "Changed to a constant value"

    # write the data to a new file
    LSDMap_IO.array2raster(raster_filename, new_raster_filename, rasterArray,
                           driver_name, NoDataValue)
    print "Wrote raster"