【问题标题】:How to create a raster time series from vrt file in python如何在python中从vrt文件创建栅格时间序列
【发布时间】:2016-03-20 03:16:35
【问题描述】:

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

【问题讨论】:

  • 你试过gdal_translate -of NetCDF testvrt.vrt testncdf.nc吗?
  • @Kersten gdal_translate 的问题是时间序列,你没有得到时间维度。
  • 时间维度在不同的bands/layers中表示,如gdalbuildvrt -separate调用。您是说不能将多层数据集转换为 NetCDF?
  • @Kersten 我使用了gdalbuildvrt -separate,如上所示。是的,这是个问题!

标签: python gdal netcdf


【解决方案1】:

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

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

【讨论】:

  • 感谢您的回答。这就是我一直在寻找的方式。
猜你喜欢
  • 2020-03-06
  • 2015-09-13
  • 1970-01-01
  • 2013-09-20
  • 2013-02-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-31
相关资源
最近更新 更多