我使用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格式创建栅格时间序列?

最佳答案

您可以像以前一样使用单独的频段转换为vrt。还可以创建图像路径的文本文件,您可以从中检索时间。
然后将它们加载到您的代码中。

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

08-05 12:49