本文整理汇总了Python中Scientific.IO.NetCDF.NetCDFFile.variables[lon_name][:]方法的典型用法代码示例。如果您正苦于以下问题:Python NetCDFFile.variables[lon_name][:]方法的具体用法?Python NetCDFFile.variables[lon_name][:]怎么用?Python NetCDFFile.variables[lon_name][:]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scientific.IO.NetCDF.NetCDFFile
的用法示例。
在下文中一共展示了NetCDFFile.variables[lon_name][:]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_elevation_nc
# 需要导入模块: from Scientific.IO.NetCDF import NetCDFFile [as 别名]
# 或者: from Scientific.IO.NetCDF.NetCDFFile import variables[lon_name][:] [as 别名]
def write_elevation_nc(file_out, lon, lat, depth_vector):
"""Write an nc elevation file."""
# NetCDF file definition
outfile = NetCDFFile(file_out, netcdf_mode_w)
#Create new file
nc_lon_lat_header(outfile, lon, lat)
# ELEVATION
zname = 'ELEVATION'
outfile.createVariable(zname, precision, (lat_name, lon_name))
outfile.variables[zname].units = 'CENTIMETERS'
outfile.variables[zname].missing_value = -1.e+034
outfile.variables[lon_name][:] = ensure_numeric(lon)
outfile.variables[lat_name][:] = ensure_numeric(lat)
depth = num.reshape(depth_vector, (len(lat), len(lon)))
outfile.variables[zname][:] = depth
outfile.close()