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


Python CubeList.remove_coord方法代码示例

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


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

示例1: test_FAIL_phenomena_nostash

# 需要导入模块: from iris.cube import CubeList [as 别名]
# 或者: from iris.cube.CubeList import remove_coord [as 别名]
 def test_FAIL_phenomena_nostash(self):
     # If we remove the 'STASH' attributes, certain phenomena can still be
     # successfully encoded+decoded by standard load using LBFC values.
     # Structured loading gets this wrong, because it does not use LBFC in
     # characterising phenomena.
     flds = self.fields(c_t='1122', phn='0101')
     for fld in flds:
         del fld.attributes['STASH']
     file = self.save_fieldcubes(flds)
     results = iris.load(file)
     if not self.do_fast_loads:
         # This is what we'd LIKE to get (what iris.load gives).
         expected = CubeList(flds).merge()
     else:
         # At present, we get a cube incorrectly combined together over all
         # 4 timepoints, with the same phenomenon for all (!wrong!).
         # It's a bit tricky to arrange the existing data like that.
         # Do it by hacking the time values to allow merge, and then fixing
         # up the time
         old_t1, old_t2 = (fld.coord('time').points[0]
                           for fld in (flds[0], flds[2]))
         for i_fld, fld in enumerate(flds):
             # Hack the phenomena to all look like the first one.
             fld.rename('air_temperature')
             fld.units = 'K'
             # Hack the time points so the 4 cube can merge into one.
             fld.coord('time').points = [old_t1 + i_fld]
         one_cube = CubeList(flds).merge_cube()
         # Replace time dim with an anonymous dim.
         co_t_fake = one_cube.coord('time')
         one_cube.remove_coord(co_t_fake)
         # Reconstruct + add back the expected auxiliary time coord.
         co_t_new = AuxCoord([old_t1, old_t1, old_t2, old_t2],
                             standard_name='time', units=co_t_fake.units)
         one_cube.add_aux_coord(co_t_new, 0)
         expected = [one_cube]
     self.assertEqual(results, expected)
开发者ID:rcomer,项目名称:iris,代码行数:39,代码来源:test_fast_load.py


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