當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。