如何在python中从vrt文件创建栅格时间序列

时间:2015-12-14 15:15:52

标签: python gdal netcdf

我使用gdal(栅格虚拟格式)将一堆.tiff文件转换为.vrt

gdalbuildvrt -separate testvrt.vrt data/*.tif

无论如何都要从.vrt创建一个时间序列NetCDF文件!

testvrt.vrt

<VRTDataset rasterXSize="8000" rasterYSize="8000">
  <SRS>PROJCS["Azimuthal_Equidistant",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Azimuthal_Equidistant"],PARAMETER["latitude_of_center",8.5],PARAMETER["longitude_of_center",21.5],PARAMETER["false_easting",5621452.01998],PARAMETER["false_northing",5990638.42298],UNIT["metre",1,AUTHORITY["EPSG","9001"]]]</SRS>
  <GeoTransform>  6.0000000000000000e+06,  7.5000000000000000e+01,  0.0000000000000000e+00,  6.0000000000000000e+06,  0.0000000000000000e+00, -7.5000000000000000e+01</GeoTransform>
  <VRTRasterBand dataType="Int16" band="1">
    <NoDataValue>-9.99900000000000E+03</NoDataValue>
    <ComplexSource>
      <SourceFilename relativeToVRT="1">data_sample/R20060111_075725___SIG0__ASAWS___M1VVD_TUW_SGRT15A00_AF075M_E060N054T6.tif</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="8000" RasterYSize="8000" DataType="Int16" BlockXSize="8000" BlockYSize="1" />
      <SrcRect xOff="0" yOff="0" xSize="8000" ySize="8000" />
      <DstRect xOff="0" yOff="0" xSize="8000" ySize="8000" />
      <NODATA>-9999</NODATA>
    </ComplexSource>
  </VRTRasterBand>
  <VRTRasterBand dataType="Int16" band="2">
    <NoDataValue>-9.99900000000000E+03</NoDataValue>
    <ComplexSource>
      <SourceFilename relativeToVRT="1">data_sample/R20060114_080443___SIG0__ASAWS___M1VVD_TUW_SGRT15A00_AF075M_E060N054T6.tif</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="8000" RasterYSize="8000" DataType="Int16" BlockXSize="8000" BlockYSize="1" />
      <SrcRect xOff="0" yOff="0" xSize="8000" ySize="8000" />
      <DstRect xOff="0" yOff="0" xSize="8000" ySize="8000" />
      <NODATA>-9999</NODATA>
    </ComplexSource>
  </VRTRasterBand>
...

如何从python中的vrt文件创建光栅时间序列到NetCDF4格式?

1 个答案:

答案 0 :(得分:1)

你可以像你一样用单独的乐队转换为vrt。还可以制作图像路径的文本文件,您可以从中检索时间。 然后将它们加载到您的代码中。

查看我发布的POST,了解如何在NetCDF fotmat中编写它们。