当前位置: 首页>>代码示例>>Python>>正文


Python Cdo.griddes方法代码示例

本文整理汇总了Python中cdo.Cdo.griddes方法的典型用法代码示例。如果您正苦于以下问题:Python Cdo.griddes方法的具体用法?Python Cdo.griddes怎么用?Python Cdo.griddes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cdo.Cdo的用法示例。


在下文中一共展示了Cdo.griddes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __getLonLat

# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import griddes [as 别名]
 def __getLonLat(self, ifile):
     """
     Get vectors with lon and lat values from a netdf file using cdo.griddes
     Was introduced because we were using a damaged grid
     lon,lat valued are located in the center of a gridbox
     
     :param ifile: netcdf fn
     :result: lon,lat vectors
     """
     def searchGriddes(grid, needle):
         tmp = [x for x in grid if x.find(needle) != -1]
         return float(tmp[0].split(' ')[-1])
     
     from cdo import Cdo
     cdo = Cdo()  
     grid = cdo.griddes(input=ifile)
     try:
         xinc = searchGriddes(grid, 'xinc')
         xsize = searchGriddes(grid, 'xsize')
         xfirst = searchGriddes(grid, 'xfirst')
     except:
         xinc = searchGriddes(grid, 'yinc')
         xsize = searchGriddes(grid, 'ysize')
         xfirst = searchGriddes(grid, 'yfirst')
     yfirst = searchGriddes(grid, 'yfirst')
     ysize = searchGriddes(grid, 'ysize')
     yinc = searchGriddes(grid, 'yinc')
     lon = np.arange(xfirst+xinc/2, xsize*xinc+xfirst+xinc/2, xinc, dtype=float)
     lat = np.arange(yfirst+yinc/2, ysize*yinc+yfirst+yinc/2, yinc, dtype=float)
     lon = np.arange(xfirst, xsize*xinc+xfirst, xinc, dtype=float)
     lat = np.arange(yfirst, ysize*yinc+yfirst, yinc, dtype=float)
     return lon, lat
开发者ID:illing2005,项目名称:murcss,代码行数:34,代码来源:significance2.py


注:本文中的cdo.Cdo.griddes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。