本文整理汇总了Python中ocgis.RequestDataset.uid方法的典型用法代码示例。如果您正苦于以下问题:Python RequestDataset.uid方法的具体用法?Python RequestDataset.uid怎么用?Python RequestDataset.uid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ocgis.RequestDataset
的用法示例。
在下文中一共展示了RequestDataset.uid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __iter__
# 需要导入模块: from ocgis import RequestDataset [as 别名]
# 或者: from ocgis.RequestDataset import uid [as 别名]
def __iter__(self):
non_iterables = [AbstractRequestObject, dict, Field]
if env.USE_ESMF:
from ocgis.regrid.base import ESMF
non_iterables.append(ESMF.Field)
if isinstance(self._value, tuple(non_iterables)):
to_itr = [self._value]
else:
to_itr = self._value
for uid, element in enumerate(to_itr, start=1):
if isinstance(element, dict):
element = RequestDataset(**element)
if env.USE_ESMF and isinstance(element, ESMF.Field):
from ocgis.regrid.base import get_ocgis_field_from_esmf_field
element = get_ocgis_field_from_esmf_field(element)
try:
element = element.copy()
except AttributeError:
element = copy(element)
if element.uid is None:
element.uid = uid
# TODO: Remove me once the driver does not accept request datasets at initialization.
# Try to change the driver UID.
try:
element.driver.rd.uid = uid
except AttributeError:
# The field driver does not keep a copy of the request dataset.
if hasattr(element.driver, 'rd'):
raise
yield element