建了一个QQ群,大家可以在里边聊聊水色遥感数据下载和数据处理方面的事情:1087024529
之前有写过一篇关于将HDF5转为GeoTIFF的文章:Python+GDAL将GOCI数据转为GeoTIFF。最近一直有人在问NetCDF数据转为GeoTIFF。其实思路是一样的:
1.构造一个VRT文件;
2.使用该VRT文件进行转换。
多余的这里就不再介绍,详细的说明可以参考:Python+GDAL将GOCI数据转为GeoTIFF。
这里只列VRT的例子。
如果经纬度和波段数据都在一个netCDF文件中,例子如下(这里有两个波段的数据):
<VRTDataset rasterXSize="4865" rasterYSize="4090">
<Metadata domain="GEOLOCATION">
<MDI key="LINE_OFFSET">0</MDI>
<MDI key="LINE_STEP">1</MDI>
<MDI key="PIXEL_OFFSET">0</MDI>
<MDI key="PIXEL_STEP">1</MDI>
<MDI key="SRS">GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]</MDI>
<MDI key="X_BAND">1</MDI>
<MDI key="X_DATASET">NETCDF:"G:/S3A_OL_1_EFR____20200815T020224_20200815T020524_20200816T062556_0179_061_331_2340_LN1_O_NT_002_C2RCC.nc":lon</MDI>
<MDI key="Y_BAND">1</MDI>
<MDI key="Y_DATASET">NETCDF:"G:/S3A_OL_1_EFR____20200815T020224_20200815T020524_20200816T062556_0179_061_331_2340_LN1_O_NT_002_C2RCC.nc":lat</MDI>
</Metadata>
<VRTRasterBand dataType="FLOAT32" band="1">
<SimpleSource>
<SourceFilename relativeToVRT="0">NETCDF:"G:/S3A_OL_1_EFR____20200815T020224_20200815T020524_20200816T062556_0179_061_331_2340_LN1_O_NT_002_C2RCC.nc":rrs_1</SourceFilename>
<SourceBand>1</SourceBand>
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="FLOAT32" band="2">
<SimpleSource>
<SourceFilename relativeToVRT="0">NETCDF:"G:/S3A_OL_1_EFR____20200815T020224_20200815T020524_20200816T062556_0179_061_331_2340_LN1_O_NT_002_C2RCC.nc":rrs_2</SourceFilename>
<SourceBand>1</SourceBand>
</SimpleSource>
</VRTRasterBand>
</VRTDataset>