[gdal-dev] Error in Derived Band in Virtual raster

bhandari bhandari.ravi at outlook.com
Sun Dec 1 23:42:19 PST 2019


Hell All 

I have defined a derived Virtual Raster as follows.  
<VRTDataset rasterXSize="25828" rasterYSize="16749">
  <SRS>GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]]</SRS>
  <GeoTransform>  7.8318056012634287e+01,  1.1839023066784193e-04, 
0.0000000000000000e+00,  3.0866547275126596e+01,  0.0000000000000000e+00,
-7.3767782488687317e-05</GeoTransform>
    <VRTRasterBand dataType="Float32" band="1"
subClass="VRTDerivedRasterBand">
        <PixelFunctionType>add2</PixelFunctionType>
        <PixelFunctionLanguage>Python</PixelFunctionLanguage>
        <PixelFunctionCode>
        </PixelFunctionCode>
    <SimpleSource>
      <SourceFilename
relativeToVRT="1">S1A_IW_GRDH_1SDV_20180924T005140_20180924T005205_023833_0299C5_5216_Orb.tif</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="25828" RasterYSize="16749"
DataType="Float32" BlockXSize="25828" BlockYSize="16749" />
      <SrcRect xOff="0" yOff="0" xSize="25828" ySize="16749" />
      <DstRect xOff="0" yOff="0" xSize="25828" ySize="16749" />
    </SimpleSource>
    <SimpleSource>
      <SourceFilename
relativeToVRT="1">S1A_IW_GRDH_1SDV_20180924T005140_20180924T005205_023833_0299C5_5216_Orb.tif</SourceFilename>
      <SourceBand>2</SourceBand>
      <SourceProperties RasterXSize="25828" RasterYSize="16749"
DataType="Float32" BlockXSize="25828" BlockYSize="16749" />
      <SrcRect xOff="0" yOff="0" xSize="25828" ySize="16749" />
      <DstRect xOff="0" yOff="0" xSize="25828" ySize="16749" />
    </SimpleSource>
    </VRTRasterBand>
</VRTDataset>


But when try to read This virtual data as 
from osgeo import gdal
file=r'F:\Snow\snow_der.vrt'
gdal.SetConfigOption('GDAL_VRT_ENABLE_PYTHON', 'YES')
ds=gdal.Open(file)
data=ds.GetRasterBand(1)
cal=data.ReadAsArray()

print(cal)

it prints None

Please help in this 
 




--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list