本文整理汇总了Python中ocgis.api.operations.OcgOperations.get_base_request_size方法的典型用法代码示例。如果您正苦于以下问题:Python OcgOperations.get_base_request_size方法的具体用法?Python OcgOperations.get_base_request_size怎么用?Python OcgOperations.get_base_request_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ocgis.api.operations.OcgOperations
的用法示例。
在下文中一共展示了OcgOperations.get_base_request_size方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_base_request_size_multifile_with_geom
# 需要导入模块: from ocgis.api.operations import OcgOperations [as 别名]
# 或者: from ocgis.api.operations.OcgOperations import get_base_request_size [as 别名]
def test_get_base_request_size_multifile_with_geom(self):
rd1 = self.test_data.get_rd('cancm4_tas')
rd2 = self.test_data.get_rd('narccap_pr_wrfg_ncep')
rds = [rd1,rd2]
ops = OcgOperations(dataset=rds,geom='state_boundaries',select_ugid=[23])
size = ops.get_base_request_size()
self.assertEqual(size,{'variables': {'pr': {'level': {'kb': 0.0, 'shape': None, 'dtype': None}, 'temporal': {'kb': 228.25, 'shape': (29216,), 'dtype': dtype('float64')}, 'value': {'kb': 21341.375, 'shape': (1, 29216, 1, 17, 11), 'dtype': dtype('float32')}, 'realization': {'kb': 0.0, 'shape': None, 'dtype': None}, 'col': {'kb': 0.0859375, 'shape': (11,), 'dtype': dtype('float64')}, 'row': {'kb': 0.1328125, 'shape': (17,), 'dtype': dtype('float64')}}, 'tas': {'level': {'kb': 0.0, 'shape': None, 'dtype': None}, 'temporal': {'kb': 28.515625, 'shape': (3650,), 'dtype': dtype('float64')}, 'value': {'kb': 171.09375, 'shape': (1, 3650, 1, 4, 3), 'dtype': dtype('float32')}, 'realization': {'kb': 0.0, 'shape': None, 'dtype': None}, 'col': {'kb': 0.0234375, 'shape': (3,), 'dtype': dtype('float64')}, 'row': {'kb': 0.03125, 'shape': (4,), 'dtype': dtype('float64')}}}, 'total': 21769.5078125})
示例2: test_get_base_request_size_multifile
# 需要导入模块: from ocgis.api.operations import OcgOperations [as 别名]
# 或者: from ocgis.api.operations.OcgOperations import get_base_request_size [as 别名]
def test_get_base_request_size_multifile(self):
rd1 = self.test_data.get_rd('cancm4_tas')
rd2 = self.test_data.get_rd('narccap_pr_wrfg_ncep')
rds = [rd1,rd2]
ops = OcgOperations(dataset=rds)
size = ops.get_base_request_size()
self.assertEqual({'variables': {'pr': {'level': {'kb': 0.0, 'shape': None, 'dtype': None}, 'temporal': {'kb': 228.25, 'shape': (29216,), 'dtype': dtype('float64')}, 'value': {'kb': 1666909.75, 'shape': (1, 29216, 1, 109, 134), 'dtype': dtype('float32')}, 'realization': {'kb': 0.0, 'shape': None, 'dtype': None}, 'col': {'kb': 1.046875, 'shape': (134,), 'dtype': dtype('float64')}, 'row': {'kb': 0.8515625, 'shape': (109,), 'dtype': dtype('float64')}}, 'tas': {'level': {'kb': 0.0, 'shape': None, 'dtype': None}, 'temporal': {'kb': 28.515625, 'shape': (3650,), 'dtype': dtype('float64')}, 'value': {'kb': 116800.0, 'shape': (1, 3650, 1, 64, 128), 'dtype': dtype('float32')}, 'realization': {'kb': 0.0, 'shape': None, 'dtype': None}, 'col': {'kb': 1.0, 'shape': (128,), 'dtype': dtype('float64')}, 'row': {'kb': 0.5, 'shape': (64,), 'dtype': dtype('float64')}}}, 'total': 1783969.9140625},size)
示例3: test_get_base_request_size_test_data
# 需要导入模块: from ocgis.api.operations import OcgOperations [as 别名]
# 或者: from ocgis.api.operations.OcgOperations import get_base_request_size [as 别名]
def test_get_base_request_size_test_data(self):
for key in self.test_data.keys():
rd = self.test_data.get_rd(key)
try:
ops = OcgOperations(dataset=rd)
## the project cmip data may raise an exception since projection is
## not associated with a variable
except DimensionNotFound:
rd = self.test_data.get_rd(key,kwds=dict(dimension_map={'R':'projection','T':'time','X':'longitude','Y':'latitude'}))
ops = OcgOperations(dataset=rd)
ret = ops.get_base_request_size()
self.assertTrue(ret['total'] > 1)
示例4: test_get_base_request_size_with_geom
# 需要导入模块: from ocgis.api.operations import OcgOperations [as 别名]
# 或者: from ocgis.api.operations.OcgOperations import get_base_request_size [as 别名]
def test_get_base_request_size_with_geom(self):
rd = self.test_data.get_rd('cancm4_tas')
ops = OcgOperations(dataset=rd, geom='state_boundaries', select_ugid=[23])
size = ops.get_base_request_size()
self.assertEqual(size, {'variables': {'tas': {'level': {'kb': 0.0, 'shape': None, 'dtype': None},
'temporal': {'kb': 28.515625, 'shape': (3650,),
'dtype': dtype('float64')},
'value': {'kb': 171.09375, 'shape': (1, 3650, 1, 4, 3),
'dtype': dtype('float32')},
'realization': {'kb': 0.0, 'shape': None, 'dtype': None},
'col': {'kb': 0.0234375, 'shape': (3,),
'dtype': dtype('float64')},
'row': {'kb': 0.03125, 'shape': (4,),
'dtype': dtype('float64')}}}, 'total': 199.6640625})
示例5: test_get_base_request_size
# 需要导入模块: from ocgis.api.operations import OcgOperations [as 别名]
# 或者: from ocgis.api.operations.OcgOperations import get_base_request_size [as 别名]
def test_get_base_request_size(self):
rd = self.test_data.get_rd('cancm4_tas')
ops = OcgOperations(dataset=rd)
size = ops.get_base_request_size()
self.assertEqual(size, {'variables': {'tas': {'level': {'kb': 0.0, 'shape': None, 'dtype': None},
'temporal': {'kb': 28.515625, 'shape': (3650,),
'dtype': dtype('float64')},
'value': {'kb': 116800.0, 'shape': (1, 3650, 1, 64, 128),
'dtype': dtype('float32')},
'realization': {'kb': 0.0, 'shape': None, 'dtype': None},
'col': {'kb': 1.0, 'shape': (128,), 'dtype': dtype('float64')},
'row': {'kb': 0.5, 'shape': (64,), 'dtype': dtype('float64')}}},
'total': 116830.015625})
with self.assertRaises(DefinitionValidationError):
OcgOperations(dataset=rd, regrid_destination=rd).get_base_request_size()
示例6: test_get_base_request_size_with_calculation
# 需要导入模块: from ocgis.api.operations import OcgOperations [as 别名]
# 或者: from ocgis.api.operations.OcgOperations import get_base_request_size [as 别名]
def test_get_base_request_size_with_calculation(self):
rd = self.test_data.get_rd('cancm4_tas')
ops = OcgOperations(dataset=rd,calc=[{'func':'mean','name':'mean'}],
calc_grouping=['month'])
size = ops.get_base_request_size()
self.assertEqual(size['variables']['tas']['temporal']['shape'][0],3650)