本文整理汇总了Python中MA.masked_values方法的典型用法代码示例。如果您正苦于以下问题:Python MA.masked_values方法的具体用法?Python MA.masked_values怎么用?Python MA.masked_values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MA
的用法示例。
在下文中一共展示了MA.masked_values方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NetCDFFile
# 需要导入模块: import MA [as 别名]
# 或者: from MA import masked_values [as 别名]
# Open the netCDF files, get variables.
#
data_dir = Ngl.ncargpath("data")
ice1 = NetCDFFile(data_dir + "/cdf/fice.nc","r")
#
# Create a masked array to accommodate missing values in the fice variable.
#
fice = ice1.variables["fice"] # fice[120,49,100]
ficea = fice[:,:,:]
fill_value = None
if (hasattr(fice,"missing_value")):
fill_value = fice.missing_value
elif (hasattr(fice,"_FillValue")):
fill_value = fice._FillVlaue
fice_masked = MA.transpose(MA.masked_values(ficea,fill_value),(1,2,0))
hlat = ice1.variables["hlat"] # hlat[49]
hlon = ice1.variables["hlon"] # hlon[100]
dimf = fice.shape # Define an array to hold long-term monthly means.
ntime = fice.shape[0]
nhlat = fice.shape[1]
nhlon = fice.shape[2]
nmo = 0
month = nmo+1
icemon = MA.zeros((nhlat,nhlon),MA.Float0)
for i in xrange(fice_masked.shape[0]):