def to_netcdf(self, path):
"""
Store the model in a netCDF file that attempts to be displayable
using standard tools and loosely follows the WRF 'standard'.
:param path: the path where to store the model
"""
import netCDF4
d = netCDF4.Dataset(path, 'w', format='NETCDF4')
d0, d1, k = self.m_ext.shape
d.createDimension('fuel_moisture_classes_stag', k)
d.createDimension('south_north', d0)
d.createDimension('west_east', d1)
ncfmc = d.createVariable('FMC_GC', 'f4', ('south_north', 'west_east','fuel_moisture_classes_stag'))
ncfmc[:,:,:] = self.m_ext
ncfmc_cov = d.createVariable('FMC_COV', 'f4', ('south_north', 'west_east','fuel_moisture_classes_stag', 'fuel_moisture_classes_stag'))
ncfmc_cov[:,:,:,:] = self.P
d.close()
评论列表
文章目录