本文整理汇总了Python中cis.data_io.ungridded_data.UngriddedData.coords方法的典型用法代码示例。如果您正苦于以下问题:Python UngriddedData.coords方法的具体用法?Python UngriddedData.coords怎么用?Python UngriddedData.coords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cis.data_io.ungridded_data.UngriddedData
的用法示例。
在下文中一共展示了UngriddedData.coords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_can_create_ungridded_data
# 需要导入模块: from cis.data_io.ungridded_data import UngriddedData [as 别名]
# 或者: from cis.data_io.ungridded_data.UngriddedData import coords [as 别名]
def test_can_create_ungridded_data(self):
x_points = np.arange(-10, 11, 5)
y_points = np.arange(-5, 6, 5)
y, x = np.meshgrid(y_points, x_points)
x = Coord(x, Metadata(standard_name='latitude', units='degrees'))
y = Coord(y, Metadata(standard_name='longitude', units='degrees'))
data = np.reshape(np.arange(15) + 1.0, (5, 3))
coords = CoordList([x, y])
ug = UngriddedData(data, Metadata(standard_name='rain', long_name="TOTAL RAINFALL RATE: LS+CONV KG/M2/S",
units="kg m-2 s-1", missing_value=-999), coords)
standard_coords = ug.coords().find_standard_coords()
assert(standard_coords == [x, y, None, None, None])
assert(ug.data.size == 15)
示例2: test_GIVEN_missing_coord_values_WHEN_coords_data_THEN_missing_values_removed
# 需要导入模块: from cis.data_io.ungridded_data import UngriddedData [as 别名]
# 或者: from cis.data_io.ungridded_data.UngriddedData import coords [as 别名]
def test_GIVEN_missing_coord_values_WHEN_coords_data_THEN_missing_values_removed(self):
x_points = np.arange(-10, 11, 5)
y_points = np.arange(-5, 6, 5)
y, x = np.meshgrid(y_points, x_points)
y = np.ma.masked_array(y, np.zeros(y.shape, dtype=bool))
y.mask[1, 2] = True
x = Coord(x, Metadata(standard_name='latitude', units='degrees'))
y = Coord(y, Metadata(standard_name='longitude', units='degrees'))
coords = CoordList([x, y])
data = np.reshape(np.arange(15) + 1.0, (5, 3))
ug = UngriddedData(None, Metadata(), coords, lambda x: data)
coords = ug.coords()
for coord in coords:
assert_that(len(coord.data), is_(14))