Python 读取MODIS叶绿素-a浓度.nc文件

 从nasa MODIS官方网站通过FTP获取的日数据,用于分析海洋叶绿素浓度,其数据格式为 .nc文件,

This algorithm returns the near-surface concentration of chlorophyll-a (chlor_a) in mg m-3, calculated using an empirical relationship derived from in situ measurements of chlor_a and blue-to-green band ratios of in situ remote sensing reflectances (Rrs). Implementation is contingent on the availability three or more sensor bands spanning the 440 - 570 nm spectral regime. The algorithm is applicable to all current ocean color sensors.

这种文件格式需要进行转换,和空间位置匹配,通过ArcGIS或者ENVI,可以实现,但是日数据进行月合成、季度合成,就显得力不从心了。图下为ArcGIS和ENVI打开图示:

Python 读取MODIS叶绿素-a浓度.nc文件Python 读取MODIS叶绿素-a浓度.nc文件

.nc文件为HDF5/NetCDF4格式文件,在python使用h5py或者netCDF4包进行解析。

解析过程如下:


、通过h5py获取叶绿素波段数据:

in_ds = h5py.File(nc_path)
chlor_a = in_ds['//geophysical_data/chlor_a'].value

、通过netCDF4获取基本信息:

coordinate = Dataset(nc_path)
coordinate.groups

Python 读取MODIS叶绿素-a浓度.nc文件Python 读取MODIS叶绿素-a浓度.nc文件

、结果显示:

Python 读取MODIS叶绿素-a浓度.nc文件